Documentation ¶
Index ¶
- func RequestInfo(conn *Connection, names ...string) (map[string]string, error)
- func RequestNodeInfo(node *Node, name ...string) (map[string]string, error)
- func RequestNodeStats(node *Node) (map[string]string, error)
- func SetCommandBufferPool(poolSize, initBufSize, maxBufferSize int)
- type AerospikeBlob
- type BasePolicy
- type BaseTask
- type Bin
- type BinMap
- type BytesValue
- type Client
- func (clnt *Client) Add(policy *WritePolicy, key *Key, bins BinMap) error
- func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) Append(policy *WritePolicy, key *Key, bins BinMap) error
- func (clnt *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) BatchExists(policy *BasePolicy, keys []*Key) ([]bool, error)
- func (clnt *Client) BatchGet(policy *BasePolicy, keys []*Key, binNames ...string) ([]*Record, error)
- func (clnt *Client) BatchGetHeader(policy *BasePolicy, keys []*Key) ([]*Record, error)
- func (clnt *Client) Close()
- func (clnt *Client) CreateIndex(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, error)
- func (clnt *Client) Delete(policy *WritePolicy, key *Key) (bool, error)
- func (clnt *Client) DropIndex(policy *WritePolicy, namespace string, setName string, indexName string) error
- func (clnt *Client) Execute(policy *WritePolicy, key *Key, packageName string, functionName string, ...) (interface{}, error)
- func (clnt *Client) ExecuteUDF(policy *QueryPolicy, statement *Statement, packageName string, ...) (*ExecuteTask, error)
- func (clnt *Client) Exists(policy *BasePolicy, key *Key) (bool, error)
- func (clnt *Client) Get(policy *BasePolicy, key *Key, binNames ...string) (*Record, error)
- func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, error)
- func (clnt *Client) GetLargeList(policy *WritePolicy, key *Key, binName string, userModule string) *LargeList
- func (clnt *Client) GetLargeMap(policy *WritePolicy, key *Key, binName string, userModule string) *LargeMap
- func (clnt *Client) GetLargeSet(policy *WritePolicy, key *Key, binName string, userModule string) *LargeSet
- func (clnt *Client) GetLargeStack(policy *WritePolicy, key *Key, binName string, userModule string) *LargeStack
- func (clnt *Client) GetNodeNames() []string
- func (clnt *Client) GetNodes() []*Node
- func (clnt *Client) IsConnected() bool
- func (clnt *Client) ListUDF(policy *BasePolicy) ([]*UDF, error)
- func (clnt *Client) Operate(policy *WritePolicy, key *Key, operations ...*Operation) (*Record, error)
- func (clnt *Client) Prepend(policy *WritePolicy, key *Key, bins BinMap) error
- func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) Put(policy *WritePolicy, key *Key, bins BinMap) error
- func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, error)
- func (clnt *Client) RegisterUDF(policy *WritePolicy, udfBody []byte, serverPath string, language Language) (*RegisterTask, error)
- func (clnt *Client) RegisterUDFFromFile(policy *WritePolicy, clientPath string, serverPath string, language Language) (*RegisterTask, error)
- func (clnt *Client) RemoveUDF(policy *WritePolicy, udfName string) (*RemoveTask, error)
- func (clnt *Client) ScanAll(policy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, error)
- func (clnt *Client) ScanNode(policy *ScanPolicy, node *Node, namespace string, setName string, ...) (*Recordset, error)
- func (clnt *Client) Touch(policy *WritePolicy, key *Key) error
- type ClientPolicy
- type Cluster
- func (clstr *Cluster) AddSeeds(hosts []*Host)
- func (clstr *Cluster) Close()
- func (clstr *Cluster) FindNodeName(list []*Node, name string) bool
- func (clstr *Cluster) GetNode(partition *Partition) (*Node, error)
- func (clstr *Cluster) GetNodeByName(nodeName string) (*Node, error)
- func (clstr *Cluster) GetNodes() []*Node
- func (clstr *Cluster) GetRandomNode() (*Node, error)
- func (clstr *Cluster) IsConnected() bool
- func (clstr *Cluster) MigrationInProgress(timeout time.Duration) (res bool, err error)
- func (clstr *Cluster) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)
- type Connection
- type ExecuteTask
- type FieldType
- type Filter
- type GenerationPolicy
- type Host
- type IndexTask
- type IndexType
- type IntegerValue
- type Key
- type Language
- type LargeList
- func (ll *LargeList) Add(values ...interface{}) error
- func (ll *LargeList) Destroy() error
- func (ll *LargeList) Filter(filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) Find(value interface{}) ([]interface{}, error)
- func (ll *LargeList) FindThenFilter(value interface{}, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) GetCapacity() (int, error)
- func (ll *LargeList) GetConfig() (map[interface{}]interface{}, error)
- func (ll *LargeList) Remove(value interface{}) error
- func (ll *LargeList) Scan() ([]interface{}, error)
- func (ll *LargeList) SetCapacity(capacity int) error
- func (ll *LargeList) Size() (int, error)
- type LargeMap
- func (lm *LargeMap) Destroy() error
- func (lm *LargeMap) Filter(filterName string, filterArgs ...interface{}) (map[interface{}]interface{}, error)
- func (lm *LargeMap) Get(name interface{}) (map[interface{}]interface{}, error)
- func (lm *LargeMap) GetCapacity() (int, error)
- func (lm *LargeMap) GetConfig() (map[interface{}]interface{}, error)
- func (lm *LargeMap) Put(name interface{}, value interface{}) error
- func (lm *LargeMap) PutMap(theMap map[interface{}]interface{}) error
- func (lm *LargeMap) Scan() (map[interface{}]interface{}, error)
- func (lm *LargeMap) SetCapacity(capacity int) error
- func (lm *LargeMap) Size() (int, error)
- type LargeObject
- type LargeSet
- func (ls *LargeSet) Add(values ...interface{}) error
- func (ls *LargeSet) Destroy() error
- func (ls *LargeSet) Exists(value interface{}) (bool, error)
- func (ls *LargeSet) Filter(filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ls *LargeSet) Get(value interface{}) (interface{}, error)
- func (ls *LargeSet) GetCapacity() (int, error)
- func (ls *LargeSet) GetConfig() (map[interface{}]interface{}, error)
- func (ls *LargeSet) Remove(value interface{}) error
- func (ls *LargeSet) Scan() ([]interface{}, error)
- func (ls *LargeSet) SetCapacity(capacity int) error
- func (ls *LargeSet) Size() (int, error)
- type LargeStack
- func (lstk *LargeStack) Destroy() error
- func (lstk *LargeStack) Filter(peekCount int, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (lstk *LargeStack) GetCapacity() (int, error)
- func (lstk *LargeStack) GetConfig() (map[interface{}]interface{}, error)
- func (lstk *LargeStack) Peek(peekCount int) ([]interface{}, error)
- func (lstk *LargeStack) Pop(count int) ([]interface{}, error)
- func (lstk *LargeStack) Push(values ...interface{}) error
- func (lstk *LargeStack) Scan() ([]interface{}, error)
- func (lstk *LargeStack) SetCapacity(capacity int) error
- func (lstk *LargeStack) Size() (int, error)
- type ListValue
- type LongValue
- type MapValue
- type Node
- func (nd *Node) AddAlias(aliasToAdd *Host)
- func (nd *Node) Close()
- func (nd *Node) DecreaseHealth()
- func (nd *Node) Equals(other *Node) bool
- func (nd *Node) GetAliases() []*Host
- func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err error)
- func (nd *Node) GetHost() *Host
- func (nd *Node) GetName() string
- func (nd *Node) IsActive() bool
- func (nd *Node) IsUnhealthy() bool
- func (nd *Node) MigrationInProgress() (bool, error)
- func (nd *Node) PutConnection(conn *Connection)
- func (nd *Node) Refresh() ([]*Host, error)
- func (nd *Node) RestoreHealth()
- func (nd *Node) String() string
- func (nd *Node) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)
- type NodeError
- type NullValue
- type Operation
- type OperationType
- type Partition
- type Policy
- type Priority
- type QueryPolicy
- type Record
- type RecordExistsAction
- type Recordset
- type RegisterTask
- type RemoveTask
- type ScanPolicy
- type Statement
- type StringValue
- type Task
- type UDF
- type Value
- type ValueArray
- type WritePolicy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RequestInfo ¶
func RequestInfo(conn *Connection, names ...string) (map[string]string, error)
Get info values by name from the specified connection
func RequestNodeInfo ¶ added in v1.0.1
Get info values by name from the specified database server node.
func RequestNodeStats ¶ added in v1.0.1
RequestNodeStats returns statistics for the specified node as a map
func SetCommandBufferPool ¶ added in v1.0.1
func SetCommandBufferPool(poolSize, initBufSize, maxBufferSize int)
SetBufferPool can be used to customize the command Buffer Pool parameters to calibrate the pool for different workloads
Types ¶
type AerospikeBlob ¶
type BasePolicy ¶
type BasePolicy struct { Policy // Priority of request relative to other transactions. // Currently, only used for scans. Priority Priority //= Priority.DEFAULT; // Transaction timeout. // This timeout is used to set the socket timeout and is also sent to the // server along with the transaction in the wire protocol. // Default to no timeout (0). Timeout time.Duration // Maximum number of retries before aborting the current transaction. // A retry is attempted when there is a network error other than timeout. // If maxRetries is exceeded, the abort will occur even if the timeout // has not yet been exceeded. MaxRetries int //= 2; // Duration to sleep between retries if a transaction fails and the // timeout was not exceeded. Enter zero to skip sleep. SleepBetweenRetries time.Duration //= 500ms; }
Container object for transaction policy attributes used in all database operation calls.
func NewPolicy ¶
func NewPolicy() *BasePolicy
func (*BasePolicy) GetBasePolicy ¶
func (p *BasePolicy) GetBasePolicy() *BasePolicy
type BaseTask ¶ added in v1.0.1
type BaseTask struct {
// contains filtered or unexported fields
}
Task used to poll for server task completion.
type Bin ¶
type Bin struct { // Bin name. Current limit is 14 characters. Name string // Bin value. Value Value }
Column name/value pair.
type BinMap ¶
type BinMap map[string]interface{}
BinMap is used to define a map of bin names to values
type BytesValue ¶
type BytesValue struct {
// contains filtered or unexported fields
}
Byte array value.
func NewBlobValue ¶
func NewBlobValue(object AerospikeBlob) *BytesValue
NewBlobValue accepts an AerospikeBlob interface, and automatically converts it to a BytesValue. If Encode returns an err, it will panic.
func NewBytesValue ¶
func NewBytesValue(bytes []byte) *BytesValue
func (*BytesValue) GetObject ¶
func (vl *BytesValue) GetObject() interface{}
func (*BytesValue) GetType ¶
func (vl *BytesValue) GetType() int
func (*BytesValue) String ¶
func (vl *BytesValue) String() string
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClientWithPolicy ¶
func NewClientWithPolicy(policy *ClientPolicy, hostname string, port int) (*Client, error)
NewClientWithPolicy generates a new Client and sets the ClientPolicy
func NewClientWithPolicyAndHost ¶
func NewClientWithPolicyAndHost(policy *ClientPolicy, hosts ...*Host) (*Client, error)
NewClientWithPolicyAndHost generates a new Client and sets the ClientPolicy and sets up the cluster
func (*Client) Add ¶
func (clnt *Client) Add(policy *WritePolicy, key *Key, bins BinMap) error
Add integer bin values to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for integer values.
func (*Client) AddBins ¶
func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) Append ¶
func (clnt *Client) Append(policy *WritePolicy, key *Key, bins BinMap) error
Append bin values string to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call only works for string values.
func (*Client) AppendBins ¶
func (clnt *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) BatchExists ¶ added in v1.0.1
func (clnt *Client) BatchExists(policy *BasePolicy, keys []*Key) ([]bool, error)
Check if multiple record keys exist in one batch call. The returned array bool is in positional order with the original key array order. The policy can be used to specify timeouts.
func (*Client) BatchGet ¶ added in v1.0.1
func (clnt *Client) BatchGet(policy *BasePolicy, keys []*Key, binNames ...string) ([]*Record, error)
Read multiple record headers and bins for specified keys in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be nil. The policy can be used to specify timeouts.
func (*Client) BatchGetHeader ¶ added in v1.0.1
func (clnt *Client) BatchGetHeader(policy *BasePolicy, keys []*Key) ([]*Record, error)
Read multiple record header data for specified keys in one batch call. The returned records are in positional order with the original key array order. If a key is not found, the positional record will be nil. The policy can be used to specify timeouts.
func (*Client) Close ¶
func (clnt *Client) Close()
Close all client connections to database server nodes.
func (*Client) CreateIndex ¶ added in v1.0.1
func (clnt *Client) CreateIndex( policy *WritePolicy, namespace string, setName string, indexName string, binName string, indexType IndexType, ) (*IndexTask, error)
Create secondary index. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. <p> This method is only supported by Aerospike 3 servers.
func (*Client) Delete ¶
func (clnt *Client) Delete(policy *WritePolicy, key *Key) (bool, error)
Delete record for specified key. The policy specifies the transaction timeout.
func (*Client) DropIndex ¶ added in v1.0.1
func (clnt *Client) DropIndex( policy *WritePolicy, namespace string, setName string, indexName string, ) error
Delete secondary index. This method is only supported by Aerospike 3 servers.
func (*Client) Execute ¶ added in v1.0.1
func (clnt *Client) Execute(policy *WritePolicy, key *Key, packageName string, functionName string, args ...Value) (interface{}, error)
Execute user defined function on server and return results. The function operates on a single record. The package name is used to locate the udf file location:
udf file = <server udf dir>/<package name>.lua
This method is only supported by Aerospike 3 servers.
func (*Client) ExecuteUDF ¶ added in v1.0.1
func (clnt *Client) ExecuteUDF(policy *QueryPolicy, statement *Statement, packageName string, functionName string, functionArgs ...Value, ) (*ExecuteTask, error)
Apply user defined function on records that match the statement filter. Records are not returned to the client. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned ExecuteTask instance.
This method is only supported by Aerospike 3 servers.
func (*Client) Exists ¶
func (clnt *Client) Exists(policy *BasePolicy, key *Key) (bool, error)
Determine if a record key exists. The policy can be used to specify timeouts.
func (*Client) Get ¶
Read record header and bins for specified key. The policy can be used to specify timeouts.
func (*Client) GetHeader ¶
func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, error)
Read record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts.
func (*Client) GetLargeList ¶ added in v1.0.1
func (clnt *Client) GetLargeList(policy *WritePolicy, key *Key, binName string, userModule string) *LargeList
Initialize large list operator. This operator can be used to create and manage a list within a single bin.
This method is only supported by Aerospike 3 servers.
func (*Client) GetLargeMap ¶ added in v1.0.1
func (clnt *Client) GetLargeMap(policy *WritePolicy, key *Key, binName string, userModule string) *LargeMap
Initialize large map operator. This operator can be used to create and manage a map within a single bin.
This method is only supported by Aerospike 3 servers.
func (*Client) GetLargeSet ¶ added in v1.0.1
func (clnt *Client) GetLargeSet(policy *WritePolicy, key *Key, binName string, userModule string) *LargeSet
Initialize large set operator. This operator can be used to create and manage a set within a single bin.
This method is only supported by Aerospike 3 servers.
func (*Client) GetLargeStack ¶ added in v1.0.1
func (clnt *Client) GetLargeStack(policy *WritePolicy, key *Key, binName string, userModule string) *LargeStack
Initialize large stack operator. This operator can be used to create and manage a stack within a single bin.
This method is only supported by Aerospike 3 servers.
func (*Client) GetNodeNames ¶
Return list of active server node names in the cluster.
func (*Client) IsConnected ¶
Determine if we are ready to talk to the database server cluster.
func (*Client) ListUDF ¶ added in v1.0.1
func (clnt *Client) ListUDF(policy *BasePolicy) ([]*UDF, error)
ListUDF lists all packages containing user defined functions in the server. This method is only supported by Aerospike 3 servers.
func (*Client) Operate ¶ added in v1.0.1
func (clnt *Client) Operate(policy *WritePolicy, key *Key, operations ...*Operation) (*Record, error)
Perform multiple read/write operations on a single key in one batch call. An example would be to add an integer value to an existing record and then read the result, all in one database call.
Write operations are always performed first, regardless of operation order relative to read operations.
func (*Client) Prepend ¶
func (clnt *Client) Prepend(policy *WritePolicy, key *Key, bins BinMap) error
Prepend bin values string to existing record bin values. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This call works only for string values.
func (*Client) PrependBins ¶
func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) Put ¶
func (clnt *Client) Put(policy *WritePolicy, key *Key, bins BinMap) error
Write record bin(s). The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists.
func (*Client) PutBins ¶
func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) error
Write record bin(s). The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists.
func (*Client) Query ¶ added in v1.0.1
func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, error)
Execute query and return record iterator. The query executor puts records on a channel separate goroutines. The caller concurrently pops records off the channel through the record iterator.
This method is only supported by Aerospike 3 servers.
func (*Client) RegisterUDF ¶ added in v1.0.1
func (clnt *Client) RegisterUDF(policy *WritePolicy, udfBody []byte, serverPath string, language Language) (*RegisterTask, error)
Register package containing user defined functions with server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.
This method is only supported by Aerospike 3 servers.
func (*Client) RegisterUDFFromFile ¶ added in v1.0.1
func (clnt *Client) RegisterUDFFromFile(policy *WritePolicy, clientPath string, serverPath string, language Language) (*RegisterTask, error)
Register package containing user defined functions with server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RegisterTask instance.
This method is only supported by Aerospike 3 servers.
func (*Client) RemoveUDF ¶ added in v1.0.1
func (clnt *Client) RemoveUDF(policy *WritePolicy, udfName string) (*RemoveTask, error)
RemoveUDF removes a package containing user defined functions in the server. This asynchronous server call will return before command is complete. The user can optionally wait for command completion by using the returned RemoveTask instance.
This method is only supported by Aerospike 3 servers.
func (*Client) ScanAll ¶ added in v1.0.1
func (clnt *Client) ScanAll(policy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, error)
Read all records in specified namespace and set. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read in series.
This call will block until the scan is complete - callbacks are made within the scope of this call.
func (*Client) ScanNode ¶ added in v1.0.1
func (clnt *Client) ScanNode(policy *ScanPolicy, node *Node, namespace string, setName string, binNames ...string) (*Recordset, error)
Read all records in specified namespace and set for one node only. The node is specified by name.
This call will block until the scan is complete - callbacks are made within the scope of this call.
type ClientPolicy ¶
type ClientPolicy struct { // Initial host connection timeout in milliseconds. The timeout when opening a connection // to the server host for the first time. Timeout time.Duration //= 1 second // Size of the Connection Queue cache. ConnectionQueueSize int //= 256 // Throw exception if host connection fails during addHost(). FailIfNotConnected bool //= true }
Container object for client policy command.
func NewClientPolicy ¶
func NewClientPolicy() *ClientPolicy
Generates a new ClientPolicy with default values
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
func NewCluster ¶
func NewCluster(policy *ClientPolicy, hosts []*Host) (*Cluster, error)
func (*Cluster) AddSeeds ¶
Adds new hosts to the cluster They will be added to the cluster on next tend
func (*Cluster) Close ¶
func (clstr *Cluster) Close()
Closes all cached connections to the cluster nodes and stops the tend goroutine
func (*Cluster) FindNodeName ¶
FIXIT: This function is not well desined while it is expoted. Finds a node by name in a list of nodes
func (*Cluster) GetNodeByName ¶
Find a node by name and returns an error if not found
func (*Cluster) GetRandomNode ¶
Returns a random node on the cluster
func (*Cluster) IsConnected ¶
func (*Cluster) MigrationInProgress ¶ added in v1.0.1
MigrationInProgress determines if any node in the cluster is participating in a data migration
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection represents a connection with a timeout
func NewConnection ¶
func NewConnection(address string, timeout time.Duration) (*Connection, error)
NewConnection creates a connection on the network and returns the pointer A minimum timeout of 2 seconds will always be applied. If the connection is not established in the specified timeout, an error will be returned
func (*Connection) IsConnected ¶
func (ctn *Connection) IsConnected() bool
Returns true if the connection is not closed
func (*Connection) Read ¶
func (ctn *Connection) Read(buf []byte, length int) (total int, err error)
Reads from connection buffer to the slice
func (*Connection) SetTimeout ¶
func (ctn *Connection) SetTimeout(timeout time.Duration) error
sets connection timeout
type ExecuteTask ¶ added in v1.0.1
type ExecuteTask struct { BaseTask // contains filtered or unexported fields }
Task used to poll for long running server execute job completion.
func NewExecuteTask ¶ added in v1.0.1
func NewExecuteTask(cluster *Cluster, statement *Statement) *ExecuteTask
Initialize task with fields needed to query server nodes.
func (*ExecuteTask) IsDone ¶ added in v1.0.1
func (etsk *ExecuteTask) IsDone() (bool, error)
Query all nodes for task completion status.
func (*ExecuteTask) OnComplete ¶ added in v1.0.1
func (etsk *ExecuteTask) OnComplete() chan error
type FieldType ¶
type FieldType int
FieldType represents the type of the field in Aerospike Wire Protocol
const ( NAMESPACE FieldType = 0 TABLE FieldType = 1 KEY FieldType = 2 //BIN FieldType = 3; DIGEST_RIPE FieldType = 4 //GU_TID FieldType = 5; DIGEST_RIPE_ARRAY FieldType = 6 TRAN_ID FieldType = 7 // user supplied transaction id, which is simply passed back SCAN_OPTIONS FieldType = 8 INDEX_NAME FieldType = 21 INDEX_RANGE FieldType = 22 INDEX_FILTER FieldType = 23 INDEX_LIMIT FieldType = 24 INDEX_ORDER_BY FieldType = 25 UDF_PACKAGE_NAME FieldType = 30 UDF_FUNCTION FieldType = 31 UDF_ARGLIST FieldType = 32 UDF_OP FieldType = 33 QUERY_BINLIST FieldType = 40 )
type Filter ¶ added in v1.0.1
type Filter struct {
// contains filtered or unexported fields
}
Query filter definition.
func NewEqualFilter ¶ added in v1.0.1
Create equality filter for query.
type GenerationPolicy ¶
type GenerationPolicy int
How to handle record writes based on record generation.
const ( // Do not use record generation to restrict writes. NONE GenerationPolicy = iota // Update/delete record if expected generation is equal to server generation. Otherwise, fail. EXPECT_GEN_EQUAL // Update/delete record if expected generation greater than the server generation. Otherwise, fail. // This is useful for restore after backup. EXPECT_GEN_GT // Create duplicate record if expected generation is not equal to server generation. // Duplicates are only created when the server configuration option "allow-versions" // is true (default is false). DUPLICATE )
type Host ¶
type Host struct { // Host name or IP address of database server. Name string // Port of database server. Port int // contains filtered or unexported fields }
Host name/port of database server.
type IndexTask ¶ added in v1.0.1
type IndexTask struct { BaseTask // contains filtered or unexported fields }
Task used to poll for long running create index completion.
func NewIndexTask ¶ added in v1.0.1
func (*IndexTask) OnComplete ¶ added in v1.0.1
type IntegerValue ¶
type IntegerValue struct {
// contains filtered or unexported fields
}
Integer value.
func NewIntegerValue ¶
func NewIntegerValue(value int) *IntegerValue
func (*IntegerValue) GetObject ¶
func (vl *IntegerValue) GetObject() interface{}
func (*IntegerValue) GetType ¶
func (vl *IntegerValue) GetType() int
func (*IntegerValue) String ¶
func (vl *IntegerValue) String() string
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Unique record identifier. Records can be identified using a specified namespace, an optional set name, and a user defined key which must be unique within a set. Records can also be identified by namespace/digest which is the combination used on the server.
func NewKey ¶
Initialize key from namespace, optional set name and user key. The set name and user defined key are converted to a digest before sending to the server. The server handles record identifiers by digest only.
type Language ¶ added in v1.0.1
type Language string
User defined function languages.
const ( // Lua embedded programming language. LUA Language = "LUA" )
type LargeList ¶ added in v1.0.1
type LargeList struct {
// contains filtered or unexported fields
}
Create and manage a list within a single bin. /
func NewLargeList ¶ added in v1.0.1
func NewLargeList(client *Client, policy *WritePolicy, key *Key, binName string, userModule string) *LargeList
Initialize large list operator.
client client policy generic configuration parameters, pass in nil for defaults key unique record identifier binName bin name userModule Lua function name that initializes list configuration parameters, pass nil for default list
func (*LargeList) Add ¶ added in v1.0.1
Add values to the list. If the list does not exist, create it using specified userModule configuration.
values values to add
func (*LargeList) Filter ¶ added in v1.0.1
Select values from list and apply specified Lua filter.
filterName Lua function name which applies filter to returned list filterArgs arguments to Lua function name returns list of entries selected
func (*LargeList) Find ¶ added in v1.0.1
Select values from list.
value value to select returns list of entries selected
func (*LargeList) FindThenFilter ¶ added in v1.0.1
func (ll *LargeList) FindThenFilter(value interface{}, filterName string, filterArgs ...interface{}) ([]interface{}, error)
Select values from list and apply specified Lua filter.
value value to select filterName Lua function name which applies filter to returned list filterArgs arguments to Lua function name returns list of entries selected
func (*LargeList) GetCapacity ¶ added in v1.0.1
Return maximum number of entries in the list.
func (*LargeList) SetCapacity ¶ added in v1.0.1
Set maximum number of entries in the list.
capacity max entries in list
type LargeMap ¶ added in v1.0.1
type LargeMap struct {
// contains filtered or unexported fields
}
Create and manage a map within a single bin.
func NewLargeMap ¶ added in v1.0.1
func NewLargeMap(client *Client, policy *WritePolicy, key *Key, binName string, userModule string) *LargeMap
Initialize large map operator.
client client policy generic configuration parameters, pass in nil for defaults key unique record identifier binName bin name userModule Lua function name that initializes list configuration parameters, pass nil for default set
func (*LargeMap) Filter ¶ added in v1.0.1
func (lm *LargeMap) Filter(filterName string, filterArgs ...interface{}) (map[interface{}]interface{}, error)
Select items from map.
filterName Lua function name which applies filter to returned list filterArgs arguments to Lua function name return list of items selected
func (*LargeMap) Get ¶ added in v1.0.1
Get value from map given name key.
name key. return map of items selected
func (*LargeMap) GetCapacity ¶ added in v1.0.1
Return maximum number of entries in the list.
func (*LargeMap) Put ¶ added in v1.0.1
Add entry to map. If the map does not exist, create it using specified userModule configuration.
name entry key value entry value
func (*LargeMap) PutMap ¶ added in v1.0.1
Add map values to map. If the map does not exist, create it using specified userModule configuration.
map map values to push
func (*LargeMap) SetCapacity ¶ added in v1.0.1
Set maximum number of entries in the list.
capacity max entries in list
type LargeObject ¶ added in v1.0.1
type LargeSet ¶ added in v1.0.1
type LargeSet struct {
// contains filtered or unexported fields
}
Create and manage a set within a single bin.
func NewLargeSet ¶ added in v1.0.1
func (*LargeSet) Add ¶ added in v1.0.1
Add values to the set. If the set does not exist, create it using specified userModule configuration.
values values to add
func (*LargeSet) Exists ¶ added in v1.0.1
Check existence of value in the set.
value value to check returns true if found, otherwise false
func (*LargeSet) Filter ¶ added in v1.0.1
Select values from set and apply specified Lua filter.
filterName Lua function name which applies filter to returned list filterArgs arguments to Lua function name returns list of entries selected
func (*LargeSet) Get ¶ added in v1.0.1
Select value from set.
value value to select returns found value
func (*LargeSet) GetCapacity ¶ added in v1.0.1
Return maximum number of entries in the list.
func (*LargeSet) SetCapacity ¶ added in v1.0.1
Set maximum number of entries in the list.
capacity max entries in list
type LargeStack ¶ added in v1.0.1
type LargeStack struct {
// contains filtered or unexported fields
}
Create and manage a stack within a single bin. A stack is last in/first out (LIFO).
func NewLargeStack ¶ added in v1.0.1
func NewLargeStack(client *Client, policy *WritePolicy, key *Key, binName string, userModule string) *LargeStack
Initialize large stack operator.
client client policy generic configuration parameters, pass in nil for defaults key unique record identifier binName bin name userModule Lua function name that initializes list configuration parameters, pass nil for default set
func (*LargeStack) Destroy ¶ added in v1.0.1
func (lstk *LargeStack) Destroy() error
Delete bin containing the list.
func (*LargeStack) Filter ¶ added in v1.0.1
func (lstk *LargeStack) Filter(peekCount int, filterName string, filterArgs ...interface{}) ([]interface{}, error)
Select items from top of stack.
peekCount number of items to select. filterName Lua function name which applies filter to returned list filterArgs arguments to Lua function name returns list of items selected
func (*LargeStack) GetCapacity ¶ added in v1.0.1
func (lstk *LargeStack) GetCapacity() (int, error)
Return maximum number of entries in the list.
func (*LargeStack) GetConfig ¶ added in v1.0.1
func (lstk *LargeStack) GetConfig() (map[interface{}]interface{}, error)
Return map of list configuration parameters.
func (*LargeStack) Peek ¶ added in v1.0.1
func (lstk *LargeStack) Peek(peekCount int) ([]interface{}, error)
Select items from top of stack.
peekCount number of items to select. returns list of items selected
func (*LargeStack) Pop ¶ added in v1.0.1
func (lstk *LargeStack) Pop(count int) ([]interface{}, error)
Select items from top of stack.
peekCount number of items to select. returns list of items selected
func (*LargeStack) Push ¶ added in v1.0.1
func (lstk *LargeStack) Push(values ...interface{}) error
Push values onto stack. If the stack does not exist, create it using specified userModule configuration.
values values to push
func (*LargeStack) Scan ¶ added in v1.0.1
func (lstk *LargeStack) Scan() ([]interface{}, error)
Return all objects in the list.
func (*LargeStack) SetCapacity ¶ added in v1.0.1
func (lstk *LargeStack) SetCapacity(capacity int) error
Set maximum number of entries in the list.
capacity max entries in list
func (*LargeStack) Size ¶ added in v1.0.1
func (lstk *LargeStack) Size() (int, error)
Return size of list.
type ListValue ¶
type ListValue struct {
// contains filtered or unexported fields
}
List value. Supported by Aerospike 3 servers only.
func NewListValue ¶
func NewListValue(list []interface{}) *ListValue
type LongValue ¶
type LongValue struct {
// contains filtered or unexported fields
}
Long value.
func NewLongValue ¶
type MapValue ¶
type MapValue struct {
// contains filtered or unexported fields
}
Map value. Supported by Aerospike 3 servers only.
func NewMapValue ¶
func NewMapValue(vmap map[interface{}]interface{}) *MapValue
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an Aerospike Database Server Node
func (*Node) Close ¶
func (nd *Node) Close()
Marks node as inactice and closes all cached connections
func (*Node) DecreaseHealth ¶
func (nd *Node) DecreaseHealth()
Decrease node Health as a result of bad connection or communication
func (*Node) GetConnection ¶
func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err error)
Get a connection to the node. If no cached connection is not available, a new connection will be created
func (*Node) MigrationInProgress ¶ added in v1.0.1
MigrationInProgress determines if the node is participating in a data migration
func (*Node) PutConnection ¶
func (nd *Node) PutConnection(conn *Connection)
Put back a connection to the cache. If cache is full, the connection will be closed and discarded
type NodeError ¶ added in v1.0.1
type NodeError struct {
// contains filtered or unexported fields
}
type NullValue ¶
type NullValue struct{}
func NewNullValue ¶ added in v1.0.1
func NewNullValue() *NullValue
type Operation ¶
type Operation struct { // Type of operation. OpType OperationType // Optional bin name used in operation. BinName *string // Optional bin value used in operation. BinValue Value }
Database operation definition. The class is used in client's operate() method.
func GetHeaderOp ¶ added in v1.0.1
func GetHeaderOp() *Operation
Create read record header database operation.
func GetOp ¶ added in v1.0.1
func GetOp() *Operation
Create read all record bins database operation.
func GetOpForBin ¶ added in v1.0.1
Create read bin database operation.
type OperationType ¶
type OperationType int
Aerospike operation type
var ( READ OperationType = 1 READ_HEADER OperationType = 1 WRITE OperationType = 2 ADD OperationType = 5 APPEND OperationType = 9 PREPEND OperationType = 10 TOUCH OperationType = 11 )
type Policy ¶
type Policy interface { // Retrives BasePolicy GetBasePolicy() *BasePolicy }
Policy Interface
type QueryPolicy ¶
type QueryPolicy struct { BasePolicy // Maximum number of concurrent requests to server nodes at any poin int time. // If there are 16 nodes in the cluster and maxConcurrentNodes is 8, then queries // will be made to 8 nodes in parallel. When a query completes, a new query will // be issued until all 16 nodes have been queried. // Default (0) is to issue requests to all server nodes in parallel. MaxConcurrentNodes int // Number of records to place in queue before blocking. // Records received from multiple server nodes will be placed in a queue. // A separate goroutine consumes these records in parallel. // If the queue is full, the producer goroutines will block until records are consumed. RecordQueueSize int //= 5000 }
Container object for policy attributes used in query operations.
func NewQueryPolicy ¶ added in v1.0.1
func NewQueryPolicy() *QueryPolicy
type Record ¶
type Record struct { // Record's Key. Might be empty, or only consist of digest only. Key *Key // Node from which the Record is originating from. Node *Node // Map of requested name/value bins. Bins BinMap // List of all duplicate records (if any) for a given key. Duplicates are only created when // the server configuration option "allow-versions" is true (default is false) and client // RecordExistsAction.DUPLICATE policy flag is set and there is a generation error. // Almost always nil. Duplicates []BinMap // Record modification count. Generation int // Date record will expire, in seconds from Jan 01 2010 00:00:00 GMT Expiration int }
Container object for records. Records are equivalent to rows.
type RecordExistsAction ¶
type RecordExistsAction int
How to handle writes when the record already exists.
const ( // Create or update record. // Merge write command bins with existing bins. UPDATE RecordExistsAction = iota // Update record only. Fail if record does not exist. // Merge write command bins with existing bins. UPDATE_ONLY // Create or replace record. // Delete existing bins not referenced by write command bins. // Supported by Aerospike 2 server versions >= 2.7.5 and // Aerospike 3 server versions >= 3.1.6. REPLACE // Replace record only. Fail if record does not exist. // Delete existing bins not referenced by write command bins. // Supported by Aerospike 2 server versions >= 2.7.5 and // Aerospike 3 server versions >= 3.1.6. REPLACE_ONLY // Create only. Fail if record exists. CREATE_ONLY )
type Recordset ¶ added in v1.0.1
type Recordset struct { Records chan *Record Errors chan error // contains filtered or unexported fields }
func NewRecordset ¶ added in v1.0.1
type RegisterTask ¶ added in v1.0.1
type RegisterTask struct { BaseTask // contains filtered or unexported fields }
Task used to poll for UDF registration completion.
func NewRegisterTask ¶ added in v1.0.1
func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask
Initialize task with fields needed to query server nodes.
func (*RegisterTask) IsDone ¶ added in v1.0.1
func (tskr *RegisterTask) IsDone() (bool, error)
Query all nodes for task completion status.
func (*RegisterTask) OnComplete ¶ added in v1.0.1
func (tskr *RegisterTask) OnComplete() chan error
type RemoveTask ¶ added in v1.0.1
type RemoveTask struct { BaseTask // contains filtered or unexported fields }
Task used to poll for UDF registration completion.
func NewRemoveTask ¶ added in v1.0.1
func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask
Initialize task with fields needed to query server nodes.
func (*RemoveTask) IsDone ¶ added in v1.0.1
func (tskr *RemoveTask) IsDone() (bool, error)
Query all nodes for task completion status.
func (*RemoveTask) OnComplete ¶ added in v1.0.1
func (tskr *RemoveTask) OnComplete() chan error
type ScanPolicy ¶
type ScanPolicy struct { BasePolicy // Percent of data to scan. Valid integer range is 1 to 100. // Default is 100. ScanPercent int //= 100; // Maximum number of concurrent requests to server nodes at any poin int time. // If there are 16 nodes in the cluster and maxConcurrentNodes is 8, then scan requests // will be made to 8 nodes in parallel. When a scan completes, a new scan request will // be issued until all 16 nodes have been scanned. // // This field is only relevant when concurrentNodes is true. // Default (0) is to issue requests to all server nodes in parallel. MaxConcurrentNodes int // Issue scan requests in parallel or serially. ConcurrentNodes bool //= true; // Indicates if bin data is retrieved. If false, only record digests are retrieved. IncludeBinData bool //= true; // Terminate scan if cluster in fluctuating state. FailOnClusterChange bool // Number of records to place in queue before blocking. // Records received from multiple server nodes will be placed in a queue. // A separate goroutine consumes these records in parallel. // If the queue is full, the producer goroutines will block until records are consumed. RecordQueueSize int //= 5000 }
Container object for optional parameters used in scan operations.
func NewScanPolicy ¶ added in v1.0.1
func NewScanPolicy() *ScanPolicy
type Statement ¶ added in v1.0.1
type Statement struct { // Query Namespace Namespace string // Query Set name (optional) SetName string // Optional query index name. If not set, the server // will determine the index from the filter's bin name. IndexName string // bin names (optional) BinNames []string // Optional query filters. // Currently, only one filter is allowed by the server on a secondary index lookup. // If multiple filters are necessary, see QueryFilter example for a workaround. // QueryFilter demonstrates how to add additional filters in an user-defined // aggregation function. Filters []*Filter // Set optional query task id. TaskId int // contains filtered or unexported fields }
Query statement parameters.
func NewStatement ¶ added in v1.0.1
func (*Statement) SetAggregateFunction ¶ added in v1.0.1
func (stmt *Statement) SetAggregateFunction(packageName string, functionName string, functionArgs []Value, returnData bool)
Set aggregation function parameters. This function will be called on both the server and client for each selected item.
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
value string.
func NewStringValue ¶
func NewStringValue(value string) *StringValue
func (*StringValue) GetObject ¶
func (vl *StringValue) GetObject() interface{}
func (*StringValue) GetType ¶
func (vl *StringValue) GetType() int
func (*StringValue) String ¶
func (vl *StringValue) String() string
type Value ¶
type Value interface { // Get wire protocol value type. GetType() int // Return original value as an Object. GetObject() interface{} // Implement Stringer interface String() string // contains filtered or unexported methods }
Polymorphic value classes used to efficiently serialize objects into the wire protocol.
type ValueArray ¶
type ValueArray struct {
// contains filtered or unexported fields
}
Value array. Supported by Aerospike 3 servers only.
func NewValueArray ¶
func NewValueArray(array []Value) *ValueArray
func ToValueArray ¶ added in v1.0.1
func ToValueArray(array []interface{}) *ValueArray
func (*ValueArray) GetObject ¶
func (vl *ValueArray) GetObject() interface{}
func (*ValueArray) GetType ¶
func (vl *ValueArray) GetType() int
func (*ValueArray) String ¶
func (vl *ValueArray) String() string
type WritePolicy ¶
type WritePolicy struct { BasePolicy // Qualify how to handle writes where the record already exists. RecordExistsAction RecordExistsAction //= RecordExistsAction.UPDATE; // Qualify how to handle record writes based on record generation. The default (NONE) // indicates that the generation is not used to restrict writes. GenerationPolicy GenerationPolicy //= GenerationPolicy.NONE; // Expected generation. Generation is the number of times a record has been modified // (including creation) on the server. If a write operation is creating a record, // the expected generation would be 0 Generation int // Record expiration. Also known as ttl (time to live). // Seconds record will live before being removed by the server. // Expiration values: // -1: Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3 server // versions >= 3.1.4. Do not use -1 for older servers. // 0: Default to namespace configuration variable "default-ttl" on the server. // > 0: Actual expiration in seconds. Expiration int // Send user defined key in addition to hash digest on a record put. // The default is to not send the user defined key. SendKey bool }
Container object for policy attributes used in write operations. This object is passed into methods where database writes can occur.
func NewWritePolicy ¶
func NewWritePolicy(generation, expiration int) *WritePolicy
Source Files ¶
- aerospike.go
- batch_command.go
- batch_command_exists.go
- batch_command_get.go
- batch_item.go
- batch_node.go
- bin.go
- client.go
- client_policy.go
- cluster.go
- command.go
- connection.go
- delete_command.go
- execute_command.go
- execute_task.go
- exists_command.go
- field_type.go
- filter.go
- generation_policy.go
- host.go
- index_type.go
- info.go
- key.go
- language.go
- large_list.go
- large_map.go
- large_object.go
- large_set.go
- large_stack.go
- node.go
- node_error.go
- node_validator.go
- operate_command.go
- operation.go
- packer.go
- partition.go
- partition_tokenizer.go
- partition_tokenizer_new.go
- partition_tokenizer_old.go
- policy.go
- priority.go
- query_command.go
- query_policy.go
- query_record_command.go
- read_command.go
- read_header_command.go
- record.go
- record_exists_action.go
- recordset.go
- scan_command.go
- scan_policy.go
- server_command.go
- single_command.go
- statement.go
- task.go
- task_index.go
- task_register.go
- task_remove.go
- touch_command.go
- udf.go
- unpacker.go
- value.go
- write_command.go
- write_policy.go