Documentation ¶
Index ¶
- Constants
- func BytesToParticle(ptype int, buf []byte, offset int, length int) (interface{}, error)
- func ComputeDigest(setName string, key Value) ([]byte, error)
- func PackAnyArray(val []interface{}) ([]byte, error)
- func PackAnyMap(val map[interface{}]interface{}) ([]byte, error)
- func PackValueArray(val []Value) ([]byte, error)
- func RequestInfo(conn *Connection, names ...string) (map[string]string, error)
- func RequestInfoForHostName(hostname string, port int, names ...string) map[string]string
- func RequestInfoForNode(node Node, name ...string) (string, error)
- type AerospikeBlob
- type BaseCommand
- func (this *BaseCommand) SetDelete(policy *WritePolicy, key *Key)
- func (this *BaseCommand) SetExists(key *Key)
- func (this *BaseCommand) SetOperate(policy *WritePolicy, key *Key, operations []*Operation) error
- func (this *BaseCommand) SetRead(key *Key, binNames []string)
- func (this *BaseCommand) SetReadForKeyOnly(key *Key)
- func (this *BaseCommand) SetReadHeader(key *Key)
- func (this *BaseCommand) SetScan(policy *ScanPolicy, namespace *string, setName *string, binNames []string)
- func (this *BaseCommand) SetTouch(policy *WritePolicy, key *Key)
- func (this *BaseCommand) SetWrite(policy *WritePolicy, operation OperationType, key *Key, bins []*Bin) error
- func (this *BaseCommand) WriteFieldBytes(bytes []byte, ftype FieldType)
- func (this *BaseCommand) WriteFieldHeader(size int, ftype FieldType)
- func (this *BaseCommand) WriteFieldString(str string, ftype FieldType)
- type BasePolicy
- type Bin
- type BinMap
- type BytesValue
- type Client
- func (this *Client) Add(policy *WritePolicy, key *Key, bins BinMap) error
- func (this *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (this *Client) Append(policy *WritePolicy, key *Key, bins BinMap) error
- func (this *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (this *Client) Close()
- func (this *Client) Delete(policy *WritePolicy, key *Key) (bool, error)
- func (this *Client) Exists(policy *BasePolicy, key *Key) (bool, error)
- func (this *Client) Get(policy *BasePolicy, key *Key, binNames ...string) (*Record, error)
- func (this *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, error)
- func (this *Client) GetNodeNames() []string
- func (this *Client) GetNodes() []*Node
- func (this *Client) IsConnected() bool
- func (this *Client) Prepend(policy *WritePolicy, key *Key, bins BinMap) error
- func (this *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (this *Client) Put(policy *WritePolicy, key *Key, bins BinMap) error
- func (this *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (this *Client) Touch(policy *WritePolicy, key *Key) error
- type ClientPolicy
- type Cluster
- func (this *Cluster) AddSeeds(hosts []*Host)
- func (this *Cluster) Close()
- func (this *Cluster) FindNodeName(list []*Node, name string) bool
- func (this *Cluster) GetNode(partition *Partition) (*Node, error)
- func (this *Cluster) GetNodeByName(nodeName string) (*Node, error)
- func (this *Cluster) GetNodes() []*Node
- func (this *Cluster) GetRandomNode() (*Node, error)
- func (this *Cluster) IsConnected() bool
- type Command
- type Connection
- type DeleteCommand
- type ExistsCommand
- type FieldType
- type GenerationPolicy
- type Host
- type Info
- type IntegerValue
- func (this *IntegerValue) EstimateSize() int
- func (this *IntegerValue) GetObject() interface{}
- func (this *IntegerValue) GetType() int
- func (this *IntegerValue) Pack(packer *Packer) error
- func (this *IntegerValue) String() string
- func (this *IntegerValue) Write(buffer []byte, offset int) (int, error)
- type Key
- type ListValue
- type LongValue
- type MapValue
- type Node
- func (this *Node) AddAlias(aliasToAdd *Host)
- func (this *Node) Close()
- func (this *Node) DecreaseHealth()
- func (this *Node) Equals(other *Node) bool
- func (this *Node) GetAliases() []*Host
- func (this *Node) GetConnection(timeout time.Duration) (*Connection, error)
- func (this *Node) GetHost() *Host
- func (this *Node) GetName() string
- func (this *Node) IsActive() bool
- func (this *Node) IsUnhealthy() bool
- func (this *Node) PutConnection(conn *Connection)
- func (this *Node) Refresh(friends []*Host) error
- func (this *Node) RestoreHealth()
- func (this *Node) String() string
- type NodeValidator
- type NullValue
- type Operation
- type OperationType
- type Packer
- func (this *Packer) PackAByte(val byte)
- func (this *Packer) PackAInt(val int)
- func (this *Packer) PackALong(val int64)
- func (this *Packer) PackArrayBegin(size int)
- func (this *Packer) PackByte(valType int, val byte)
- func (this *Packer) PackByteArray(src []byte, srcOffset int, srcLength int)
- func (this *Packer) PackByteArrayBegin(length int)
- func (this *Packer) PackBytes(b []byte)
- func (this *Packer) PackInt(valType int, val int32)
- func (this *Packer) PackList(list []interface{}) error
- func (this *Packer) PackLong(valType int, val int64)
- func (this *Packer) PackMap(theMap map[interface{}]interface{}) error
- func (this *Packer) PackMapBegin(size int)
- func (this *Packer) PackNil()
- func (this *Packer) PackObject(obj interface{}) error
- func (this *Packer) PackShort(valType int, val int16)
- func (this *Packer) PackString(val string)
- func (this *Packer) PackValueArray(values []Value) error
- type Partition
- type PartitionTokenizer
- type PartitionTokenizerNew
- type PartitionTokenizerOld
- type Policy
- type Priority
- type QueryPolicy
- type ReadCommand
- type ReadHeaderCommand
- type Record
- type RecordExistsAction
- type ScanPolicy
- type SingleCommand
- type StringValue
- type TouchCommand
- type Unpacker
- type Value
- type ValueArray
- type WriteCommand
- type WritePolicy
Constants ¶
const ( // Flags commented out are not supported by this client. // Contains a read operation. INFO1_READ int = (1 << 0) // Get all bins. INFO1_GET_ALL int = (1 << 1) // Do not read the bins INFO1_NOBINDATA int = (1 << 5) // Create or update record INFO2_WRITE int = (1 << 0) // Fling a record into the belly of Moloch. INFO2_DELETE int = (1 << 1) // Update if expected generation == old. INFO2_GENERATION int = (1 << 2) // Update if new generation >= old, good for restore. INFO2_GENERATION_GT int = (1 << 3) // Create a duplicate on a generation collision. INFO2_GENERATION_DUP int = (1 << 4) // Create only. Fail if record already exists. INFO2_CREATE_ONLY int = (1 << 5) // This is the last of a multi-part message. INFO3_LAST int = (1 << 0) // Update only. Merge bins. INFO3_UPDATE_ONLY int = (1 << 3) // Create or completely replace record. INFO3_CREATE_OR_REPLACE int = (1 << 4) // Completely replace existing record only. INFO3_REPLACE_ONLY int = (1 << 5) MSG_TOTAL_HEADER_SIZE uint8 = 30 FIELD_HEADER_SIZE uint8 = 5 OPERATION_HEADER_SIZE uint8 = 8 MSG_REMAINING_HEADER_SIZE uint8 = 22 DIGEST_SIZE uint8 = 20 CL_MSG_VERSION int64 = 2 AS_MSG_TYPE int64 = 3 )
Variables ¶
This section is empty.
Functions ¶
func BytesToParticle ¶
func ComputeDigest ¶
Generate unique server hash value from set name, key type and user defined key. The hash function is RIPEMD-160 (a 160 bit hash).
func PackAnyArray ¶
func PackAnyMap ¶
func PackValueArray ¶
func RequestInfo ¶
func RequestInfo(conn *Connection, names ...string) (map[string]string, error)
Get info values by name from the specified connection
func RequestInfoForHostName ¶
Get many info values by name from the specified database server node, using host name and port.
Types ¶
type AerospikeBlob ¶
type BaseCommand ¶
type BaseCommand struct {
// contains filtered or unexported fields
}
Holds data buffer for the command
func (*BaseCommand) SetDelete ¶
func (this *BaseCommand) SetDelete(policy *WritePolicy, key *Key)
Writes the command for delete operations
func (*BaseCommand) SetExists ¶
func (this *BaseCommand) SetExists(key *Key)
Writes the command for exist operations
func (*BaseCommand) SetOperate ¶
func (this *BaseCommand) SetOperate(policy *WritePolicy, key *Key, operations []*Operation) error
Implements different command operations
func (*BaseCommand) SetRead ¶
func (this *BaseCommand) SetRead(key *Key, binNames []string)
Writes the command for get operations (specified bins)
func (*BaseCommand) SetReadForKeyOnly ¶
func (this *BaseCommand) SetReadForKeyOnly(key *Key)
Writes the command for get operations (all bins)
func (*BaseCommand) SetReadHeader ¶
func (this *BaseCommand) SetReadHeader(key *Key)
Writes the command for getting metadata operations
func (*BaseCommand) SetScan ¶
func (this *BaseCommand) SetScan(policy *ScanPolicy, namespace *string, setName *string, binNames []string)
func (*BaseCommand) SetTouch ¶
func (this *BaseCommand) SetTouch(policy *WritePolicy, key *Key)
Writes the command for touch operations
func (*BaseCommand) SetWrite ¶
func (this *BaseCommand) SetWrite(policy *WritePolicy, operation OperationType, key *Key, bins []*Bin) error
Writes the command for write operations
func (*BaseCommand) WriteFieldBytes ¶
func (this *BaseCommand) WriteFieldBytes(bytes []byte, ftype FieldType)
func (*BaseCommand) WriteFieldHeader ¶
func (this *BaseCommand) WriteFieldHeader(size int, ftype FieldType)
func (*BaseCommand) WriteFieldString ¶
func (this *BaseCommand) WriteFieldString(str string, ftype FieldType)
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 //= 500; }
Container object for transaction policy attributes used in all database operation calls.
func NewPolicy ¶
func NewPolicy() *BasePolicy
func (*BasePolicy) GetBasePolicy ¶
func (this *BasePolicy) GetBasePolicy() *BasePolicy
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) EstimateSize ¶
func (this *BytesValue) EstimateSize() int
func (*BytesValue) GetObject ¶
func (this *BytesValue) GetObject() interface{}
func (*BytesValue) GetType ¶
func (this *BytesValue) GetType() int
func (*BytesValue) Pack ¶
func (this *BytesValue) Pack(packer *Packer) error
func (*BytesValue) String ¶
func (this *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 (this *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 (this *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) Append ¶
func (this *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 (this *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) Close ¶
func (this *Client) Close()
Close all client connections to database server nodes.
func (*Client) Delete ¶
func (this *Client) Delete(policy *WritePolicy, key *Key) (bool, error)
Delete record for specified key. The policy specifies the transaction timeout.
func (*Client) Exists ¶
func (this *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 (this *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) 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) Prepend ¶
func (this *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 (this *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
func (*Client) Put ¶
func (this *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.
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 //= 1000 milliseconds // Size of the Connection Queue cache. ConnectionQueueSize int //= 64 // 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 (this *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 ¶
type Command ¶
type Command interface { // Executes the command Execute() error // contains filtered or unexported methods }
Command intrerface describes all commands available
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 (this *Connection) IsConnected() bool
Returns true if the connection is not closed
func (*Connection) Read ¶
func (this *Connection) Read(buf []byte, length int) (int, error)
Reads from connection buffer to the slice
func (*Connection) SetTimeout ¶
func (this *Connection) SetTimeout(timeout time.Duration)
sets connection timeout
type DeleteCommand ¶
type DeleteCommand struct { SingleCommand // contains filtered or unexported fields }
func NewDeleteCommand ¶
func NewDeleteCommand(cluster *Cluster, policy *WritePolicy, key *Key) *DeleteCommand
func (*DeleteCommand) Execute ¶
func (this *DeleteCommand) Execute() error
func (*DeleteCommand) Existed ¶
func (this *DeleteCommand) Existed() bool
type ExistsCommand ¶
type ExistsCommand struct { SingleCommand // contains filtered or unexported fields }
func NewExistsCommand ¶
func NewExistsCommand(cluster *Cluster, policy Policy, key *Key) *ExistsCommand
func (*ExistsCommand) Execute ¶
func (this *ExistsCommand) Execute() error
func (*ExistsCommand) Exists ¶
func (this *ExistsCommand) Exists() bool
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 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 }
Host name/port of database server.
type Info ¶
type Info struct {
// contains filtered or unexported fields
}
Access server's info monitoring protocol.
type IntegerValue ¶
type IntegerValue struct {
// contains filtered or unexported fields
}
Integer value.
func NewIntegerValue ¶
func NewIntegerValue(value int) *IntegerValue
func (*IntegerValue) EstimateSize ¶
func (this *IntegerValue) EstimateSize() int
func (*IntegerValue) GetObject ¶
func (this *IntegerValue) GetObject() interface{}
func (*IntegerValue) GetType ¶
func (this *IntegerValue) GetType() int
func (*IntegerValue) Pack ¶
func (this *IntegerValue) Pack(packer *Packer) error
func (*IntegerValue) String ¶
func (this *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.
func NewKeyByDigest ¶
Initialize key from namespace, digest and optional set name.
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
func (*ListValue) EstimateSize ¶
type LongValue ¶
type LongValue struct {
// contains filtered or unexported fields
}
Long value.
func NewLongValue ¶
func (*LongValue) EstimateSize ¶
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
func (*MapValue) EstimateSize ¶
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an Aerospike Database Server Node
func NewNode ¶
func NewNode(cluster *Cluster, nv *NodeValidator) *Node
Initialize server node with connection parameters.
func (*Node) Close ¶
func (this *Node) Close()
Marks node as inactice and closes all cached connections
func (*Node) DecreaseHealth ¶
func (this *Node) DecreaseHealth()
Decrease node Health as a result of bad connection or communication
func (*Node) GetConnection ¶
func (this *Node) GetConnection(timeout time.Duration) (*Connection, error)
Get a connection to the node. If no cached connection is not available, a new connection will be created
func (*Node) PutConnection ¶
func (this *Node) PutConnection(conn *Connection)
Put back a connection to the cache. If cache is full, the connection will be closed and discarded
type NodeValidator ¶
type NodeValidator struct {
// contains filtered or unexported fields
}
Validates a Database server node
func NewNodeValidator ¶
func NewNodeValidator(host *Host, timeout time.Duration) (*NodeValidator, error)
Generates a node validator
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 NewGetHeaderOp ¶
func NewGetHeaderOp() *Operation
Create read record header database operation.
func NewGetOpByBinName ¶
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 Packer ¶
type Packer struct {
// contains filtered or unexported fields
}
func (*Packer) PackArrayBegin ¶
func (*Packer) PackByteArray ¶
func (*Packer) PackByteArrayBegin ¶
func (*Packer) PackMapBegin ¶
func (*Packer) PackObject ¶
func (*Packer) PackString ¶
func (*Packer) PackValueArray ¶
type PartitionTokenizer ¶
type PartitionTokenizerNew ¶
type PartitionTokenizerNew struct { PartitionTokenizer // contains filtered or unexported fields }
func NewPartitionTokenizerNew ¶
func NewPartitionTokenizerNew(conn *Connection) (*PartitionTokenizerNew, error)
func (*PartitionTokenizerNew) UpdatePartition ¶
func (this *PartitionTokenizerNew) UpdatePartition(nmap map[string]atomicNodeArray, node *Node) map[string]atomicNodeArray
type PartitionTokenizerOld ¶
type PartitionTokenizerOld struct {
// contains filtered or unexported fields
}
func NewPartitionTokenizerOld ¶
func NewPartitionTokenizerOld(conn *Connection) (*PartitionTokenizerOld, error)
func (*PartitionTokenizerOld) UpdatePartition ¶
func (this *PartitionTokenizerOld) UpdatePartition(hmap map[string]atomicNodeArray, node *Node) map[string]atomicNodeArray
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 thread consumes these records in parallel. // If the queue is full, the producer threads will block until records are consumed. RecordQueueSize int //= 5000 }
Container object for policy attributes used in query operations.
type ReadCommand ¶
type ReadCommand struct { SingleCommand // contains filtered or unexported fields }
func NewReadCommand ¶
func NewReadCommand(cluster *Cluster, policy Policy, key *Key, binNames []string) *ReadCommand
func (*ReadCommand) Execute ¶
func (this *ReadCommand) Execute() error
func (*ReadCommand) GetRecord ¶
func (this *ReadCommand) GetRecord() *Record
type ReadHeaderCommand ¶
type ReadHeaderCommand struct { SingleCommand // contains filtered or unexported fields }
func NewReadHeaderCommand ¶
func NewReadHeaderCommand(cluster *Cluster, policy Policy, key *Key) *ReadHeaderCommand
func (*ReadHeaderCommand) Execute ¶
func (this *ReadHeaderCommand) Execute() error
func (*ReadHeaderCommand) GetRecord ¶
func (this *ReadHeaderCommand) GetRecord() *Record
type Record ¶
type Record struct { // 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 null. 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 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. // <p> // 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 }
Container object for optional parameters used in scan operations.
type SingleCommand ¶
type SingleCommand struct { BaseCommand // contains filtered or unexported fields }
func NewSingleCommand ¶
func NewSingleCommand(cluster *Cluster, key *Key) *SingleCommand
type StringValue ¶
type StringValue struct {
// contains filtered or unexported fields
}
value string.
func NewStringValue ¶
func NewStringValue(value string) *StringValue
func (*StringValue) EstimateSize ¶
func (this *StringValue) EstimateSize() int
func (*StringValue) GetObject ¶
func (this *StringValue) GetObject() interface{}
func (*StringValue) GetType ¶
func (this *StringValue) GetType() int
func (*StringValue) Pack ¶
func (this *StringValue) Pack(packer *Packer) error
func (*StringValue) String ¶
func (this *StringValue) String() string
type TouchCommand ¶
type TouchCommand struct { SingleCommand // contains filtered or unexported fields }
func NewTouchCommand ¶
func NewTouchCommand(cluster *Cluster, policy *WritePolicy, key *Key) *TouchCommand
func (*TouchCommand) Execute ¶
func (this *TouchCommand) Execute() error
type Unpacker ¶
type Unpacker struct {
// contains filtered or unexported fields
}
func (*Unpacker) UnpackList ¶
type Value ¶
type Value interface { // Calculate number of this.bytes necessary to serialize the value in the wire protocol. EstimateSize() int // Serialize the value in the wire protocol. Write(buffer []byte, offset int) (int, error) // Serialize the value using MessagePack. Pack(packer *Packer) error // Get wire protocol value type. GetType() int // Return original value as an Object. GetObject() interface{} // Implement Stringer interface String() string }
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 (*ValueArray) EstimateSize ¶
func (this *ValueArray) EstimateSize() int
func (*ValueArray) GetObject ¶
func (this *ValueArray) GetObject() interface{}
func (*ValueArray) GetType ¶
func (this *ValueArray) GetType() int
func (*ValueArray) Pack ¶
func (this *ValueArray) Pack(packer *Packer) error
func (*ValueArray) String ¶
func (this *ValueArray) String() string
type WriteCommand ¶
type WriteCommand struct { SingleCommand // contains filtered or unexported fields }
func NewWriteCommand ¶
func NewWriteCommand(cluster *Cluster, policy *WritePolicy, key *Key, bins []*Bin, operation OperationType) *WriteCommand
func (*WriteCommand) Execute ¶
func (this *WriteCommand) Execute() error
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 }
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
- bin.go
- client.go
- client_policy.go
- cluster.go
- command.go
- connection.go
- delete_command.go
- exists_command.go
- field_type.go
- generation_policy.go
- host.go
- info.go
- key.go
- node.go
- node_validator.go
- operation.go
- packer.go
- partition.go
- partition_tokenizer.go
- partition_tokenizer_new.go
- partition_tokenizer_old.go
- policy.go
- priority.go
- query_policy.go
- read_command.go
- read_header_command.go
- record.go
- record_exists_action.go
- scan_policy.go
- single_command.go
- touch_command.go
- unpacker.go
- value.go
- write_command.go
- write_policy.go