Documentation ¶
Index ¶
- Constants
- Variables
- 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 SetAerospikeTag(tag string)
- func SetCommandBufferPool(poolSize, initBufSize, maxBufferSize int)
- func SetLuaPath(lpath string)
- type AdminCommand
- type AdminPolicy
- type AerospikeBlob
- type BasePolicy
- type BaseTask
- type Bin
- type BinMap
- type BytesValue
- type Client
- func (clnt *Client) Add(policy *WritePolicy, key *Key, binMap BinMap) error
- func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) Append(policy *WritePolicy, key *Key, binMap 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) ChangePassword(policy *AdminPolicy, user string, password string) error
- func (clnt *Client) Close()
- func (clnt *Client) CreateComplexIndex(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, error)
- func (clnt *Client) CreateIndex(policy *WritePolicy, namespace string, setName string, indexName string, ...) (*IndexTask, error)
- func (clnt *Client) CreateUser(policy *AdminPolicy, user string, password string, roles []string) 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) DropUser(policy *AdminPolicy, user 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) GetObject(policy *BasePolicy, key *Key, obj interface{}) error
- func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) error
- 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, binMap BinMap) error
- func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) Put(policy *WritePolicy, key *Key, binMap BinMap) error
- func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) error
- func (clnt *Client) PutObject(policy *WritePolicy, key *Key, obj interface{}) (err error)
- func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, error)
- func (clnt *Client) QueryAggregate(policy *QueryPolicy, statement *Statement, packageName, functionName string, ...) (*Recordset, error)
- func (clnt *Client) QueryNode(policy *QueryPolicy, node *Node, statement *Statement) (*Recordset, error)
- func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan interface{}) (*Recordset, error)
- func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan interface{}) (*Recordset, error)
- func (clnt *Client) QueryUser(policy *AdminPolicy, user string) (*UserRoles, error)
- func (clnt *Client) QueryUsers(policy *AdminPolicy) ([]*UserRoles, 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) RevokeRoles(policy *AdminPolicy, user string, roles []string) error
- func (clnt *Client) ScanAll(apolicy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, error)
- func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan interface{}, namespace string, setName string, ...) (*Recordset, error)
- func (clnt *Client) ScanNode(apolicy *ScanPolicy, node *Node, namespace string, setName string, ...) (*Recordset, error)
- func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan interface{}, namespace string, ...) (*Recordset, error)
- func (clnt *Client) String() string
- func (clnt *Client) Touch(policy *WritePolicy, key *Key) error
- type ClientPolicy
- type Cluster
- func (clstr *Cluster) AddSeeds(hosts []*Host)
- func (clstr *Cluster) ClientPolicy() (res ClientPolicy)
- func (clstr *Cluster) Close()
- 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) Password() (res []byte)
- func (clstr *Cluster) String() string
- func (clstr *Cluster) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)
- type CommitLevel
- type Connection
- func (ctn *Connection) Authenticate(user string, password []byte) error
- func (ctn *Connection) Close()
- func (ctn *Connection) IsConnected() bool
- func (ctn *Connection) Read(buf []byte, length int) (total int, err error)
- func (ctn *Connection) ReadN(buf io.Writer, length int64) (total int64, err error)
- func (ctn *Connection) SetTimeout(timeout time.Duration) error
- func (ctn *Connection) Write(buf []byte) (total int, err error)
- type ConsistencyLevel
- type DropIndexTask
- type ExecuteTask
- type FieldType
- type Filter
- func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value interface{}) *Filter
- func NewContainsRangeFilter(binName string, indexCollectionType IndexCollectionType, begin, end int64) *Filter
- func NewEqualFilter(binName string, value interface{}) *Filter
- func NewGeoRegionsContainingPointFilter(binName, point string) *Filter
- func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string) *Filter
- func NewGeoWithinRadiusFilter(binName string, lng, lat, radius float64) *Filter
- func NewGeoWithinRadiusForCollectionFilter(binName string, collectionType IndexCollectionType, lng, lat, radius float64) *Filter
- func NewGeoWithinRegionFilter(binName, region string) *Filter
- func NewGeoWithinRegionForCollectionFilter(binName string, collectionType IndexCollectionType, region string) *Filter
- func NewRangeFilter(binName string, begin int64, end int64) *Filter
- type FloatValue
- type GenerationPolicy
- type GeoJSONValue
- type Host
- type IndexCollectionType
- type IndexTask
- type IndexType
- type IntegerValue
- type JsonValue
- type Key
- type Language
- type LargeList
- func (ll *LargeList) Add(values ...interface{}) (err error)
- func (ll *LargeList) Destroy() error
- func (ll *LargeList) Exist(values ...interface{}) ([]bool, error)
- func (ll *LargeList) FFilterThenindFirst(count int, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) Filter(filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) FilterThenFindFrom(begin interface{}, count int, filterModule, filterName string, ...) ([]interface{}, error)
- func (ll *LargeList) FilterThenFindLast(count int, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) Find(value interface{}) ([]interface{}, error)
- func (ll *LargeList) FindFirst(count int) ([]interface{}, error)
- func (ll *LargeList) FindFrom(begin interface{}, count int) ([]interface{}, error)
- func (ll *LargeList) FindLast(count int) ([]interface{}, error)
- func (ll *LargeList) FindThenFilter(value interface{}, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
- func (ll *LargeList) GetConfig() (map[interface{}]interface{}, error)
- func (ll *LargeList) Range(begin, end interface{}) ([]interface{}, error)
- func (ll *LargeList) RangeN(begin, end interface{}, count int) ([]interface{}, error)
- func (ll *LargeList) RangeNThenFilter(begin, end interface{}, count int, filterModule string, filterName string, ...) ([]interface{}, error)
- func (ll *LargeList) RangeThenFilter(begin, end interface{}, filterModule string, filterName string, ...) ([]interface{}, error)
- func (ll *LargeList) Remove(values ...interface{}) (err error)
- func (ll *LargeList) Scan() ([]interface{}, error)
- func (ll *LargeList) SetPageSize(pageSize int) error
- func (ll *LargeList) Size() (int, error)
- func (ll *LargeList) Update(values ...interface{}) (err error)
- type LargeMap
- func (lm *LargeMap) Destroy() error
- func (lm *LargeMap) Exists(keyValue interface{}) (bool, 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) 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) Remove(name interface{}) error
- func (lm *LargeMap) Scan() (map[interface{}]interface{}, 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) GetConfig() (map[interface{}]interface{}, error)
- func (ls *LargeSet) Remove(value interface{}) error
- func (ls *LargeSet) Scan() ([]interface{}, 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) 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) Size() (int, error)
- type ListIter
- type ListValue
- type ListerValue
- type LongValue
- type MapIter
- type MapPair
- type MapPolicy
- type MapValue
- type MapperValue
- type MultiPolicy
- type Node
- func (nd *Node) Close()
- 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) InvalidateConnection(conn *Connection)
- func (nd *Node) IsActive() bool
- func (nd *Node) MigrationInProgress() (bool, error)
- func (nd *Node) PutConnection(conn *Connection)
- func (nd *Node) Refresh(peers *peers) error
- func (nd *Node) RequestInfo(name ...string) (map[string]string, error)
- func (nd *Node) String() string
- func (nd *Node) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)
- type NodeError
- type NullValue
- type Operation
- func AddOp(bin *Bin) *Operation
- func AppendOp(bin *Bin) *Operation
- func GetHeaderOp() *Operation
- func GetOp() *Operation
- func GetOpForBin(binName string) *Operation
- func ListAppendOp(binName string, values ...interface{}) *Operation
- func ListClearOp(binName string) *Operation
- func ListGetOp(binName string, index int) *Operation
- func ListGetRangeFromOp(binName string, index int) *Operation
- func ListGetRangeOp(binName string, index int, count int) *Operation
- func ListInsertOp(binName string, index int, values ...interface{}) *Operation
- func ListPopOp(binName string, index int) *Operation
- func ListPopRangeFromOp(binName string, index int) *Operation
- func ListPopRangeOp(binName string, index int, count int) *Operation
- func ListRemoveOp(binName string, index int) *Operation
- func ListRemoveRangeFromOp(binName string, index int) *Operation
- func ListRemoveRangeOp(binName string, index int, count int) *Operation
- func ListSetOp(binName string, index int, value interface{}) *Operation
- func ListSizeOp(binName string) *Operation
- func ListTrimOp(binName string, index int, count int) *Operation
- func MapClearOp(binName string) *Operation
- func MapDecrementOp(policy *MapPolicy, binName string, key interface{}, decr interface{}) *Operation
- func MapGetByIndexOp(binName string, index int, returnType mapReturnType) *Operation
- func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation
- func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation
- func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation
- func MapGetByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, ...) *Operation
- func MapGetByRankOp(binName string, rank int, returnType mapReturnType) *Operation
- func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation
- func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation
- func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation
- func MapGetByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, ...) *Operation
- func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}) *Operation
- func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}) *Operation
- func MapPutOp(policy *MapPolicy, binName string, key interface{}, value interface{}) *Operation
- func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType) *Operation
- func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation
- func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation
- func MapRemoveByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation
- func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation
- func MapRemoveByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, ...) *Operation
- func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType) *Operation
- func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation
- func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation
- func MapRemoveByValueListOp(binName string, values []interface{}, returnType mapReturnType) *Operation
- func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation
- func MapRemoveByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, ...) *Operation
- func MapSetPolicyOp(policy *MapPolicy, binName string) *Operation
- func MapSizeOp(binName string) *Operation
- func PrependOp(bin *Bin) *Operation
- func PutOp(bin *Bin) *Operation
- func TouchOp() *Operation
- type OperationType
- type Partition
- type Policy
- type Priority
- type QueryPolicy
- type Record
- type RecordExistsAction
- type Recordset
- type RegisterTask
- type RemoveTask
- type ReplicaPolicy
- type Result
- type Role
- type ScanPolicy
- type Statement
- type StringValue
- type Task
- type UDF
- type UserRoles
- type Value
- type ValueArray
- type WritePolicy
Constants ¶
const ( // CONSISTENCY_ONE indicates only a single replica should be consulted in // the read operation. CONSISTENCY_ONE = iota // CONSISTENCY_ALL indicates that all replicas should be consulted in // the read operation. CONSISTENCY_ALL )
const ( // TTLServerDefault will default to namespace configuration variable "default-ttl" on the server. TTLServerDefault = 0 // TTLDontExpire will never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3 server. TTLDontExpire = math.MaxUint32 // TTLDontUpdate will not change the record's ttl when record is written. Supported by Aerospike server versions >= 3.10.1 TTLDontUpdate = math.MaxUint32 - 1 )
Variables ¶
var MapOrder = struct { // Map is not ordered. This is the default. UNORDERED mapOrderType // 0 // Order map by key. KEY_ORDERED mapOrderType // 1 // Order map by key, then value. KEY_VALUE_ORDERED mapOrderType // 3 }{0, 1, 3}
Map storage order.
var MapReturnType = struct { // Do not return a result. NONE mapReturnType // Return key index order. // // 0 = first key // N = Nth key // -1 = last key INDEX mapReturnType // Return reverse key order. // // 0 = last key // -1 = first key REVERSE_INDEX mapReturnType // Return value order. // // 0 = smallest value // N = Nth smallest value // -1 = largest value RANK mapReturnType // Return reserve value order. // // 0 = largest value // N = Nth largest value // -1 = smallest value REVERSE_RANK mapReturnType // Return count of items selected. COUNT mapReturnType // Return key for single key read and key list for range read. KEY mapReturnType // Return value for single key read and value list for range read. VALUE mapReturnType // Return key/value items. The possible return types are: // // map[interface{}]interface{} : Returned for unordered maps // []MapPair : Returned for range results where range order needs to be preserved. KEY_VALUE mapReturnType }{ 0, 1, 2, 3, 4, 5, 6, 7, 8, }
Map return type. Type of data to return when selecting or removing items from the map.
var MapWriteMode = struct { // If the key already exists, the item will be overwritten. // If the key does not exist, a new item will be created. UPDATE *mapWriteMode // If the key already exists, the item will be overwritten. // If the key does not exist, the write will fail. UPDATE_ONLY *mapWriteMode // If the key already exists, the write will fail. // If the key does not exist, a new item will be created. CREATE_ONLY *mapWriteMode }{ &mapWriteMode{_CDT_MAP_PUT, _CDT_MAP_PUT_ITEMS}, &mapWriteMode{_CDT_MAP_REPLACE, _CDT_MAP_REPLACE_ITEMS}, &mapWriteMode{_CDT_MAP_ADD, _CDT_MAP_ADD_ITEMS}, }
var ( // MaxBufferSize protects against allocating massive memory blocks // for buffers. Tweak this number if you are returning a lot of // LDT elements in your queries. MaxBufferSize = 1024 * 1024 * 10 // 10 MB )
Functions ¶
func RequestInfo ¶
func RequestInfo(conn *Connection, names ...string) (map[string]string, error)
RequestInfo gets info values by name from the specified connection.
func RequestNodeInfo ¶ added in v1.0.1
RequestNodeInfo gets 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 SetAerospikeTag ¶ added in v1.20.0
func SetAerospikeTag(tag string)
SetAerospikeTag sets the bin tag to the specified tag. This will be useful for when a user wants to use the same tag name for two different concerns. For example, one will be able to use the same tag name for both json and aerospike bin name.
func SetCommandBufferPool ¶ added in v1.0.1
func SetCommandBufferPool(poolSize, initBufSize, maxBufferSize int)
SetCommandBufferPool can be used to customize the command Buffer Pool parameters to calibrate the pool for different workloads This method is deprecated.
func SetLuaPath ¶ added in v1.10.0
func SetLuaPath(lpath string)
SetLuaPath sets the Lua interpreter path to files This path is used to load UDFs for QueryAggregate command
Types ¶
type AdminCommand ¶ added in v1.3.0
type AdminCommand struct {
// contains filtered or unexported fields
}
type AdminPolicy ¶ added in v1.3.0
type AdminPolicy struct { // User administration command socket timeout in milliseconds. // Default is one second timeout. Timeout time.Duration }
AdminPolicy contains attributes used for user administration commands.
func NewAdminPolicy ¶ added in v1.3.0
func NewAdminPolicy() *AdminPolicy
NewAdminPolicy generates a new AdminPolicy with default values.
type AerospikeBlob ¶
type BasePolicy ¶
type BasePolicy struct { Policy // Priority of request relative to other transactions. // Currently, only used for scans. Priority Priority //= Priority.DEFAULT; // How replicas should be consulted in a read operation to provide the desired // consistency guarantee. Default to allowing one replica to be used in the // read operation. ConsistencyLevel ConsistencyLevel //= CONSISTENCY_ONE // Timeout specifies 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 // MaxRetries determines 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; // SleepBetweenReplies determines duration to sleep between retries if a transaction fails and the // timeout was not exceeded. Enter zero to skip sleep. SleepBetweenRetries time.Duration //= 500ms; // ReplicaPolicy detemines the node to the send the read commands containing the key's partition replica type. // Write commands are not affected by this setting, because all writes are directed // to the node containing the key's master partition. // Default to sending read commands to the node containing the key's master partition. ReplicaPolicy ReplicaPolicy }
BasePolicy encapsulates parameters for transaction policy attributes used in all database operation calls.
func NewPolicy ¶
func NewPolicy() *BasePolicy
NewPolicy generates a new BasePolicy instance with default values.
func (*BasePolicy) GetBasePolicy ¶
func (p *BasePolicy) GetBasePolicy() *BasePolicy
GetBasePolicy returns embedded BasePolicy in all types that embed this struct.
type BaseTask ¶ added in v1.0.1
type BaseTask struct {
// contains filtered or unexported fields
}
BaseTask is 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 }
Bin encapsulates a field 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 []byte
BytesValue encapsulates an array of bytes.
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
NewBytesValue generates a ByteValue instance.
func (BytesValue) GetObject ¶
func (vl BytesValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (BytesValue) GetType ¶
func (vl BytesValue) GetType() int
GetType returns wire protocol value type.
func (BytesValue) String ¶
func (vl BytesValue) String() string
String implements Stringer interface.
type Client ¶
type Client struct { // DefaultPolicy is used for all read commands without a specific policy. DefaultPolicy *BasePolicy // DefaultWritePolicy is used for all write commands without a specific policy. DefaultWritePolicy *WritePolicy // DefaultScanPolicy is used for all query commands without a specific policy. DefaultScanPolicy *ScanPolicy // DefaultQueryPolicy is used for all scan commands without a specific policy. DefaultQueryPolicy *QueryPolicy // DefaultAdminPolicy is used for all security commands without a specific policy. DefaultAdminPolicy *AdminPolicy // contains filtered or unexported fields }
Client encapsulates an Aerospike cluster. All database operations are available against this object.
func NewClientWithPolicy ¶
func NewClientWithPolicy(policy *ClientPolicy, hostname string, port int) (*Client, error)
NewClientWithPolicy generates a new Client using the specified ClientPolicy. If the policy is nil, the default relevant policy will be used.
func NewClientWithPolicyAndHost ¶
func NewClientWithPolicyAndHost(policy *ClientPolicy, hosts ...*Host) (*Client, error)
NewClientWithPolicyAndHost generates a new Client the specified ClientPolicy and sets up the cluster using the provided hosts. If the policy is nil, the default relevant policy will be used.
func (*Client) Add ¶
func (clnt *Client) Add(policy *WritePolicy, key *Key, binMap BinMap) error
Add adds 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. If the policy is nil, the default relevant policy will be used.
func (*Client) AddBins ¶
func (clnt *Client) AddBins(policy *WritePolicy, key *Key, bins ...*Bin) error
AddBins works the same as Add, but avoids BinMap allocation and iteration.
func (*Client) Append ¶
func (clnt *Client) Append(policy *WritePolicy, key *Key, binMap BinMap) error
Append appends bin value's 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 and []byte values. If the policy is nil, the default relevant policy will be used.
func (*Client) AppendBins ¶
func (clnt *Client) AppendBins(policy *WritePolicy, key *Key, bins ...*Bin) error
AppendBins works the same as Append, but avoids BinMap allocation and iteration.
func (*Client) BatchExists ¶ added in v1.0.1
func (clnt *Client) BatchExists(policy *BasePolicy, keys []*Key) ([]bool, error)
BatchExists determines if multiple record keys exist in one batch request. The returned boolean array is in positional order with the original key array order. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGet ¶ added in v1.0.1
func (clnt *Client) BatchGet(policy *BasePolicy, keys []*Key, binNames ...string) ([]*Record, error)
BatchGet reads multiple record headers and bins for specified keys in one batch request. 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. If the policy is nil, the default relevant policy will be used.
func (*Client) BatchGetHeader ¶ added in v1.0.1
func (clnt *Client) BatchGetHeader(policy *BasePolicy, keys []*Key) ([]*Record, error)
BatchGetHeader reads multiple record header data for specified keys in one batch request. 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. If the policy is nil, the default relevant policy will be used.
func (*Client) ChangePassword ¶ added in v1.3.0
func (clnt *Client) ChangePassword(policy *AdminPolicy, user string, password string) error
ChangePassword changes a user's password. Clear-text password will be hashed using bcrypt before sending to server.
func (*Client) Close ¶
func (clnt *Client) Close()
Close closes all client connections to database server nodes.
func (*Client) CreateComplexIndex ¶ added in v1.7.0
func (clnt *Client) CreateComplexIndex( policy *WritePolicy, namespace string, setName string, indexName string, binName string, indexType IndexType, indexCollectionType IndexCollectionType, ) (*IndexTask, error)
CreateComplexIndex creates a secondary index, with the ability to put indexes on bin containing complex data types, e.g: Maps and Lists. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
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)
CreateIndex creates a secondary index. This asynchronous server call will return before the command is complete. The user can optionally wait for command completion by using the returned IndexTask instance. This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) CreateUser ¶ added in v1.3.0
func (clnt *Client) CreateUser(policy *AdminPolicy, user string, password string, roles []string) error
CreateUser creates a new user with password and roles. Clear-text password will be hashed using bcrypt before sending to server.
func (*Client) Delete ¶
func (clnt *Client) Delete(policy *WritePolicy, key *Key) (bool, error)
Delete deletes a record for specified key. The policy specifies the transaction timeout. If the policy is nil, the default relevant policy will be used.
func (*Client) DropIndex ¶ added in v1.0.1
func (clnt *Client) DropIndex( policy *WritePolicy, namespace string, setName string, indexName string, ) error
DropIndex deletes a secondary index. It will block until index is dropped on all nodes. This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) DropUser ¶ added in v1.3.0
func (clnt *Client) DropUser(policy *AdminPolicy, user string) error
DropUser removes a user from the cluster.
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 executes a 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. If the policy is nil, the default relevant policy will be used.
func (*Client) ExecuteUDF ¶ added in v1.0.1
func (clnt *Client) ExecuteUDF(policy *QueryPolicy, statement *Statement, packageName string, functionName string, functionArgs ...Value, ) (*ExecuteTask, error)
ExecuteUDF applies 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. If the policy is nil, the default relevant policy will be used.
func (*Client) Exists ¶
func (clnt *Client) Exists(policy *BasePolicy, key *Key) (bool, error)
Exists determine if a record key exists. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) Get ¶
Get reads a record header and bins for specified key. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GetHeader ¶
func (clnt *Client) GetHeader(policy *BasePolicy, key *Key) (*Record, error)
GetHeader reads a record generation and expiration only for specified key. Bins are not read. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GetLargeList ¶ added in v1.0.1
func (clnt *Client) GetLargeList(policy *WritePolicy, key *Key, binName string, userModule string) *LargeList
GetLargeList initializes 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. If the policy is nil, the default relevant policy will be used.
func (*Client) GetLargeMap ¶ added in v1.0.1
func (clnt *Client) GetLargeMap(policy *WritePolicy, key *Key, binName string, userModule string) *LargeMap
GetLargeMap initializes a 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. If the policy is nil, the default relevant policy will be used. NOTICE: DEPRECATED ON SERVER. Will be removed in future.
func (*Client) GetLargeSet ¶ added in v1.0.1
func (clnt *Client) GetLargeSet(policy *WritePolicy, key *Key, binName string, userModule string) *LargeSet
GetLargeSet initializes 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. If the policy is nil, the default relevant policy will be used. NOTICE: DEPRECATED ON SERVER. Will be removed in future.
func (*Client) GetLargeStack ¶ added in v1.0.1
func (clnt *Client) GetLargeStack(policy *WritePolicy, key *Key, binName string, userModule string) *LargeStack
GetLargeStack initializes 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. If the policy is nil, the default relevant policy will be used. NOTICE: DEPRECATED ON SERVER. Will be removed in future.
func (*Client) GetNodeNames ¶
GetNodeNames returns a list of active server node names in the cluster.
func (*Client) GetObject ¶ added in v1.4.0
func (clnt *Client) GetObject(policy *BasePolicy, key *Key, obj interface{}) error
GetObject reads a record for specified key and puts the result into the provided object. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.
func (*Client) GrantRoles ¶ added in v1.3.0
func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) error
GrantRoles adds roles to user's list of roles.
func (*Client) IsConnected ¶
IsConnected determines if the client is 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. If the policy is nil, the default relevant policy will be used.
func (*Client) Operate ¶ added in v1.0.1
func (clnt *Client) Operate(policy *WritePolicy, key *Key, operations ...*Operation) (*Record, error)
Operate performs multiple read/write operations on a single key in one batch request. 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. If the policy is nil, the default relevant policy will be used.
func (*Client) Prepend ¶
func (clnt *Client) Prepend(policy *WritePolicy, key *Key, binMap BinMap) error
Prepend prepends bin value's 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 and []byte values. If the policy is nil, the default relevant policy will be used.
func (*Client) PrependBins ¶
func (clnt *Client) PrependBins(policy *WritePolicy, key *Key, bins ...*Bin) error
PrependBins works the same as Prepend, but avoids BinMap allocation and iteration.
func (*Client) Put ¶
func (clnt *Client) Put(policy *WritePolicy, key *Key, binMap BinMap) error
Put writes record bin(s) to the server. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. If the policy is nil, the default relevant policy will be used.
func (*Client) PutBins ¶
func (clnt *Client) PutBins(policy *WritePolicy, key *Key, bins ...*Bin) error
PutBins writes record bin(s) to the server. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. This method avoids using the BinMap allocation and iteration and is lighter on GC. If the policy is nil, the default relevant policy will be used.
func (*Client) PutObject ¶ added in v1.4.0
func (clnt *Client) PutObject(policy *WritePolicy, key *Key, obj interface{}) (err error)
PutObject writes record bin(s) to the server. The policy specifies the transaction timeout, record expiration and how the transaction is handled when the record already exists. If the policy is nil, the default relevant policy will be used.
func (*Client) Query ¶ added in v1.0.1
func (clnt *Client) Query(policy *QueryPolicy, statement *Statement) (*Recordset, error)
Query executes a query and returns a Recordset. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryAggregate ¶ added in v1.10.0
func (clnt *Client) QueryAggregate(policy *QueryPolicy, statement *Statement, packageName, functionName string, functionArgs ...interface{}) (*Recordset, error)
QueryAggregate executes a Map/Reduce query and returns the results. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop records off the channel through the Recordset.Records channel.
This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryNode ¶ added in v1.3.0
func (clnt *Client) QueryNode(policy *QueryPolicy, node *Node, statement *Statement) (*Recordset, error)
QueryNode executes a query on a specific node and returns a recordset. The caller can concurrently pop records off the channel through the record channel.
This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryNodeObjects ¶ added in v1.8.0
func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan interface{}) (*Recordset, error)
QueryNodeObjects executes a query on a specific node and marshals the records into the given channel. The caller can concurrently pop records off the channel.
This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryObjects ¶ added in v1.8.0
func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan interface{}) (*Recordset, error)
QueryNodeObjects executes a query on all nodes in the cluster and marshals the records into the given channel. The query executor puts records on the channel from separate goroutines. The caller can concurrently pop objects.
This method is only supported by Aerospike 3 servers. If the policy is nil, the default relevant policy will be used.
func (*Client) QueryUser ¶ added in v1.3.0
func (clnt *Client) QueryUser(policy *AdminPolicy, user string) (*UserRoles, error)
QueryUser retrieves roles for a given user.
func (*Client) QueryUsers ¶ added in v1.3.0
func (clnt *Client) QueryUsers(policy *AdminPolicy) ([]*UserRoles, error)
QueryUsers retrieves all users and their roles.
func (*Client) RegisterUDF ¶ added in v1.0.1
func (clnt *Client) RegisterUDF(policy *WritePolicy, udfBody []byte, serverPath string, language Language) (*RegisterTask, error)
RegisterUDF registers a 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. If the policy is nil, the default relevant policy will be used.
func (*Client) RegisterUDFFromFile ¶ added in v1.0.1
func (clnt *Client) RegisterUDFFromFile(policy *WritePolicy, clientPath string, serverPath string, language Language) (*RegisterTask, error)
RegisterUDFFromFile reads a file from file system and registers the containing a package user defined functions with the 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. If the policy is nil, the default relevant policy will be used.
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. If the policy is nil, the default relevant policy will be used.
func (*Client) RevokeRoles ¶ added in v1.3.0
func (clnt *Client) RevokeRoles(policy *AdminPolicy, user string, roles []string) error
RevokeRoles removes roles from user's list of roles.
func (*Client) ScanAll ¶ added in v1.0.1
func (clnt *Client) ScanAll(apolicy *ScanPolicy, namespace string, setName string, binNames ...string) (*Recordset, error)
ScanAll reads all records in specified namespace and set from all nodes. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanAllObjects ¶ added in v1.8.0
func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error)
ScanAllObjects reads all records in specified namespace and set from all nodes. If the policy's concurrentNodes is specified, each server node will be read in parallel. Otherwise, server nodes are read sequentially. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanNode ¶ added in v1.0.1
func (clnt *Client) ScanNode(apolicy *ScanPolicy, node *Node, namespace string, setName string, binNames ...string) (*Recordset, error)
ScanNode reads all records in specified namespace and set for one node only. If the policy is nil, the default relevant policy will be used.
func (*Client) ScanNodeObjects ¶ added in v1.8.0
func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error)
scanNodeObjects reads all records in specified namespace and set for one node only, and marshalls the results into the objects of the provided channel in Recordset. If the policy is nil, the default relevant policy will be used. The resulting records will be marshalled into the objChan. objChan will be closed after all the records are read.
type ClientPolicy ¶
type ClientPolicy struct { // User authentication to cluster. Leave empty for clusters running without restricted access. User string // Password authentication to cluster. The password will be stored by the client and sent to server // in hashed format. Leave empty for clusters running without restricted access. Password string // ClusterName sets the expected cluster ID. If not null, server nodes must return this cluster ID in order to // join the client's view of the cluster. Should only be set when connecting to servers that // support the "cluster-id" info command. (v3.10+) ClusterName string //="" // 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 // Connection idle timeout. Every time a connection is used, its idle // deadline will be extended by this duration. When this deadline is reached, // the connection will be closed and discarded from the connection pool. IdleTimeout time.Duration //= 14 seconds // ConnectionQueueCache specifies the size of the Connection Queue cache PER NODE. ConnectionQueueSize int //= 256 // If set to true, will not create a new connection // to the node if there are already `ConnectionQueueSize` active connections. LimitConnectionsToQueueSize bool //= true // Throw exception if host connection fails during addHost(). FailIfNotConnected bool //= true // TendInterval determines interval for checking for cluster state changes. // Minimum possible interval is 10 Milliseconds. TendInterval time.Duration //= 1 second // A IP translation table is used in cases where different clients // use different server IP addresses. This may be necessary when // using clients from both inside and outside a local area // network. Default is no translation. // The key is the IP address returned from friend info requests to other servers. // The value is the real IP address used to connect to the server. IpMap map[string]string // UseServicesAlternate determines if the client should use "services-alternate" instead of "services" // in info request during cluster tending. //"services-alternate" returns server configured external IP addresses that client // uses to talk to nodes. "services-alternate" can be used in place of providing a client "ipMap". // This feature is recommended instead of using the client-side IpMap above. // // "services-alternate" is available with Aerospike Server versions >= 3.7.1. UseServicesAlternate bool // false // RequestProleReplicas determines if prole replicas should be requested from each server node in the cluster tend goroutine. // This option is required if there is a need to distribute reads across proles. // If RequestProleReplicas is enabled, all prole partition maps will be cached on the client which results in // extra storage multiplied by the replication factor. // The default is false (only request master replicas and never prole replicas). RequestProleReplicas bool // false // TlsConfig specifies TLS secure connection policy for TLS enabled servers. TlsConfig *tls.Config //= nil }
ClientPolicy encapsulates parameters for client policy command.
func NewClientPolicy ¶
func NewClientPolicy() *ClientPolicy
NewClientPolicy generates a new ClientPolicy with default values.
func (*ClientPolicy) RequiresAuthentication ¶ added in v1.3.0
func (cp *ClientPolicy) RequiresAuthentication() bool
RequiresAuthentication returns true if a USer or Password is set for ClientPolicy.
type Cluster ¶
type Cluster struct {
// contains filtered or unexported fields
}
Cluster encapsulates the aerospike cluster nodes and manages them.
func NewCluster ¶
func NewCluster(policy *ClientPolicy, hosts []*Host) (*Cluster, error)
NewCluster generates a Cluster instance.
func (*Cluster) AddSeeds ¶
AddSeeds adds new hosts to the cluster. They will be added to the cluster on next tend call.
func (*Cluster) ClientPolicy ¶ added in v1.5.1
func (clstr *Cluster) ClientPolicy() (res ClientPolicy)
ClientPolicy returns the client policy that is currently used with the cluster.
func (*Cluster) Close ¶
func (clstr *Cluster) Close()
Close closes all cached connections to the cluster nodes and stops the tend goroutine.
func (*Cluster) GetNodeByName ¶
GetNodeByName finds a node by name and returns an error if the node is not found.
func (*Cluster) GetRandomNode ¶
GetRandomNode returns a random node on the cluster
func (*Cluster) IsConnected ¶
IsConnected returns true if cluster has nodes and is not already closed.
func (*Cluster) MigrationInProgress ¶ added in v1.0.1
MigrationInProgress determines if any node in the cluster is participating in a data migration
func (*Cluster) Password ¶ added in v1.5.1
Password returns the password that is currently used with the cluster.
type CommitLevel ¶ added in v1.2.0
type CommitLevel int
CommitLevel indicates the desired consistency guarantee when committing a transaction on the server.
const ( // COMMIT_ALL indicates the server should wait until successfully committing master and all replicas. COMMIT_ALL CommitLevel = iota // COMMIT_MASTER indicates the server should wait until successfully committing master only. COMMIT_MASTER )
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 NewSecureConnection ¶ added in v1.19.0
func NewSecureConnection(policy *ClientPolicy, host *Host) (*Connection, error)
NewSecureConnection creates a TLS 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) Authenticate ¶ added in v1.5.0
func (ctn *Connection) Authenticate(user string, password []byte) error
Authenticate will send authentication information to the server.
func (*Connection) IsConnected ¶
func (ctn *Connection) IsConnected() bool
IsConnected returns true if the connection is not closed yet.
func (*Connection) Read ¶
func (ctn *Connection) Read(buf []byte, length int) (total int, err error)
Read reads from connection buffer to the provided slice.
func (*Connection) ReadN ¶ added in v1.10.0
ReadN reads N bytes from connection buffer to the provided slice.
func (*Connection) SetTimeout ¶
func (ctn *Connection) SetTimeout(timeout time.Duration) error
SetTimeout sets connection timeout for both read and write operations.
type ConsistencyLevel ¶ added in v1.2.0
type ConsistencyLevel int
ConsistencyLevel indicates how replicas should be consulted in a read operation to provide the desired consistency guarantee.
type DropIndexTask ¶ added in v1.17.0
type DropIndexTask struct { *BaseTask // contains filtered or unexported fields }
DropIndexTask is used to poll for long running create index completion.
func NewDropIndexTask ¶ added in v1.17.0
func NewDropIndexTask(cluster *Cluster, namespace string, indexName string) *DropIndexTask
NewDropIndexTask initializes a task with fields needed to query server nodes.
func (*DropIndexTask) IsDone ¶ added in v1.17.0
func (tski *DropIndexTask) IsDone() (bool, error)
IsDone queries all nodes for task completion status.
func (*DropIndexTask) OnComplete ¶ added in v1.17.0
func (tski *DropIndexTask) OnComplete() chan error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type ExecuteTask ¶ added in v1.0.1
type ExecuteTask struct { *BaseTask // contains filtered or unexported fields }
ExecuteTask is used to poll for long running server execute job completion.
func NewExecuteTask ¶ added in v1.0.1
func NewExecuteTask(cluster *Cluster, statement *Statement) *ExecuteTask
NewExecuteTask initializes task with fields needed to query server nodes.
func (*ExecuteTask) IsDone ¶ added in v1.0.1
func (etsk *ExecuteTask) IsDone() (bool, error)
IsDone queries all nodes for task completion status.
func (*ExecuteTask) OnComplete ¶ added in v1.0.1
func (etsk *ExecuteTask) OnComplete() chan error
OnComplete returns a channel which will be closed when the task is completed. If an error is encountered while performing the task, an error will be sent on the channel.
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 DIGEST_RIPE FieldType = 4 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 INDEX_TYPE = 26 UDF_PACKAGE_NAME FieldType = 30 UDF_FUNCTION FieldType = 31 UDF_ARGLIST FieldType = 32 UDF_OP FieldType = 33 QUERY_BINLIST FieldType = 40 )
FieldType constants used in the Aerospike Wire Protocol.
type Filter ¶ added in v1.0.1
type Filter struct {
// contains filtered or unexported fields
}
Filter specifies a query filter definition.
func NewContainsFilter ¶ added in v1.7.0
func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value interface{}) *Filter
NewContainsFilter creates a contains filter for query on collection index.
func NewContainsRangeFilter ¶ added in v1.7.0
func NewContainsRangeFilter(binName string, indexCollectionType IndexCollectionType, begin, end int64) *Filter
NewContainsRangeFilter creates a contains filter for query on ranges of data in a collection index.
func NewEqualFilter ¶ added in v1.0.1
NewEqualFilter creates a new equality filter instance for query.
func NewGeoRegionsContainingPointFilter ¶ added in v1.9.0
NewGeoRegionsContainingPointFilter creates a geospatial "containing point" filter for query. Argument must be a valid GeoJSON point.
func NewGeoRegionsContainingPointForCollectionFilter ¶ added in v1.13.0
func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string) *Filter
collectionType creates a geospatial "containing point" filter for query on collection index. Argument must be a valid GeoJSON point.
func NewGeoWithinRadiusFilter ¶ added in v1.9.0
NewGeoWithinRadiusFilter creates a geospatial "within radius" filter for query. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRadiusForCollectionFilter ¶ added in v1.13.0
func NewGeoWithinRadiusForCollectionFilter(binName string, collectionType IndexCollectionType, lng, lat, radius float64) *Filter
NewGeoWithinRadiusForCollectionFilter creates a geospatial "within radius" filter for query on collection index. Arguments must be valid longitude/latitude/radius (meters) values.
func NewGeoWithinRegionFilter ¶ added in v1.9.0
NewGeoWithinRegionFilter creates a geospatial "within region" filter for query. Argument must be a valid GeoJSON region.
func NewGeoWithinRegionForCollectionFilter ¶ added in v1.13.0
func NewGeoWithinRegionForCollectionFilter(binName string, collectionType IndexCollectionType, region string) *Filter
NewGeoWithinRegionForCollectionFilter creates a geospatial "within region" filter for query on collection index. Argument must be a valid GeoJSON region.
func NewRangeFilter ¶ added in v1.0.1
NewRangeFilter creates a range filter for query. Range arguments must be int64 values. String ranges are not supported.
func (*Filter) IndexCollectionType ¶ added in v1.7.0
func (fltr *Filter) IndexCollectionType() IndexCollectionType
IndexType return filter's index type.
type FloatValue ¶ added in v1.7.0
type FloatValue float64
FloatValue encapsulates an float64 value.
func NewFloatValue ¶ added in v1.7.0
func NewFloatValue(value float64) FloatValue
NewFloatValue generates a FloatValue instance.
func (FloatValue) GetObject ¶ added in v1.7.0
func (vl FloatValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (FloatValue) GetType ¶ added in v1.7.0
func (vl FloatValue) GetType() int
GetType returns wire protocol value type.
func (FloatValue) String ¶ added in v1.7.0
func (vl FloatValue) String() string
String implements Stringer interface.
type GenerationPolicy ¶
type GenerationPolicy int
GenerationPolicy determines how to handle record writes based on record generation.
const ( // NONE means: Do not use record generation to restrict writes. NONE GenerationPolicy = iota // EXPECT_GEN_EQUAL means: Update/Delete record if expected generation is equal to server generation. Otherwise, fail. EXPECT_GEN_EQUAL // EXPECT_GEN_GT means: Update/Delete record if expected generation greater than the server generation. Otherwise, fail. // This is useful for restore after backup. EXPECT_GEN_GT )
type GeoJSONValue ¶ added in v1.7.0
type GeoJSONValue string
GeoJSONValue encapsulates a 2D Geo point. Supported by Aerospike 3.6.1 servers only.
func NewGeoJSONValue ¶ added in v1.7.0
func NewGeoJSONValue(value string) GeoJSONValue
NewMapValue generates a GeoJSONValue instance.
func (GeoJSONValue) GetObject ¶ added in v1.7.0
func (vl GeoJSONValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (GeoJSONValue) GetType ¶ added in v1.7.0
func (vl GeoJSONValue) GetType() int
GetType returns wire protocol value type.
func (GeoJSONValue) String ¶ added in v1.7.0
func (vl GeoJSONValue) String() string
String implements Stringer interface.
type Host ¶
type Host struct { // Host name or IP address of database server. Name string //TLSName defines the TLS certificate name used for secure connections. TLSName string // Port of database server. Port int }
Host name/port of database server.
type IndexCollectionType ¶ added in v1.7.0
type IndexCollectionType int
IndexCollectionType is the secondary index collection type.
const ( // Normal scalar index. ICT_DEFAULT IndexCollectionType = iota // LIST is Index list elements. ICT_LIST // MAPKEYS is Index map keys. ICT_MAPKEYS // MAPVALUES is Index map values. ICT_MAPVALUES )
type IndexTask ¶ added in v1.0.1
type IndexTask struct { *BaseTask // contains filtered or unexported fields }
IndexTask is used to poll for long running create index completion.
func NewIndexTask ¶ added in v1.0.1
NewIndexTask initializes a task with fields needed to query server nodes.
func (*IndexTask) OnComplete ¶ added in v1.0.1
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type IntegerValue ¶
type IntegerValue int
IntegerValue encapsulates an integer value.
func NewIntegerValue ¶
func NewIntegerValue(value int) IntegerValue
NewIntegerValue generates an IntegerValue instance.
func (IntegerValue) GetObject ¶
func (vl IntegerValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (IntegerValue) GetType ¶
func (vl IntegerValue) GetType() int
GetType returns wire protocol value type.
func (IntegerValue) String ¶
func (vl IntegerValue) String() string
String implements Stringer interface.
type JsonValue ¶ added in v1.20.0
type JsonValue map[string]interface{}
JsonValue encapsulates a Json map. Supported by Aerospike 3 servers only.
func NewJsonValue ¶ added in v1.20.0
NewMapValue generates a JsonValue instance.
func (JsonValue) GetObject ¶ added in v1.20.0
func (vl JsonValue) GetObject() interface{}
GetObject returns original value as an interface{}.
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
Key is the 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 ¶
NewKey initializes a 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 NewKeyWithDigest ¶ added in v1.2.0
func NewKeyWithDigest(namespace string, setName string, key interface{}, digest []byte) (newKey *Key, err error)
NewKeyWithDigest initializes a key from namespace, optional set name and user key. The server handles record identifiers by digest only.
type Language ¶ added in v1.0.1
type Language string
Language specifies 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
}
LargeList encapsulates 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
NewLargeList initializes a large list operator.
func (*LargeList) Add ¶ added in v1.0.1
Add adds values to the list. If the list does not exist, create it
func (*LargeList) Exist ¶ added in v1.8.0
Do key/values exist? Return list of results in one batch call.
func (*LargeList) FFilterThenindFirst ¶ added in v1.6.0
func (ll *LargeList) FFilterThenindFirst(count int, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
FFilterThenindFirst selects values from the beginning of list up to a maximum count after applying lua filter.
func (*LargeList) Filter ¶ added in v1.0.1
func (ll *LargeList) Filter(filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
Filter selects values from list and apply specified Lua filter.
func (*LargeList) FilterThenFindFrom ¶ added in v1.6.0
func (ll *LargeList) FilterThenFindFrom(begin interface{}, count int, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
FilterThenFindFrom selects values from the begin key up to a maximum count after applying lua filter.
func (*LargeList) FilterThenFindLast ¶ added in v1.6.0
func (ll *LargeList) FilterThenFindLast(count int, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
FilterThenFindLast selects values from the end of list up to a maximum count after applying lua filter.
func (*LargeList) FindFirst ¶ added in v1.6.0
FindFirst selects values from the beginning of list up to a maximum count.
func (*LargeList) FindFrom ¶ added in v1.6.0
FindFrom selects values from the begin key up to a maximum count.
func (*LargeList) FindLast ¶ added in v1.6.0
FindLast selects values from the end of list up to a maximum count.
func (*LargeList) FindThenFilter ¶ added in v1.0.1
func (ll *LargeList) FindThenFilter(value interface{}, filterModule, filterName string, filterArgs ...interface{}) ([]interface{}, error)
FindThenFilter selects values from list and applies specified Lua filter.
func (*LargeList) GetConfig ¶ added in v1.0.1
GetConfig returns map of list configuration parameters.
func (*LargeList) RangeN ¶ added in v1.6.0
RangeN selects a range of values up to a maximum count from the large list.
func (*LargeList) RangeNThenFilter ¶ added in v1.6.0
func (ll *LargeList) RangeNThenFilter(begin, end interface{}, count int, filterModule string, filterName string, filterArgs ...interface{}) ([]interface{}, error)
RangeNThenFilter selects a range of values up to a maximum count from the large list then apply filter.
func (*LargeList) RangeThenFilter ¶ added in v1.2.0
func (ll *LargeList) RangeThenFilter(begin, end interface{}, filterModule string, filterName string, filterArgs ...interface{}) ([]interface{}, error)
RangeThenFilter selects a range of values from the large list then apply filter.
func (*LargeList) SetPageSize ¶ added in v1.6.0
SetPageSize sets the LDT page size.
type LargeMap ¶ added in v1.0.1
type LargeMap struct {
// contains filtered or unexported fields
}
LargeMap encapsulates 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
NewLargeMap initializes a large map operator.
func (*LargeMap) Filter ¶ added in v1.0.1
func (lm *LargeMap) Filter(filterName string, filterArgs ...interface{}) (map[interface{}]interface{}, error)
Filter selects items from the map.
func (*LargeMap) Get ¶ added in v1.0.1
Get returns value from map corresponding with the provided key.
func (*LargeMap) Put ¶ added in v1.0.1
Put adds an entry to the map. If the map does not exist, create it using specified userModule configuration.
func (*LargeMap) PutMap ¶ added in v1.0.1
PutMap adds map values to the map. If the map does not exist, create it using specified userModule configuration.
type LargeObject ¶ added in v1.0.1
type LargeObject interface { // Destroy the bin containing LDT. Destroy() error // Size returns the size of the LDT. Size() (int, error) // GetConfig returns a map containing LDT config values. GetConfig() (map[interface{}]interface{}, error) }
LargeObject interface defines methods to work with LDTs.
type LargeSet ¶ added in v1.0.1
type LargeSet struct {
// contains filtered or unexported fields
}
LargeSet encapsulates a set within a single bin.
func NewLargeSet ¶ added in v1.0.1
func NewLargeSet(client *Client, policy *WritePolicy, key *Key, binName string, userModule string) *LargeSet
NewLargeSet initializes a large set operator.
func (*LargeSet) Add ¶ added in v1.0.1
Add adds values to the set. If the set does not exist, create it using specified userModule configuration.
func (*LargeSet) Filter ¶ added in v1.0.1
Filter select values from set and applies specified Lua filter.
type LargeStack ¶ added in v1.0.1
type LargeStack struct {
// contains filtered or unexported fields
}
LargeStack encapsulates a stack within a single bin. A stack is last in/first out (LIFO) data structure.
func NewLargeStack ¶ added in v1.0.1
func NewLargeStack(client *Client, policy *WritePolicy, key *Key, binName string, userModule string) *LargeStack
NewLargeStack initializes a large stack operator.
func (*LargeStack) Destroy ¶ added in v1.0.1
func (lstk *LargeStack) Destroy() error
Destroy deletes the bin containing the stack.
func (*LargeStack) Filter ¶ added in v1.0.1
func (lstk *LargeStack) Filter(peekCount int, filterName string, filterArgs ...interface{}) ([]interface{}, error)
Filter selects items from top of stack.
func (*LargeStack) GetConfig ¶ added in v1.0.1
func (lstk *LargeStack) GetConfig() (map[interface{}]interface{}, error)
GetConfig returns map of stack configuration parameters.
func (*LargeStack) Peek ¶ added in v1.0.1
func (lstk *LargeStack) Peek(peekCount int) ([]interface{}, error)
Peek select items from top of stack, without removing them
func (*LargeStack) Pop ¶ added in v1.0.1
func (lstk *LargeStack) Pop(count int) ([]interface{}, error)
Pop selects items from top of stack and then removes them.
func (*LargeStack) Push ¶ added in v1.0.1
func (lstk *LargeStack) Push(values ...interface{}) error
Push pushes values onto stack. If the stack does not exist, create it using specified userModule configuration.
func (*LargeStack) Scan ¶ added in v1.0.1
func (lstk *LargeStack) Scan() ([]interface{}, error)
Scan returns all objects in the stack.
func (*LargeStack) Size ¶ added in v1.0.1
func (lstk *LargeStack) Size() (int, error)
Size returns size of the stack.
type ListIter ¶ added in v1.20.0
ListIter allows to define general maps of your own type to be used in the Go client without the use of reflection.
type ListValue ¶
type ListValue []interface{}
ListValue encapsulates any arbitrary array. Supported by Aerospike 3 servers only.
func NewListValue ¶
func NewListValue(list []interface{}) ListValue
NewListValue generates a ListValue instance.
func (ListValue) GetObject ¶
func (vl ListValue) GetObject() interface{}
GetObject returns original value as an interface{}.
type ListerValue ¶ added in v1.20.0
type ListerValue struct {
// contains filtered or unexported fields
}
ListValue encapsulates any arbitrary array. Supported by Aerospike 3 servers only.
func NewListerValue ¶ added in v1.20.0
func NewListerValue(list ListIter) *ListerValue
NewListValue generates a ListValue instance.
func (*ListerValue) GetObject ¶ added in v1.20.0
func (vl *ListerValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (*ListerValue) GetType ¶ added in v1.20.0
func (vl *ListerValue) GetType() int
GetType returns wire protocol value type.
func (*ListerValue) String ¶ added in v1.20.0
func (vl *ListerValue) String() string
String implements Stringer interface.
type LongValue ¶
type LongValue int64
LongValue encapsulates an int64 value.
func NewLongValue ¶
NewLongValue generates a LongValue instance.
func (LongValue) GetObject ¶
func (vl LongValue) GetObject() interface{}
GetObject returns original value as an interface{}.
type MapIter ¶ added in v1.20.0
MapIter allows to define general maps of your own type to be used in the Go client without the use of reflection.
type MapPair ¶ added in v1.16.0
type MapPair struct{ Key, Value interface{} }
Map pair is used when the client returns sorted maps from the server Since the default map in Go is a hash map, we will use a slice to return the results in server order
type MapPolicy ¶ added in v1.16.0
type MapPolicy struct {
// contains filtered or unexported fields
}
MapPolicy directives when creating a map and writing map items.
func DefaultMapPolicy ¶ added in v1.16.0
func DefaultMapPolicy() *MapPolicy
DefaultMapPolicy returns the default map policy
func NewMapPolicy ¶ added in v1.16.0
func NewMapPolicy(order mapOrderType, writeMode *mapWriteMode) *MapPolicy
Create unique key map with specified order when map does not exist. Use specified write mode when writing map items.
type MapValue ¶
type MapValue map[interface{}]interface{}
MapValue encapsulates an arbitrary map. Supported by Aerospike 3 servers only.
func NewMapValue ¶
func NewMapValue(vmap map[interface{}]interface{}) MapValue
NewMapValue generates a MapValue instance.
func (MapValue) GetObject ¶
func (vl MapValue) GetObject() interface{}
GetObject returns original value as an interface{}.
type MapperValue ¶ added in v1.20.0
type MapperValue struct {
// contains filtered or unexported fields
}
MapperValue encapsulates an arbitrary map which implements a MapIter interface. Supported by Aerospike 3 servers only.
func NewMapperValue ¶ added in v1.20.0
func NewMapperValue(vmap MapIter) *MapperValue
NewMapValue generates a MapperValue instance.
func (*MapperValue) GetObject ¶ added in v1.20.0
func (vl *MapperValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (*MapperValue) GetType ¶ added in v1.20.0
func (vl *MapperValue) GetType() int
GetType returns wire protocol value type.
func (*MapperValue) String ¶ added in v1.20.0
func (vl *MapperValue) String() string
type MultiPolicy ¶ added in v1.0.2
type MultiPolicy 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 // Blocks until on-going migrations are over WaitUntilMigrationsAreOver bool //=false }
MultiPolicy contains parameters for policy attributes used in query and scan operations.
func NewMultiPolicy ¶ added in v1.0.2
func NewMultiPolicy() *MultiPolicy
NewMultiPolicy initializes a MultiPolicy instance with default values.
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node represents an Aerospike Database Server Node
func (*Node) Close ¶
func (nd *Node) Close()
Close marks node as inactive and closes all of its pooled connections.
func (*Node) GetConnection ¶
func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err error)
GetConnection gets a connection to the node. If no pooled connection is available, a new connection will be created, unless ClientPolicy.MaxQueueSize number of connections are already created. This method will retry to retrieve a connection in case the connection pool is empty, until timeout is reached.
func (*Node) InvalidateConnection ¶ added in v1.6.0
func (nd *Node) InvalidateConnection(conn *Connection)
InvalidateConnection closes and discards a connection from the pool.
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)
PutConnection puts back a connection to the pool. If connection pool is full, the connection will be closed and discarded.
func (*Node) Refresh ¶
Refresh requests current status from server node, and updates node with the result.
func (*Node) RequestInfo ¶ added in v1.12.0
RequestInfo gets info values by name from the specified database server node.
type NodeError ¶ added in v1.0.1
type NodeError struct {
// contains filtered or unexported fields
}
NodeError is a type to encapsulate the node that the error occurred in.
type NullValue ¶
type NullValue struct{}
NullValue is an empty value.
func NewNullValue ¶ added in v1.0.1
func NewNullValue() NullValue
NewNullValue generates a NullValue instance.
func (NullValue) GetObject ¶
func (vl NullValue) GetObject() interface{}
GetObject returns original value as an interface{}.
type Operation ¶
type Operation struct { // OpType determines type of operation. OpType OperationType // BinName (Optional) determines the name of bin used in operation. BinName string // BinValue (Optional) determines bin value used in operation. BinValue Value // contains filtered or unexported fields }
Operation contains operation definition. This struct is used in client's operate() method.
func GetHeaderOp ¶ added in v1.0.1
func GetHeaderOp() *Operation
GetHeaderOp creates read record header database operation.
func GetOp ¶ added in v1.0.1
func GetOp() *Operation
GetOp creates read all record bins database operation.
func GetOpForBin ¶ added in v1.0.1
GetOpForBin creates read bin database operation.
func ListAppendOp ¶ added in v1.9.0
ListAppendOp creates a list append operation. Server appends values to end of list bin. Server returns list size on bin name. It will panic is no values have been passed.
func ListClearOp ¶ added in v1.9.0
ListClearOp creates a list clear operation. Server removes all items in list bin. Server does not return a result by default.
func ListGetOp ¶ added in v1.9.0
ListGetOp creates a list get operation. Server returns item at specified index in list bin.
func ListGetRangeFromOp ¶ added in v1.11.0
ListGetRangeFromOp creates a list get range operation. Server returns items starting at specified index to the end of list.
func ListGetRangeOp ¶ added in v1.9.0
ListGetRangeOp creates a list get range operation. Server returns "count" items starting at specified index in list bin.
func ListInsertOp ¶ added in v1.9.0
ListInsertOp creates a list insert operation. Server inserts value to specified index of list bin. Server returns list size on bin name. It will panic is no values have been passed.
func ListPopOp ¶ added in v1.9.0
ListPopOp creates list pop operation. Server returns item at specified index and removes item from list bin.
func ListPopRangeFromOp ¶ added in v1.11.0
ListPopRangeFromOp creates a list pop range operation. Server returns items starting at specified index to the end of list and removes items from list bin.
func ListPopRangeOp ¶ added in v1.9.0
ListPopRangeOp creates a list pop range operation. Server returns items starting at specified index and removes items from list bin.
func ListRemoveOp ¶ added in v1.9.0
ListRemoveOp creates a list remove operation. Server removes item at specified index from list bin. Server returns number of items removed.
func ListRemoveRangeFromOp ¶ added in v1.11.0
ListRemoveRangeFromOp creates a list remove range operation. Server removes all items starting at specified index to the end of list. Server returns number of items removed.
func ListRemoveRangeOp ¶ added in v1.9.0
ListRemoveRangeOp creates a list remove range operation. Server removes "count" items starting at specified index from list bin. Server returns number of items removed.
func ListSetOp ¶ added in v1.9.0
ListSetOp creates a list set operation. Server sets item value at specified index in list bin. Server does not return a result by default.
func ListSizeOp ¶ added in v1.9.0
ListSizeOp creates a list size operation. Server returns size of list on bin name.
func ListTrimOp ¶ added in v1.9.0
ListTrimOp creates a list trim operation. Server removes "count" items in list bin that do not fall into range specified by index and count range. If the range is out of bounds, then all items will be removed. Server returns number of elemts that were removed.
func MapClearOp ¶ added in v1.16.0
MapClearOp creates map clear operation. Server removes all items in map. Server returns null.
func MapDecrementOp ¶ added in v1.16.0
func MapDecrementOp(policy *MapPolicy, binName string, key interface{}, decr interface{}) *Operation
MapDecrementOp creates map decrement operation. Server decrements values by decr for all items identified by key and returns final result. Valid only for numbers.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
func MapGetByIndexOp ¶ added in v1.16.0
MapGetByIndexOp creates map get by index operation. Server selects map item identified by index and returns selected data specified by returnType.
func MapGetByIndexRangeCountOp ¶ added in v1.16.0
func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation
MapGetByIndexRangeCountOp creates map get by index range operation. Server selects "count" map items starting at specified index and returns selected data specified by returnType.
func MapGetByIndexRangeOp ¶ added in v1.16.0
MapGetByIndexRangeOp creates map get by index range operation. Server selects map items starting at specified index to the end of map and returns selected data specified by returnType.
func MapGetByKeyOp ¶ added in v1.16.0
MapGetByKeyOp creates map get by key operation. Server selects map item identified by key and returns selected data specified by returnType.
func MapGetByKeyRangeOp ¶ added in v1.16.0
func MapGetByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, returnType mapReturnType) *Operation
MapGetByKeyRangeOp creates map get by key range operation. Server selects map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is null, the range is less than keyEnd. If keyEnd is null, the range is greater than equal to keyBegin.
Server returns selected data specified by returnType.
func MapGetByRankOp ¶ added in v1.16.0
MapGetByRankOp creates map get by rank operation. Server selects map item identified by rank and returns selected data specified by returnType.
func MapGetByRankRangeCountOp ¶ added in v1.16.0
func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation
MapGetByRankRangeCountOp creates map get by rank range operation. Server selects "count" map items starting at specified rank and returns selected data specified by returnType.
func MapGetByRankRangeOp ¶ added in v1.16.0
MapGetByRankRangeOp creates map get by rank range operation. Server selects map items starting at specified rank to the last ranked item and returns selected data specified by returnType.
func MapGetByValueOp ¶ added in v1.16.0
MapGetByValueOp creates map get by value operation. Server selects map items identified by value and returns selected data specified by returnType.
func MapGetByValueRangeOp ¶ added in v1.16.0
func MapGetByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, returnType mapReturnType) *Operation
MapGetByValueRangeOp creates map get by value range operation. Server selects map items identified by value range (valueBegin inclusive, valueEnd exclusive) If valueBegin is null, the range is less than valueEnd. If valueEnd is null, the range is greater than equal to valueBegin.
Server returns selected data specified by returnType.
func MapIncrementOp ¶ added in v1.16.0
func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}) *Operation
MapIncrementOp creates map increment operation. Server increments values by incr for all items identified by key and returns final result. Valid only for numbers.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
func MapPutItemsOp ¶ added in v1.16.0
MapPutItemsOp creates map put items operation Server writes each map item to map bin and returns map size.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
func MapPutOp ¶ added in v1.16.0
MapPutOp creates map put operation. Server writes key/value item to map bin and returns map size.
The required map policy dictates the type of map to create when it does not exist. The map policy also specifies the mode used when writing items to the map.
func MapRemoveByIndexOp ¶ added in v1.16.0
MapRemoveByIndexOp creates map remove operation. Server removes map item identified by index and returns removed data specified by returnType.
func MapRemoveByIndexRangeCountOp ¶ added in v1.16.0
func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation
MapRemoveByIndexRangeCountOp creates map remove operation. Server removes "count" map items starting at specified index and returns removed data specified by returnType.
func MapRemoveByIndexRangeOp ¶ added in v1.16.0
MapRemoveByIndexRangeOp creates map remove operation. Server removes map items starting at specified index to the end of map and returns removed data specified by returnType.
func MapRemoveByKeyListOp ¶ added in v1.16.0
MapRemoveByKeyListOp creates map remove operation. Server removes map items identified by keys and returns removed data specified by returnType.
func MapRemoveByKeyOp ¶ added in v1.16.0
MapRemoveByKeyOp creates map remove operation. Server removes map item identified by key and returns removed data specified by returnType.
func MapRemoveByKeyRangeOp ¶ added in v1.16.0
func MapRemoveByKeyRangeOp(binName string, keyBegin interface{}, keyEnd interface{}, returnType mapReturnType) *Operation
MapRemoveByKeyRangeOp creates map remove operation. Server removes map items identified by key range (keyBegin inclusive, keyEnd exclusive). If keyBegin is null, the range is less than keyEnd. If keyEnd is null, the range is greater than equal to keyBegin.
Server returns removed data specified by returnType.
func MapRemoveByRankOp ¶ added in v1.16.0
MapRemoveByRankOp creates map remove operation. Server removes map item identified by rank and returns removed data specified by returnType.
func MapRemoveByRankRangeCountOp ¶ added in v1.16.0
func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation
MapRemoveByRankRangeCountOp creates map remove operation. Server removes "count" map items starting at specified rank and returns removed data specified by returnType.
func MapRemoveByRankRangeOp ¶ added in v1.16.0
MapRemoveByRankRangeOp creates map remove operation. Server removes map items starting at specified rank to the last ranked item and returns removed data specified by returnType.
func MapRemoveByValueListOp ¶ added in v1.16.0
func MapRemoveByValueListOp(binName string, values []interface{}, returnType mapReturnType) *Operation
MapRemoveByValueListOp creates map remove operation. Server removes map items identified by values and returns removed data specified by returnType.
func MapRemoveByValueOp ¶ added in v1.16.0
MapRemoveByValueOp creates map remove operation. Server removes map items identified by value and returns removed data specified by returnType.
func MapRemoveByValueRangeOp ¶ added in v1.16.0
func MapRemoveByValueRangeOp(binName string, valueBegin interface{}, valueEnd interface{}, returnType mapReturnType) *Operation
MapRemoveByValueRangeOp creates map remove operation. Server removes map items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is null, the range is less than valueEnd. If valueEnd is null, the range is greater than equal to valueBegin.
Server returns removed data specified by returnType.
func MapSetPolicyOp ¶ added in v1.16.0
MapSetPolicyOp creates set map policy operation. Server sets map policy attributes. Server returns null.
The required map policy attributes can be changed after the map is created.
type OperationType ¶
type OperationType *struct {
// contains filtered or unexported fields
}
OperationType determines operation type
var ( READ OperationType = &struct{ op byte }{1} WRITE OperationType = &struct{ op byte }{2} CDT_READ OperationType = &struct{ op byte }{3} CDT_MODIFY OperationType = &struct{ op byte }{4} MAP_READ OperationType = &struct{ op byte }{3} MAP_MODIFY OperationType = &struct{ op byte }{4} ADD OperationType = &struct{ op byte }{5} APPEND OperationType = &struct{ op byte }{9} PREPEND OperationType = &struct{ op byte }{10} TOUCH OperationType = &struct{ op byte }{11} )
Valid OperationType values that can be used to create custom Operations. The names are self-explanatory.
type Partition ¶
Partition encapsulates partition information.
func NewPartition ¶
NewPartition generates a partition instance.
func NewPartitionByKey ¶
NewPartitionByKey initializes a partition and determines the Partition Id from key digest automatically.
type Policy ¶
type Policy interface { // Retrieves BasePolicy GetBasePolicy() *BasePolicy }
Policy Interface
type Priority ¶
type Priority int
Priority of operations on database server.
const ( // DEFAULT determines that the server defines the priority. DEFAULT Priority = iota // LOW determines that the server should run the operation in a background thread. LOW // MEDIUM determines that the server should run the operation at medium priority. MEDIUM // HIGH determines that the server should run the operation at the highest priority. HIGH )
type QueryPolicy ¶
type QueryPolicy struct {
*MultiPolicy
}
QueryPolicy encapsulates parameters for policy attributes used in query operations.
func NewQueryPolicy ¶ added in v1.0.1
func NewQueryPolicy() *QueryPolicy
NewQueryPolicy generates a new QueryPolicy instance with default values.
type Record ¶
type Record struct { // Key is the record's key. // Might be empty, or may only consist of digest value. Key *Key // Node from which the Record is originating from. Node *Node // Bins is the map of requested name/value bins. Bins BinMap // Generation shows record modification count. Generation uint32 // Expiration is TTL (Time-To-Live). // Number of seconds until record expires. Expiration uint32 }
Record is the container struct for database records. Records are equivalent to rows.
type RecordExistsAction ¶
type RecordExistsAction int
RecordExistsAction determines how to handle writes when the record already exists.
const ( // UPDATE means: Create or update record. // Merge write command bins with existing bins. UPDATE RecordExistsAction = iota // UPDATE_ONLY means: Update record only. Fail if record does not exist. // Merge write command bins with existing bins. UPDATE_ONLY // REPLACE means: 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_ONLY means: 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 means: Create only. Fail if record exists. CREATE_ONLY )
type Recordset ¶ added in v1.0.1
type Recordset struct { // Records is a channel on which the resulting records will be sent back. // NOTE: Do not use Records directly. Range on channel returned by Results() instead. // Will be unexported in the future Records chan *Record // contains filtered or unexported fields }
Recordset encapsulates the result of Scan and Query commands.
func (*Recordset) Close ¶ added in v1.0.1
Close all streams from different nodes. A successful close return nil, subsequent calls to the method will return ErrRecordsetClosed.
func (*Recordset) IsActive ¶ added in v1.0.1
IsActive returns true if the operation hasn't been finished or cancelled.
func (*Recordset) Read ¶ added in v1.14.0
Read reads the next record from the Recordset. If the Recordset has been closed, it returns ErrRecordsetClosed.
func (*Recordset) Results ¶ added in v1.4.0
Results returns a new receive-only channel with the results of the Scan/Query. This is a more idiomatic approach to the iterator pattern in getting the results back from the recordset, and doesn't require the user to write the ugly select in their code. Result contains a Record and an error reference.
Example:
recordset, err := client.ScanAll(nil, namespace, set) handleError(err) for res := range recordset.Results() { if res.Err != nil { // handle error here } else { // process record here fmt.Println(res.Record.Bins) } }
type RegisterTask ¶ added in v1.0.1
type RegisterTask struct { *BaseTask // contains filtered or unexported fields }
RegisterTask is used to poll for UDF registration completion.
func NewRegisterTask ¶ added in v1.0.1
func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask
NewRegisterTask initializes a RegisterTask with fields needed to query server nodes.
func (*RegisterTask) IsDone ¶ added in v1.0.1
func (tskr *RegisterTask) IsDone() (bool, error)
IsDone will query all nodes for task completion status.
func (*RegisterTask) OnComplete ¶ added in v1.0.1
func (tskr *RegisterTask) OnComplete() chan error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type RemoveTask ¶ added in v1.0.1
type RemoveTask struct { *BaseTask // contains filtered or unexported fields }
RemoveTask is used to poll for UDF registration completion.
func NewRemoveTask ¶ added in v1.0.1
func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask
NewRemoveTask initializes a RemoveTask with fields needed to query server nodes.
func (*RemoveTask) IsDone ¶ added in v1.0.1
func (tskr *RemoveTask) IsDone() (bool, error)
IsDone will query all nodes for task completion status.
func (*RemoveTask) OnComplete ¶ added in v1.0.1
func (tskr *RemoveTask) OnComplete() chan error
OnComplete returns a channel that will be closed as soon as the task is finished. If an error is encountered during operation, an error will be sent on the channel.
type ReplicaPolicy ¶ added in v1.17.0
type ReplicaPolicy int
ReplicaPolicy defines type of node partition targeted by read commands.
const ( // MASTER reads from node containing key's master partition. // This is the default behavior. MASTER ReplicaPolicy = iota // MASTER_PROLES Distributes reads across nodes containing key's master and replicated partitions // in round-robin fashion. This option requires ClientPolicy.RequestProleReplicas // to be enabled in order to function properly. MASTER_PROLES // Distribute reads across all nodes in cluster in round-robin fashion. // This option is useful when the replication factor equals the number // of nodes in the cluster and the overhead of requesting proles is not desired. RANDOM )
type Role ¶ added in v1.3.0
type Role string
const ( // UserAdmin allows to manages users and their roles. UserAdmin Role = "user-admin" // SysAdmin allows to manage indexes, user defined functions and server configuration. SysAdmin Role = "sys-admin" // ReadWriteUDF allows read, write and UDF transactions with the database. ReadWriteUDF Role = "read-write-udf" // ReadWrite allows read and write transactions with the database. ReadWrite Role = "read-write" // Read allow read transactions with the database. Read Role = "Read" )
Pre-defined user roles.
type ScanPolicy ¶
type ScanPolicy struct { *MultiPolicy // ScanPercent determines percent of data to scan. // Valid integer range is 1 to 100. // Default is 100. ScanPercent int //= 100; // ConcurrentNodes determines how to issue scan requests (in parallel or sequentially). ConcurrentNodes bool //= true; // Indicates if bin data is retrieved. If false, only record digests are retrieved. IncludeBinData bool //= true; // Include large data type bin values in addition to large data type bin names. // If false, LDT bin names will be returned, but LDT bin values will be empty. // If true, LDT bin names and the entire LDT bin values will be returned. // Warning: LDT values may consume huge of amounts of memory depending on LDT size. IncludeLDT bool // FailOnClusterChange determines scan termination if cluster is in fluctuating state. FailOnClusterChange bool }
ScanPolicy encapsulates parameters used in scan operations.
func NewScanPolicy ¶ added in v1.0.1
func NewScanPolicy() *ScanPolicy
NewScanPolicy creates a new ScanPolicy instance with default values.
type Statement ¶ added in v1.0.1
type Statement struct { // Namespace determines query Namespace Namespace string // SetName determines query Set name (Optional) SetName string // IndexName determines query index name (Optional) // If not set, the server will determine the index from the filter's bin name. IndexName string // BinNames detemines bin names (optional) BinNames []string // Filters determine query filters (Optional) // 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 // TaskId determines query task id. (Optional) TaskId uint64 // contains filtered or unexported fields }
Statement encapsulates query statement parameters.
func NewStatement ¶ added in v1.0.1
NewStatement initializes a new Statement instance.
func (*Statement) Addfilter ¶ added in v1.0.1
Addfilter adds a filter to the statement. Aerospike Server currently only supports using a single filter per statement/query.
func (*Statement) IsScan ¶ added in v1.0.1
IsScan determines is the Statement is a full namespace/set scan or a selective Query.
func (*Statement) SetAggregateFunction ¶ added in v1.0.1
func (stmt *Statement) SetAggregateFunction(packageName string, functionName string, functionArgs []Value, returnData bool)
SetAggregateFunction sets aggregation function parameters. This function will be called on both the server and client for each selected item.
type StringValue ¶
type StringValue string
StringValue encapsulates a string value.
func NewStringValue ¶
func NewStringValue(value string) StringValue
NewStringValue generates a StringValue instance.
func (StringValue) GetObject ¶
func (vl StringValue) GetObject() interface{}
GetObject returns original value as an interface{}.
func (StringValue) GetType ¶
func (vl StringValue) GetType() int
GetType returns wire protocol value type.
func (StringValue) String ¶
func (vl StringValue) String() string
String implements Stringer interface.
type Task ¶ added in v1.0.1
type Task interface { IsDone() (bool, error) OnComplete() chan error // contains filtered or unexported methods }
Task interface defines methods for asynchronous tasks.
type UDF ¶ added in v1.0.1
type UDF struct { // Filename of the UDF Filename string // Hash digest of the UDF Hash string // Language of UDF Language Language }
UDF carries information about UDFs on the server
type UserRoles ¶ added in v1.3.0
type UserRoles struct { // User name. User string // Roles is a list of assigned roles. Roles []string }
UserRoles contains information about a user.
type Value ¶
type Value interface { // GetType returns wire protocol value type. GetType() int // GetObject returns original value as an interface{}. GetObject() interface{} // String implements Stringer interface. String() string // contains filtered or unexported methods }
Value interface is used to efficiently serialize objects into the wire protocol.
func NewValue ¶
func NewValue(v interface{}) Value
NewValue generates a new Value object based on the type. If the type is not supported, NewValue will panic.
func ToValueSlice ¶ added in v1.9.0
func ToValueSlice(array []interface{}) []Value
ToValueSlice converts a []interface{} to []Value. It will panic if any of array element types are not supported. TODO: Do something about this
type ValueArray ¶
type ValueArray []Value
ValueArray encapsulates an array of Value. Supported by Aerospike 3 servers only.
func NewValueArray ¶
func NewValueArray(array []Value) *ValueArray
NewValueArray generates a ValueArray instance.
func ToValueArray ¶ added in v1.0.1
func ToValueArray(array []interface{}) *ValueArray
ToValueArray converts a []interface{} to a ValueArray type. It will panic if any of array element types are not supported.
func (ValueArray) GetObject ¶
func (va ValueArray) GetObject() interface{}
GetObject returns original value as an interface{}.
func (ValueArray) GetType ¶
func (va ValueArray) GetType() int
GetType returns wire protocol value type.
func (ValueArray) String ¶
func (va ValueArray) String() string
String implements Stringer interface.
type WritePolicy ¶
type WritePolicy struct { BasePolicy // RecordExistsAction qualifies how to handle writes where the record already exists. RecordExistsAction RecordExistsAction //= RecordExistsAction.UPDATE; // GenerationPolicy qualifies 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; // Desired consistency guarantee when committing a transaction on the server. The default // (COMMIT_ALL) indicates that the server should wait for master and all replica commits to // be successful before returning success to the client. CommitLevel CommitLevel //= COMMIT_ALL // Generation determines 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 uint32 // Expiration determines record expiration in seconds. Also known as TTL (Time-To-Live). // Seconds record will live before being removed by the server. // Expiration values: // TTLServerDefault (0): Default to namespace configuration variable "default-ttl" on the server. // TTLDontExpire (MaxUint32): Never expire for Aerospike 2 server versions >= 2.7.2 and Aerospike 3 server // TTLDontUpdate (MaxUint32 - 1): Do not change ttl when record is written. Supported by Aerospike server versions >= 3.10.1 // > 0: Actual expiration in seconds. Expiration uint32 // 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 // RespondPerEachOp defines for client.Operate() method, return a result for every operation. // Some list operations do not return results by default (ListClearOp() for example). // This can sometimes make it difficult to determine the desired result offset in the returned // bin's result list. // // Setting RespondPerEachOp to true makes it easier to identify the desired result offset // (result offset equals bin's operate sequence). This only makes sense when multiple list // operations are used in one operate call and some of those operations do not return results // by default. RespondPerEachOp bool // DurableDelete leaves a tombstone for the record if the transaction results in a record deletion. // This prevents deleted records from reappearing after node failures. // Valid for Aerospike Server Enterprise Edition 4+ only. DurableDelete bool }
WritePolicy encapsulates parameters for policy attributes used in write operations. This object is passed into methods where database writes can occur.
func NewWritePolicy ¶
func NewWritePolicy(generation, expiration uint32) *WritePolicy
NewWritePolicy initializes a new WritePolicy instance with default parameters.
Source Files ¶
- admin_command.go
- admin_policy.go
- aerospike.go
- batch_command.go
- batch_command_exists.go
- batch_command_get.go
- batch_command_reflect.go
- batch_node.go
- bin.go
- bytes_buffer.go
- cdt_list.go
- cdt_map.go
- client.go
- client_policy.go
- client_reflect.go
- cluster.go
- command.go
- commit_policy.go
- connection.go
- consistency_level.go
- delete_command.go
- execute_command.go
- execute_task.go
- exists_command.go
- field_type.go
- filter.go
- generation_policy.go
- host.go
- index_collection_type.go
- index_type.go
- info.go
- key.go
- key_helper.go
- language.go
- large_list.go
- large_map.go
- large_object.go
- large_set.go
- large_stack.go
- marshal.go
- multi_policy.go
- node.go
- node_error.go
- node_validator.go
- operate_command.go
- operation.go
- packer.go
- packer_reflect.go
- partition.go
- partition_parser.go
- peers.go
- peers_parser.go
- policy.go
- priority.go
- query_aggregate_command.go
- query_command.go
- query_objects_command.go
- query_policy.go
- query_record_command.go
- read_command.go
- read_command_reflect.go
- read_header_command.go
- record.go
- record_exists_action.go
- recordset.go
- replica_policy.go
- role.go
- scan_command.go
- scan_objects_command.go
- scan_policy.go
- server_command.go
- single_command.go
- statement.go
- task.go
- task_drop_index.go
- task_index.go
- task_register.go
- task_remove.go
- touch_command.go
- udf.go
- unpacker.go
- user_roles.go
- value.go
- value_helpers.go
- value_reflect.go
- write_command.go
- write_policy.go