aerospike-client-go: github.com/aerospike/aerospike-client-go Index | Examples | Files | Directories

package aerospike

import "github.com/aerospike/aerospike-client-go"

Index

Examples

Package Files

admin_command.go admin_policy.go aerospike.go auth_mode.go batch_command.go batch_command_exists.go batch_command_get.go batch_command_get_reflect.go batch_command_reflect.go batch_index_command_get.go batch_node.go batch_policy.go batch_read.go bin.go bytes_buffer.go cdt.go cdt_list.go cdt_map.go client.go client_appengine_exclusions.go client_policy.go client_reflect.go cluster.go command.go commit_policy.go compat_after_go1.8.go connection.go connection_heap.go consistency_level.go delete_command.go execute_command.go execute_task.go exists_command.go field_type.go filter.go generation_policy.go generics.go host.go index_collection_type.go index_type.go info.go key.go key_helper.go language.go login_command.go marshal.go multi_policy.go node.go node_error.go node_stats.go node_validator.go operate_command.go operation.go packer.go packer_reflect.go partition.go partition_parser.go partitions.go peers.go peers_parser.go policy.go predexp.go priority.go privilege.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

Constants

const (
    ListSortFlagsDefault        = 0
    ListSortFlagsDropDuplicates = 2
)
const (
    // ListWriteFlagsDefault is the default behavior. It means:  Allow duplicate values and insertions at any index.
    ListWriteFlagsDefault = 0
    // ListWriteFlagsAddUnique means: Only add unique values.
    ListWriteFlagsAddUnique = 1
    // ListWriteFlagsInsertBounded means: Enforce list boundaries when inserting.  Do not allow values to be inserted
    // at index outside current list boundaries.
    ListWriteFlagsInsertBounded = 2
    // ListWriteFlagsNoFail means: do not raise error if a list item fails due to write flag constraints.
    ListWriteFlagsNoFail = 4
    // ListWriteFlagsPartial means: allow other valid list items to be committed if a list item fails due to
    // write flag constraints.
    ListWriteFlagsPartial = 8
)
const (
    // MapWriteFlagsDefault is the Default. Allow create or update.
    MapWriteFlagsDefault = 0

    // MapWriteFlagsCreateOnly means: If the key already exists, the item will be denied.
    // If the key does not exist, a new item will be created.
    MapWriteFlagsCreateOnly = 1

    // MapWriteFlagsUpdateOnly means: If the key already exists, the item will be overwritten.
    // If the key does not exist, the item will be denied.
    MapWriteFlagsUpdateOnly = 2

    // MapWriteFlagsNoFail means: Do not raise error if a map item is denied due to write flag constraints.
    MapWriteFlagsNoFail = 4

    // MapWriteFlagsNoFail means: Allow other valid map items to be committed if a map item is denied due to
    // write flag constraints.
    MapWriteFlagsPartial = 8
)

*

* Map write bit flags.
* Requires server versions >= 4.3.
const (
    // CONSISTENCY_ONE indicates that only master should be invloved in the read operation.
    CONSISTENCY_ONE = iota

    // CONSISTENCY_ALL indicates that all duplicates should be consulted in
    // the read operation.
    CONSISTENCY_ALL
)
const (
    // UserAdmin allows to manages users and their roles.
    UserAdmin privilegeCode = "user-admin"

    // SysAdmin allows to manage indexes, user defined functions and server configuration.
    SysAdmin privilegeCode = "sys-admin"

    // DataAdmin allows to manage indicies and user defined functions.
    DataAdmin privilegeCode = "data-admin"

    // ReadWriteUDF allows read, write and UDF transactions with the database.
    ReadWriteUDF privilegeCode = "read-write-udf"

    // ReadWrite allows read and write transactions with the database.
    ReadWrite privilegeCode = "read-write"

    // Read allows read transactions with the database.
    Read privilegeCode = "read"
)

Pre-defined user roles.

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
)
const DefaultBufferSize = 64 * 1024 // 64 KiB

DefaultBufferSize specifies the initial size of the connection buffer when it is created. If not big enough (as big as the average record), it will be reallocated to size again which will be more expensive.

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

    // Invert meaning of map command and return values.  For example:
    // MapRemoveByKeyRange(binName, keyBegin, keyEnd, MapReturnType.KEY | MapReturnType.INVERTED)
    // With the INVERTED flag enabled, the keys outside of the specified key range will be removed and returned.
    INVERTED mapReturnType
}{
    0, 1, 2, 3, 4, 5, 6, 7, 8, 0x10000,
}

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},
}

MapWriteMode should only be used for server versions < 4.3. MapWriteFlags are recommended for server versions >= 4.3.

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
)

func NewPredExpAnd Uses

func NewPredExpAnd(nexpr uint16) *predExpAnd

NewPredExpAnd creates an AND predicate. Argument describes the number of expressions.

func NewPredExpGeoJSONBin Uses

func NewPredExpGeoJSONBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is GeoJSON.

func NewPredExpGeoJSONContains Uses

func NewPredExpGeoJSONContains() *predExpCompare

NewPredExpGeoJSONContains creates Region Contains predicate for GeoJSON values

func NewPredExpGeoJSONValue Uses

func NewPredExpGeoJSONValue(val string) *predExpGeoJSONValue

NewPredExpGeoJSONValue embeds a GeoJSON value in a predicate expression.

func NewPredExpGeoJSONVar Uses

func NewPredExpGeoJSONVar(name string) *predExpVar

NewPredExpGeoJSONVar creates GeoJSON variable used in list/map iterations.

func NewPredExpGeoJSONWithin Uses

func NewPredExpGeoJSONWithin() *predExpCompare

NewPredExpGeoJSONWithin creates Within Region predicate for GeoJSON values

func NewPredExpIntegerBin Uses

func NewPredExpIntegerBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is integer.

func NewPredExpIntegerEqual Uses

func NewPredExpIntegerEqual() *predExpCompare

NewPredExpIntegerEqual creates Equal predicate for integer values

func NewPredExpIntegerGreater Uses

func NewPredExpIntegerGreater() *predExpCompare

NewPredExpIntegerGreater creates Greater Than predicate for integer values

func NewPredExpIntegerGreaterEq Uses

func NewPredExpIntegerGreaterEq() *predExpCompare

NewPredExpIntegerGreaterEq creates Greater Than Or Equal predicate for integer values

func NewPredExpIntegerLess Uses

func NewPredExpIntegerLess() *predExpCompare

NewPredExpIntegerLess creates Less Than predicate for integer values

func NewPredExpIntegerLessEq Uses

func NewPredExpIntegerLessEq() *predExpCompare

NewPredExpIntegerLessEq creates Less Than Or Equal predicate for integer values

func NewPredExpIntegerUnequal Uses

func NewPredExpIntegerUnequal() *predExpCompare

NewPredExpIntegerUnequal creates NotEqual predicate for integer values

func NewPredExpIntegerValue Uses

func NewPredExpIntegerValue(val int64) *predExpIntegerValue

NewPredExpIntegerValue embeds an int64 value in a predicate expression.

func NewPredExpIntegerVar Uses

func NewPredExpIntegerVar(name string) *predExpVar

NewPredExpIntegerVar creates 64 bit integer variable used in list/map iterations.

func NewPredExpListBin Uses

func NewPredExpListBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is List.

func NewPredExpListIterateAnd Uses

func NewPredExpListIterateAnd(name string) *predExpIter

NewPredExpListIterateAnd creates an And iterator predicate for list items

func NewPredExpListIterateOr Uses

func NewPredExpListIterateOr(name string) *predExpIter

NewPredExpListIterateOr creates an Or iterator predicate for list items

func NewPredExpMapBin Uses

func NewPredExpMapBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is Map.

func NewPredExpMapKeyIterateAnd Uses

func NewPredExpMapKeyIterateAnd(name string) *predExpIter

NewPredExpMapKeyIterateAnd creates an And iterator predicate on map keys

func NewPredExpMapKeyIterateOr Uses

func NewPredExpMapKeyIterateOr(name string) *predExpIter

NewPredExpMapKeyIterateOr creates an Or iterator predicate on map keys

func NewPredExpMapValIterateAnd Uses

func NewPredExpMapValIterateAnd(name string) *predExpIter

NewPredExpMapKeyIterateAnd creates an And iterator predicate on map values

func NewPredExpMapValIterateOr Uses

func NewPredExpMapValIterateOr(name string) *predExpIter

NewPredExpMapValIterateOr creates an Or iterator predicate on map values

func NewPredExpNot Uses

func NewPredExpNot() *predExpNot

NewPredExpNot creates a NOT predicate

func NewPredExpOr Uses

func NewPredExpOr(nexpr uint16) *predExpOr

NewPredExpOr creates an OR predicate. Argument describes the number of expressions.

func NewPredExpRecDeviceSize Uses

func NewPredExpRecDeviceSize() *predExpMD

NewPredExpRecDeviceSize creates record size on disk predicate

func NewPredExpRecDigestModulo Uses

func NewPredExpRecDigestModulo(mod int32) *predExpMDDigestModulo

NewPredExpRecDigestModulo creates a digest modulo record metadata value predicate expression. The digest modulo expression assumes the value of 4 bytes of the record's key digest modulo as its argument. This predicate is available in Aerospike server versions 3.12.1+

For example, the following sequence of predicate expressions selects records that have digest(key) % 3 == 1): stmt.SetPredExp(

NewPredExpRecDigestModulo(3),
NewPredExpIntegerValue(1),
NewPredExpIntegerEqual(),

)

func NewPredExpRecLastUpdate Uses

func NewPredExpRecLastUpdate() *predExpMD

NewPredExpRecLastUpdate creates record last update predicate

func NewPredExpRecVoidTime Uses

func NewPredExpRecVoidTime() *predExpMD

NewPredExpRecVoidTime creates record expiration time predicate expressed in nanoseconds since 1970-01-01 epoch as 64 bit integer.

func NewPredExpStringBin Uses

func NewPredExpStringBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is String.

func NewPredExpStringEqual Uses

func NewPredExpStringEqual() *predExpCompare

NewPredExpStringEqual creates Equal predicate for string values

func NewPredExpStringRegex Uses

func NewPredExpStringRegex(cflags uint32) *predExpStringRegex

NewPredExpStringRegex creates a Regex predicate

func NewPredExpStringUnequal Uses

func NewPredExpStringUnequal() *predExpCompare

NewPredExpStringUnequal creates Not Equal predicate for string values

func NewPredExpStringValue Uses

func NewPredExpStringValue(val string) *predExpStringValue

NewPredExpStringValue embeds a string value in a predicate expression.

func NewPredExpStringVar Uses

func NewPredExpStringVar(name string) *predExpVar

NewPredExpStringVar creates string variable used in list/map iterations.

func NewPredExpUnknownBin Uses

func NewPredExpUnknownBin(name string) *predExpBin

NewPredExpUnknownBin creates a Bin predicate expression which its type is not known.

func PackBool Uses

func PackBool(cmd BufferEx, val bool) (int, error)

Pack bool packs a bool value

func PackBytes Uses

func PackBytes(cmd BufferEx, b []byte) (int, error)

PackBytes backs a byte array

func PackFloat32 Uses

func PackFloat32(cmd BufferEx, val float32) (int, error)

PackFloat32 packs float32 value

func PackFloat64 Uses

func PackFloat64(cmd BufferEx, val float64) (int, error)

PackFloat64 packs float64 value

func PackInt64 Uses

func PackInt64(cmd BufferEx, val int64) (int, error)

PackInt64 packs an int64

func PackJson Uses

func PackJson(cmd BufferEx, theMap map[string]interface{}) (int, error)

PackJson packs json data

func PackList Uses

func PackList(cmd BufferEx, list ListIter) (int, error)

PackList packs any slice that implement the ListIter interface

func PackMap Uses

func PackMap(cmd BufferEx, theMap MapIter) (int, error)

PackMap packs any map that implements the MapIter interface

func PackNil Uses

func PackNil(cmd BufferEx) (int, error)

Pack nil packs a nil value

func PackString Uses

func PackString(cmd BufferEx, val string) (int, error)

PackString packs a string

func PackUInt64 Uses

func PackUInt64(cmd BufferEx, val uint64) (int, error)

PackUInt64 packs a uint64

func RequestInfo Uses

func RequestInfo(conn *Connection, names ...string) (map[string]string, error)

RequestInfo gets info values by name from the specified connection.

func RequestNodeInfo Uses

func RequestNodeInfo(node *Node, name ...string) (map[string]string, error)

RequestNodeInfo gets info values by name from the specified database server node.

func RequestNodeStats Uses

func RequestNodeStats(node *Node) (map[string]string, error)

RequestNodeStats returns statistics for the specified node as a map

func SetAerospikeTag Uses

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 Uses

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 Uses

func SetLuaPath(lpath string)

SetLuaPath sets the Lua interpreter path to files This path is used to load UDFs for QueryAggregate command

type AdminPolicy Uses

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 Uses

func NewAdminPolicy() *AdminPolicy

NewAdminPolicy generates a new AdminPolicy with default values.

type AerospikeBlob Uses

type AerospikeBlob interface {
    // EncodeBlob returns a byte slice representing the encoding of the
    // receiver for transmission to a Decoder, usually of the same
    // concrete type.
    EncodeBlob() ([]byte, error)
}

type AuthMode Uses

type AuthMode int

AuthMode determines authentication mode when user/password is defined.

const (
    // AuthModeInternal uses internal authentication only.  Hashed password is stored on the server.
    // Do not send clear password. This is the default.
    AuthModeInternal AuthMode = iota

    // AuthModeExternal uses external authentication (like LDAP).  Specific external authentication is
    // configured on server.  If TLSConfig is defined, sends clear password on node login via TLS.
    // Will return an error if TLSConfig is not defined.
    AuthModeExternal
)

type BasePolicy Uses

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 total transaction timeout.
    //
    // The Timeout is tracked on the client and also sent to the server along
    // with the transaction in the wire protocol. The client will most likely
    // timeout first, but the server has the capability to Timeout the transaction.
    //
    // If Timeout is not zero and Timeout is reached before the transaction
    // completes, the transaction will abort with Timeout error.
    //
    // If Timeout is zero, there will be no time limit and the transaction will retry
    // on network timeouts/errors until MaxRetries is exceeded. If MaxRetries is exceeded, the
    // transaction also aborts with Timeout error.
    //
    // Default: 0 (no time limit and rely on MaxRetries).
    Timeout time.Duration

    // SocketTimeout determines network timeout for each attempt.
    //
    // If SocketTimeout is not zero and SocketTimeout is reached before an attempt completes,
    // the Timeout above is checked. If Timeout is not exceeded, the transaction
    // is retried. If both SocketTimeout and Timeout are non-zero, SocketTimeout must be less
    // than or equal to Timeout.
    //
    // If SocketTimeout is zero, there will be no time limit per attempt. If the transaction
    // fails on a network error, the Timeout still applies.
    //
    // Default: 0 (no SocketTimeout for each attempt).
    SocketTimeout time.Duration

    // MaxRetries determines the maximum number of retries before aborting the current transaction.
    // The initial attempt is not counted as a retry.
    //
    // If MaxRetries is exceeded, the transaction will abort with an error.
    //
    // WARNING: Database writes that are not idempotent (such as AddOp)
    // should not be retried because the write operation may be performed
    // multiple times if the client timed out previous transaction attempts.
    // It's important to use a distinct WritePolicy for non-idempotent
    // writes which sets maxRetries = 0;
    //
    // Default for read: 2 (initial attempt + 2 retries = 3 attempts)
    //
    // Default for write/query/scan: 0 (no retries)
    MaxRetries int //= 2;

    // SleepBetweenRtries determines the duration to sleep between retries.  Enter zero to skip sleep.
    // This field is ignored when maxRetries is zero.
    // This field is also ignored in async mode.
    //
    // The sleep only occurs on connection errors and server timeouts
    // which suggest a node is down and the cluster is reforming.
    // The sleep does not occur when the client's socketTimeout expires.
    //
    // Reads do not have to sleep when a node goes down because the cluster
    // does not shut out reads during cluster reformation.  The default for
    // reads is zero.
    //
    // The default for writes is also zero because writes are not retried by default.
    // Writes need to wait for the cluster to reform when a node goes down.
    // Immediate write retries on node failure have been shown to consistently
    // result in errors.  If maxRetries is greater than zero on a write, then
    // sleepBetweenRetries should be set high enough to allow the cluster to
    // reform (>= 500ms).
    SleepBetweenRetries time.Duration //= 1ms;

    // SleepMultiplier specifies the multiplying factor to be used for exponential backoff during retries.
    // Default to (1.0); Only values greater than 1 are valid.
    SleepMultiplier float64 //= 1.0;

    // SendKey determines to whether send user defined key in addition to hash digest on both reads and writes.
    // If the key is sent on a write, the key will be stored with the record on
    // the server.
    // The default is to not send the user defined key.
    SendKey bool // = false

    // Force reads to be linearized for server namespaces that support CP mode.
    // The default is false.
    LinearizeRead bool

    // ReplicaPolicy determines the node to 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.
    // Batch, scan and query are also not affected by replica algorithms.
    // 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 Uses

func NewPolicy() *BasePolicy

NewPolicy generates a new BasePolicy instance with default values.

func (*BasePolicy) GetBasePolicy Uses

func (p *BasePolicy) GetBasePolicy() *BasePolicy

GetBasePolicy returns embedded BasePolicy in all types that embed this struct.

type BatchPolicy Uses

type BatchPolicy struct {
    BasePolicy

    // Maximum number of concurrent batch request goroutines to server nodes at any point in time.
    // If there are 16 node/namespace combinations requested and ConcurrentNodes is 8,
    // then batch requests will be made for 8 node/namespace combinations in concurrent goroutines.
    // When a request completes, a new request will be issued until all 16 goroutines are complete.
    //
    // Values:
    // 1: Issue batch requests sequentially.  This mode has a performance advantage for small
    // to medium sized batch sizes because requests can be issued in the main transaction goroutine.
    // This is the default.
    // 0: Issue all batch requests in concurrent goroutines.  This mode has a performance
    // advantage for extremely large batch sizes because each node can process the request
    // immediately.  The downside is extra goroutines will need to be created (or taken from
    // a goroutine pool).
    // > 0: Issue up to ConcurrentNodes batch requests in concurrent goroutines.  When a request
    // completes, a new request will be issued until all goroutines are complete.  This mode
    // prevents too many concurrent goroutines being created for large cluster implementations.
    // The downside is extra goroutines will still need to be created (or taken from a goroutine pool).
    ConcurrentNodes int // = 1

    // Use old batch direct protocol where batch reads are handled by direct low-level batch server
    // database routines.  The batch direct protocol can be faster when there is a single namespace,
    // but there is one important drawback.  The batch direct protocol will not proxy to a different
    // server node when the mapped node has migrated a record to another node (resulting in not
    // found record).
    //
    // This can happen after a node has been added/removed from the cluster and there is a lag
    // between records being migrated and client partition map update (once per second).
    //
    // The new batch index protocol will perform this record proxy when necessary.
    UseBatchDirect bool // = false

    // Allow batch to be processed immediately in the server's receiving thread when the server
    // deems it to be appropriate.  If false, the batch will always be processed in separate
    // transaction goroutines.  This field is only relevant for the new batch index protocol.
    //
    // For batch exists or batch reads of smaller sized records (<= 1K per record), inline
    // processing will be significantly faster on "in memory" namespaces.  The server disables
    // inline processing on disk based namespaces regardless of this policy field.
    //
    // Inline processing can introduce the possibility of unfairness because the server
    // can process the entire batch before moving onto the next command.
    AllowInline bool //= true

    // AllowPartialResults determines if the results for some nodes should be returned in case
    // some nodes encounter an error. The result for the unreceived records will be nil.
    // The returned records will be safe to use, since only fully received data will be parsed
    // and set.
    //
    // This flag is only supported for BatchGet and BatchGetHeader methods. BatchGetComplex always returns
    // partial results by design.
    AllowPartialResults bool //= false

    // Send set name field to server for every key in the batch for batch index protocol.
    // This is only necessary when authentication is enabled and security roles are defined
    // on a per set basis.
    SendSetName bool //= false
}

BatchPolicy encapsulates parameters for policy attributes used in write operations. This object is passed into methods where database writes can occur.

func NewBatchPolicy Uses

func NewBatchPolicy() *BatchPolicy

NewBatchPolicy initializes a new BatchPolicy instance with default parameters.

type BatchRead Uses

type BatchRead struct {
    // Key specifies the key to retrieve.
    Key *Key

    // BinNames specifies the Bins to retrieve for this key.
    BinNames []string

    // ReadAllBins defines what data should be read from the record.
    // If true, ignore binNames and read all bins.
    // If false and binNames are set, read specified binNames.
    // If false and binNames are not set, read record header (generation, expiration) only.
    ReadAllBins bool //= false

    // Record result after batch command has completed.  Will be null if record was not found.
    Record *Record
}

BatchRead specifies the Key and bin names used in batch read commands where variable bins are needed for each key.

func NewBatchRead Uses

func NewBatchRead(key *Key, binNames []string) *BatchRead

NewBatchRead defines a key and bins to retrieve in a batch operation.

func NewBatchReadHeader Uses

func NewBatchReadHeader(key *Key) *BatchRead

NewBatchRead defines a key to retrieve the record headers only in a batch operation.

func (*BatchRead) String Uses

func (br *BatchRead) String() string

String implements the Stringer interface.

type Bin Uses

type Bin struct {
    // Bin name. Current limit is 14 characters.
    Name string

    // Bin value.
    Value Value
}

Bin encapsulates a field name/value pair.

func NewBin Uses

func NewBin(name string, value interface{}) *Bin

NewBin generates a new Bin instance, specifying bin name and string value. For servers configured as "single-bin", enter an empty name.

func (*Bin) String Uses

func (bn *Bin) String() string

String implements Stringer interface.

type BinMap Uses

type BinMap map[string]interface{}

BinMap is used to define a map of bin names to values.

type BufferEx Uses

type BufferEx interface {
    WriteInt64(num int64) (int, error)
    WriteUint64(num uint64) (int, error)
    WriteInt32(num int32) (int, error)
    WriteUint32(num uint32) (int, error)
    WriteInt16(num int16) (int, error)
    WriteUint16(num uint16) (int, error)
    WriteFloat32(float float32) (int, error)
    WriteFloat64(float float64) (int, error)
    WriteByte(b byte) error
    WriteString(s string) (int, error)
    Write(b []byte) (int, error)
}

BufferEx is a specialized buffer interface for aerospike client.

type BytesValue Uses

type BytesValue []byte

BytesValue encapsulates an array of bytes.

func NewBlobValue Uses

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 Uses

func NewBytesValue(bytes []byte) BytesValue

NewBytesValue generates a ByteValue instance.

func (BytesValue) GetObject Uses

func (vl BytesValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (BytesValue) GetType Uses

func (vl BytesValue) GetType() int

GetType returns wire protocol value type.

func (BytesValue) String Uses

func (vl BytesValue) String() string

String implements Stringer interface.

type Client Uses

type Client struct {

    // DefaultPolicy is used for all read commands without a specific policy.
    DefaultPolicy *BasePolicy
    // DefaultBatchPolicy is used for all batch commands without a specific policy.
    DefaultBatchPolicy *BatchPolicy
    // DefaultWritePolicy is used for all write commands without a specific policy.
    DefaultWritePolicy *WritePolicy
    // DefaultScanPolicy is used for all scan commands without a specific policy.
    DefaultScanPolicy *ScanPolicy
    // DefaultQueryPolicy is used for all query 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 NewClient Uses

func NewClient(hostname string, port int) (*Client, error)

NewClient generates a new Client instance.

func NewClientWithPolicy Uses

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 Uses

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 Uses

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.

Code:

key, err := as.NewKey("test", "test", "addkey")
if err != nil {
    log.Fatal(err)
}

if _, err = client.Delete(nil, key); err != nil {
    log.Fatal(err)
}

// Add to a non-existing record/bin, should create a record
bin := as.NewBin("bin", 10)
if err = client.AddBins(nil, key, bin); err != nil {
    log.Fatal(err)
}

// Add to 5 to the original 10
bin = as.NewBin("bin", 5)
if err = client.AddBins(nil, key, bin); err != nil {
    log.Fatal(err)
}

// Check the result
record, err := client.Get(nil, key, bin.Name)
if err != nil {
    log.Fatal(err)
}
fmt.Println(record.Bins["bin"])

// Demonstrate add and get combined.
bin = as.NewBin("bin", 30)
if record, err = client.Operate(nil, key, as.AddOp(bin), as.GetOp()); err != nil {
    log.Fatal(err)
}

fmt.Println(record.Bins["bin"])

Output:

15
45

func (*Client) AddBins Uses

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 Uses

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.

Code:

key, err := as.NewKey("test", "test", "appendkey")
if err != nil {
    log.Fatal(err)
}

if _, err = client.Delete(nil, key); err != nil {
    log.Fatal(err)
}

// Create by appending to non-existing value
bin1 := as.NewBin("myBin", "Hello")
if err = client.AppendBins(nil, key, bin1); err != nil {
    log.Fatal(err)
}

// Append World
bin2 := as.NewBin("myBin", " World")
if err = client.AppendBins(nil, key, bin2); err != nil {
    log.Fatal(err)
}

record, err := client.Get(nil, key)
if err != nil {
    log.Fatal(err)
}

fmt.Println(record.Bins["myBin"])

Output:

Hello World

func (*Client) AppendBins Uses

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 Uses

func (clnt *Client) BatchExists(policy *BatchPolicy, 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 Uses

func (clnt *Client) BatchGet(policy *BatchPolicy, 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) BatchGetComplex Uses

func (clnt *Client) BatchGetComplex(policy *BatchPolicy, records []*BatchRead) error

BatchGetComplex reads multiple records for specified batch keys in one batch call. This method allows different namespaces/bins to be requested for each key in the batch. The returned records are located in the same list. If the BatchRead key field is not found, the corresponding record field will be null. The policy can be used to specify timeouts and maximum concurrent threads. This method requires Aerospike Server version >= 3.6.0.

func (*Client) BatchGetHeader Uses

func (clnt *Client) BatchGetHeader(policy *BatchPolicy, 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) BatchGetObjects Uses

func (clnt *Client) BatchGetObjects(policy *BatchPolicy, keys []*Key, objects []interface{}) (found []bool, err error)

BatchGetObject reads multiple record headers and bins for specified keys in one batch request. The returned objects are in positional order with the original key array order. If a key is not found, the positional object will not change, and the positional found boolean will be false. The policy can be used to specify timeouts. If the policy is nil, the default relevant policy will be used.

func (*Client) ChangePassword Uses

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 Uses

func (clnt *Client) Close()

Close closes all client connections to database server nodes.

func (*Client) Cluster Uses

func (clnt *Client) Cluster() *Cluster

Cluster exposes the cluster object to the user

func (*Client) CreateComplexIndex Uses

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 Uses

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) CreateRole Uses

func (clnt *Client) CreateRole(policy *AdminPolicy, roleName string, privileges []Privilege) error

CreateRole creates a user-defined role.

func (*Client) CreateUser Uses

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 Uses

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 Uses

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) DropRole Uses

func (clnt *Client) DropRole(policy *AdminPolicy, roleName string) error

DropRole removes a user-defined role.

func (*Client) DropUser Uses

func (clnt *Client) DropUser(policy *AdminPolicy, user string) error

DropUser removes a user from the cluster.

func (*Client) Execute Uses

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 Uses

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) ExecuteUDFNode Uses

func (clnt *Client) ExecuteUDFNode(policy *QueryPolicy,
    node *Node,
    statement *Statement,
    packageName string,
    functionName string,
    functionArgs ...Value,
) (*ExecuteTask, error)

ExecuteUDFNode applies user defined function on records that match the statement filter on the specified node. 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 Uses

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 Uses

func (clnt *Client) Get(policy *BasePolicy, key *Key, binNames ...string) (*Record, error)

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 Uses

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) GetNodeNames Uses

func (clnt *Client) GetNodeNames() []string

GetNodeNames returns a list of active server node names in the cluster.

func (*Client) GetNodes Uses

func (clnt *Client) GetNodes() []*Node

GetNodes returns an array of active server nodes in the cluster.

func (*Client) GetObject Uses

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) GrantPrivileges Uses

func (clnt *Client) GrantPrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) error

GrantPrivileges grant privileges to a user-defined role.

func (*Client) GrantRoles Uses

func (clnt *Client) GrantRoles(policy *AdminPolicy, user string, roles []string) error

GrantRoles adds roles to user's list of roles.

func (*Client) IsConnected Uses

func (clnt *Client) IsConnected() bool

IsConnected determines if the client is ready to talk to the database server cluster.

func (*Client) ListUDF Uses

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 Uses

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.

If the policy is nil, the default relevant policy will be used.

func (*Client) Prepend Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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 Uses

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) QueryRole Uses

func (clnt *Client) QueryRole(policy *AdminPolicy, role string) (*Role, error)

QueryRole retrieves privileges for a given role.

func (*Client) QueryRoles Uses

func (clnt *Client) QueryRoles(policy *AdminPolicy) ([]*Role, error)

QueryRoles retrieves all roles and their privileges.

func (*Client) QueryUser Uses

func (clnt *Client) QueryUser(policy *AdminPolicy, user string) (*UserRoles, error)

QueryUser retrieves roles for a given user.

func (*Client) QueryUsers Uses

func (clnt *Client) QueryUsers(policy *AdminPolicy) ([]*UserRoles, error)

QueryUsers retrieves all users and their roles.

func (*Client) RegisterUDF Uses

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 Uses

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 Uses

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) RevokePrivileges Uses

func (clnt *Client) RevokePrivileges(policy *AdminPolicy, roleName string, privileges []Privilege) error

RevokePrivileges revokes privileges from a user-defined role.

func (*Client) RevokeRoles Uses

func (clnt *Client) RevokeRoles(policy *AdminPolicy, user string, roles []string) error

RevokeRoles removes roles from user's list of roles.

func (*Client) ScanAll Uses

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 Uses

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 Uses

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 Uses

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.

func (*Client) Stats Uses

func (clnt *Client) Stats() (map[string]interface{}, error)

Stats returns internal statistics regarding the inner state of the client and the cluster.

func (*Client) String Uses

func (clnt *Client) String() string

String implements the Stringer interface for client

func (*Client) Touch Uses

func (clnt *Client) Touch(policy *WritePolicy, key *Key) error

Touch updates a record's metadata. If the record exists, the record's TTL will be reset to the policy's expiration. If the record doesn't exist, it will return an error.

func (*Client) Truncate Uses

func (clnt *Client) Truncate(policy *WritePolicy, namespace, set string, beforeLastUpdate *time.Time) error

Truncate removes records in specified namespace/set efficiently. This method is many orders of magnitude faster than deleting records one at a time. Works with Aerospike Server versions >= 3.12. This asynchronous server call may return before the truncation is complete. The user can still write new records after the server call returns because new records will have last update times greater than the truncate cutoff (set at the time of truncate call). For more information, See https://www.aerospike.com/docs/reference/info#truncate

type ClientPolicy Uses

type ClientPolicy struct {
    // AuthMode specifies authentication mode used when user/password is defined. It is set to AuthModeInternal by default.
    AuthMode AuthMode

    // 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-name" info command. (v3.10+)
    ClusterName string //=""

    // Initial host connection timeout duration.  The timeout when opening a connection
    // to the server host for the first time.
    Timeout time.Duration //= 30 seconds

    // 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

    // LoginTimeout specifies the timeout for login operation for external authentication such as LDAP.
    LoginTimeout time.Duration //= 10 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

    // RackAware directs the client to update rack information on intervals.
    // When this feature is enabled, the client will prefer to use nodes which reside
    // on the same rack as the client for read transactions. The application should also set the RackId, and
    // use the ReplicaPolicy.PREFER_RACK for reads.
    // This feature is in particular useful if the cluster is in the cloud and the cloud provider
    // is charging for network bandwidth out of the zone. Keep in mind that the node on the same rack
    // may not be the Master, and as such the data may be stale. This setting is partucularly usable
    // for clusters that are read heavy.
    RackAware bool // false

    // RackId defines the Rack the application is on. This will only influence reads if Rackaware is enabled on the client,
    // and configured on the server.
    RackId int // 0

    // TlsConfig specifies TLS secure connection policy for TLS enabled servers.
    // For better performance, we suggest preferring the server-side ciphers by
    // setting PreferServerCipherSuites = true.
    TlsConfig *tls.Config //= nil

    // IgnoreOtherSubnetAliases helps to ignore aliases that are outside main subnet
    IgnoreOtherSubnetAliases bool //= false
}

ClientPolicy encapsulates parameters for client policy command.

func NewClientPolicy Uses

func NewClientPolicy() *ClientPolicy

NewClientPolicy generates a new ClientPolicy with default values.

func (*ClientPolicy) RequiresAuthentication Uses

func (cp *ClientPolicy) RequiresAuthentication() bool

RequiresAuthentication returns true if a USer or Password is set for ClientPolicy.

type Cluster Uses

type Cluster struct {
    // contains filtered or unexported fields
}

Cluster encapsulates the aerospike cluster nodes and manages them.

func NewCluster Uses

func NewCluster(policy *ClientPolicy, hosts []*Host) (*Cluster, error)

NewCluster generates a Cluster instance.

func (*Cluster) AddSeeds Uses

func (clstr *Cluster) AddSeeds(hosts []*Host)

AddSeeds adds new hosts to the cluster. They will be added to the cluster on next tend call.

func (*Cluster) ClientPolicy Uses

func (clstr *Cluster) ClientPolicy() (res ClientPolicy)

ClientPolicy returns the client policy that is currently used with the cluster.

func (*Cluster) Close Uses

func (clstr *Cluster) Close()

Close closes all cached connections to the cluster nodes and stops the tend goroutine.

func (*Cluster) GetAliases Uses

func (clstr *Cluster) GetAliases() map[Host]*Node

GetAliases returns a list of all node aliases in the cluster

func (*Cluster) GetNodeByName Uses

func (clstr *Cluster) GetNodeByName(nodeName string) (*Node, error)

GetNodeByName finds a node by name and returns an error if the node is not found.

func (*Cluster) GetNodes Uses

func (clstr *Cluster) GetNodes() []*Node

GetNodes returns a list of all nodes in the cluster

func (*Cluster) GetRandomNode Uses

func (clstr *Cluster) GetRandomNode() (*Node, error)

GetRandomNode returns a random node on the cluster

func (*Cluster) GetSeeds Uses

func (clstr *Cluster) GetSeeds() []Host

GetSeeds returns a list of all seed nodes in the cluster

func (*Cluster) IsConnected Uses

func (clstr *Cluster) IsConnected() bool

IsConnected returns true if cluster has nodes and is not already closed.

func (*Cluster) MigrationInProgress Uses

func (clstr *Cluster) MigrationInProgress(timeout time.Duration) (res bool, err error)

MigrationInProgress determines if any node in the cluster is participating in a data migration

func (*Cluster) Password Uses

func (clstr *Cluster) Password() (res []byte)

Password returns the password that is currently used with the cluster.

func (*Cluster) String Uses

func (clstr *Cluster) String() string

String implements the stringer interface

func (*Cluster) WaitUntillMigrationIsFinished Uses

func (clstr *Cluster) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)

WaitUntillMigrationIsFinished will block until all migration operations in the cluster all finished.

type CommitLevel Uses

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 Uses

type Connection struct {
    // contains filtered or unexported fields
}

Connection represents a connection with a timeout.

func NewConnection Uses

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 Uses

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 Uses

func (ctn *Connection) Authenticate(user string, password string) error

Authenticate will send authentication information to the server. Notice: This method does not support external authentication mechanisms like LDAP. This method is deprecated and will be removed in the future.

func (*Connection) Close Uses

func (ctn *Connection) Close()

Close closes the connection

func (*Connection) IsConnected Uses

func (ctn *Connection) IsConnected() bool

IsConnected returns true if the connection is not closed yet.

func (*Connection) Read Uses

func (ctn *Connection) Read(buf []byte, length int) (total int, err error)

Read reads from connection buffer to the provided slice.

func (*Connection) ReadN Uses

func (ctn *Connection) ReadN(buf io.Writer, length int64) (total int64, err error)

ReadN reads N bytes from connection buffer to the provided Writer.

func (*Connection) SetTimeout Uses

func (ctn *Connection) SetTimeout(timeout time.Duration) error

SetTimeout sets connection timeout for both read and write operations.

func (*Connection) Write Uses

func (ctn *Connection) Write(buf []byte) (total int, err error)

Write writes the slice to the connection buffer.

type ConsistencyLevel Uses

type ConsistencyLevel int

ConsistencyLevel indicates how duplicates should be consulted in a read operation. Only makes a difference during migrations and only applicable in AP mode.

type DropIndexTask Uses

type DropIndexTask struct {
    // contains filtered or unexported fields
}

DropIndexTask is used to poll for long running create index completion.

func NewDropIndexTask Uses

func NewDropIndexTask(cluster *Cluster, namespace string, indexName string) *DropIndexTask

NewDropIndexTask initializes a task with fields needed to query server nodes.

func (*DropIndexTask) IsDone Uses

func (tski *DropIndexTask) IsDone() (bool, error)

IsDone queries all nodes for task completion status.

func (*DropIndexTask) OnComplete Uses

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 Uses

type ExecuteTask struct {
    // contains filtered or unexported fields
}

ExecuteTask is used to poll for long running server execute job completion.

func NewExecuteTask Uses

func NewExecuteTask(cluster *Cluster, statement *Statement) *ExecuteTask

NewExecuteTask initializes task with fields needed to query server nodes.

func (*ExecuteTask) IsDone Uses

func (etsk *ExecuteTask) IsDone() (bool, error)

IsDone queries all nodes for task completion status.

func (*ExecuteTask) OnComplete Uses

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 Uses

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
    SCAN_TIMEOUT         FieldType = 9
    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
    BATCH_INDEX          FieldType = 41
    BATCH_INDEX_WITH_SET FieldType = 42
    PREDEXP              FieldType = 43
)

FieldType constants used in the Aerospike Wire Protocol.

type Filter Uses

type Filter struct {
    // contains filtered or unexported fields
}

Filter specifies a query filter definition.

func NewContainsFilter Uses

func NewContainsFilter(binName string, indexCollectionType IndexCollectionType, value interface{}) *Filter

NewContainsFilter creates a contains filter for query on collection index.

func NewContainsRangeFilter Uses

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 Uses

func NewEqualFilter(binName string, value interface{}) *Filter

NewEqualFilter creates a new equality filter instance for query.

func NewGeoRegionsContainingPointFilter Uses

func NewGeoRegionsContainingPointFilter(binName, point string) *Filter

NewGeoRegionsContainingPointFilter creates a geospatial "containing point" filter for query. Argument must be a valid GeoJSON point.

func NewGeoRegionsContainingPointForCollectionFilter Uses

func NewGeoRegionsContainingPointForCollectionFilter(binName string, collectionType IndexCollectionType, point string) *Filter

NewGeoRegionsContainingPointForCollectionFilter creates a geospatial "containing point" filter for query on collection index. Argument must be a valid GeoJSON point.

func NewGeoWithinRadiusFilter Uses

func NewGeoWithinRadiusFilter(binName string, lng, lat, radius float64) *Filter

NewGeoWithinRadiusFilter creates a geospatial "within radius" filter for query. Arguments must be valid longitude/latitude/radius (meters) values.

func NewGeoWithinRadiusForCollectionFilter Uses

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 Uses

func NewGeoWithinRegionFilter(binName, region string) *Filter

NewGeoWithinRegionFilter creates a geospatial "within region" filter for query. Argument must be a valid GeoJSON region.

func NewGeoWithinRegionForCollectionFilter Uses

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 Uses

func NewRangeFilter(binName string, begin int64, end int64) *Filter

NewRangeFilter creates a range filter for query. Range arguments must be int64 values. String ranges are not supported.

func (*Filter) IndexCollectionType Uses

func (fltr *Filter) IndexCollectionType() IndexCollectionType

IndexType return filter's index type.

type FloatValue Uses

type FloatValue float64

FloatValue encapsulates an float64 value.

func NewFloatValue Uses

func NewFloatValue(value float64) FloatValue

NewFloatValue generates a FloatValue instance.

func (FloatValue) GetObject Uses

func (vl FloatValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (FloatValue) GetType Uses

func (vl FloatValue) GetType() int

GetType returns wire protocol value type.

func (FloatValue) String Uses

func (vl FloatValue) String() string

String implements Stringer interface.

type GenerationPolicy Uses

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 Uses

type GeoJSONValue string

GeoJSONValue encapsulates a 2D Geo point. Supported by Aerospike 3.6.1 servers only.

func NewGeoJSONValue Uses

func NewGeoJSONValue(value string) GeoJSONValue

NewMapValue generates a GeoJSONValue instance.

func (GeoJSONValue) GetObject Uses

func (vl GeoJSONValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (GeoJSONValue) GetType Uses

func (vl GeoJSONValue) GetType() int

GetType returns wire protocol value type.

func (GeoJSONValue) String Uses

func (vl GeoJSONValue) String() string

String implements Stringer interface.

type Host Uses

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.

func NewHost Uses

func NewHost(name string, port int) *Host

NewHost initializes new host instance.

func (*Host) String Uses

func (h *Host) String() string

Implements stringer interface

type IndexCollectionType Uses

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 Uses

type IndexTask struct {
    // contains filtered or unexported fields
}

IndexTask is used to poll for long running create index completion.

func NewIndexTask Uses

func NewIndexTask(cluster *Cluster, namespace string, indexName string) *IndexTask

NewIndexTask initializes a task with fields needed to query server nodes.

func (*IndexTask) IsDone Uses

func (tski *IndexTask) IsDone() (bool, error)

IsDone queries all nodes for task completion status.

func (*IndexTask) OnComplete Uses

func (tski *IndexTask) 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 IndexType Uses

type IndexType string

IndexType the type of the secondary index.

const (
    // NUMERIC specifies an index on numeric values.
    NUMERIC IndexType = "NUMERIC"

    // STRING specifies an index on string values.
    STRING IndexType = "STRING"

    // 2-dimensional spherical geospatial index.
    GEO2DSPHERE IndexType = "GEO2DSPHERE"
)

type IntegerValue Uses

type IntegerValue int

IntegerValue encapsulates an integer value.

func NewIntegerValue Uses

func NewIntegerValue(value int) IntegerValue

NewIntegerValue generates an IntegerValue instance.

func (IntegerValue) GetObject Uses

func (vl IntegerValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (IntegerValue) GetType Uses

func (vl IntegerValue) GetType() int

GetType returns wire protocol value type.

func (IntegerValue) String Uses

func (vl IntegerValue) String() string

String implements Stringer interface.

type JsonValue Uses

type JsonValue map[string]interface{}

JsonValue encapsulates a Json map. Supported by Aerospike 3 servers only.

func NewJsonValue Uses

func NewJsonValue(vmap map[string]interface{}) JsonValue

NewMapValue generates a JsonValue instance.

func (JsonValue) GetObject Uses

func (vl JsonValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (JsonValue) GetType Uses

func (vl JsonValue) GetType() int

GetType returns wire protocol value type.

func (JsonValue) String Uses

func (vl JsonValue) String() string

type Key Uses

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 Uses

func NewKey(namespace string, setName string, key interface{}) (*Key, error)

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 Uses

func NewKeyWithDigest(namespace string, setName string, key interface{}, digest []byte) (*Key, error)

NewKeyWithDigest initializes a key from namespace, optional set name and user key. The server handles record identifiers by digest only.

func (*Key) Digest Uses

func (ky *Key) Digest() []byte

Digest returns key digest.

func (*Key) Equals Uses

func (ky *Key) Equals(other *Key) bool

Equals uses key digests to compare key equality.

func (*Key) Namespace Uses

func (ky *Key) Namespace() string

Namespace returns key's namespace.

func (*Key) SetDigest Uses

func (ky *Key) SetDigest(digest []byte) error

SetDigest sets a custom hash

func (*Key) SetName Uses

func (ky *Key) SetName() string

SetName returns key's set name.

func (*Key) SetValue Uses

func (ky *Key) SetValue(val Value) error

SetValue sets the Key's value and recompute's its digest without allocating new memory. This allows the keys to be reusable.

func (*Key) String Uses

func (ky *Key) String() string

String implements Stringer interface and returns string representation of key.

func (*Key) Value Uses

func (ky *Key) Value() Value

Value returns key's value.

type Language Uses

type Language string

Language specifies User defined function languages.

const (

    // LUA embedded programming language.
    LUA Language = "LUA"
)

type ListIter Uses

type ListIter interface {
    PackList(buf BufferEx) (int, error)
    Len() int
}

ListIter allows to define general maps of your own type to be used in the Go client without the use of reflection. function PackList should be exactly Like the following (Do not change, just copy/paste and adapt PackXXX methods): func (cs *CustomSlice) PackList(buf aerospike.BufferEx) (int, error) {

size := 0
for _, elem := range cs {
	n, err := PackXXX(buf, elem)
	size += n
	if err != nil {
		return size, err
	}
}
return size, nil

}

Code:

package main

import (
    "fmt"
    "log"

    as "github.com/aerospike/aerospike-client-go"
)

/*
	myListInt
*/
var _ as.ListIter = myListInt([]int{})

// your custom list
type myListInt []int

func (ml myListInt) PackList(buf as.BufferEx) (int, error) {
    size := 0
    for _, elem := range ml {
        n, err := as.PackInt64(buf, int64(elem))
        size += n
        if err != nil {
            return size, err
        }
    }

    return size, nil
}

func (ml myListInt) Len() int {
    return len(ml)
}

func main() {
    // Setup the client here
    // client, err := as.NewClient("127.0.0.1", 3000)
    // if err != nil {
    // 	log.Fatal(err)
    // }

    var v as.Value = as.NewValue(myListInt([]int{1, 2, 3}))
    key, err := as.NewKey("test", "test", 1)
    if err != nil {
        log.Fatal(err)
    }

    err = client.Put(nil, key, as.BinMap{"myBin": v})
    if err != nil {
        log.Fatal(err)
    }

    rec, err := client.Get(nil, key)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(rec.Bins["myBin"])
}

Code:

package main

import (
    "fmt"
    "log"

    as "github.com/aerospike/aerospike-client-go"
)

/*
	myListString
*/
var _ as.ListIter = myListString([]string{})

// your custom list
type myListString []string

func (ml myListString) PackList(buf as.BufferEx) (int, error) {
    size := 0
    for _, elem := range ml {
        n, err := as.PackString(buf, elem)
        size += n
        if err != nil {
            return size, err
        }
    }
    return size, nil
}

func (ml myListString) Len() int {
    return len(ml)
}

func main() {
    // Setup the client here
    // client, err := as.NewClient("127.0.0.1", 3000)
    // if err != nil {
    // 	log.Fatal(err)
    // }

    var v as.Value = as.NewValue(myListString([]string{"a", "b", "c"}))
    key, err := as.NewKey("test", "test", 1)
    if err != nil {
        log.Fatal(err)
    }

    err = client.Put(nil, key, as.BinMap{"myBin": v})
    if err != nil {
        log.Fatal(err)
    }

    rec, err := client.Get(nil, key)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(rec.Bins["myBin"])
}

Code:

package main

import (
    "fmt"
    "log"
    "time"

    as "github.com/aerospike/aerospike-client-go"
)

/*
	myListTime
*/
var _ as.ListIter = myListTime([]time.Time{})

// your custom list
type myListTime []time.Time

func (ml myListTime) PackList(buf as.BufferEx) (int, error) {
    size := 0
    for _, elem := range ml {
        n, err := as.PackInt64(buf, elem.UnixNano())
        size += n
        if err != nil {
            return size, err
        }
    }
    return size, nil
}

func (ml myListTime) Len() int {
    return len(ml)
}

func main() {
    // Setup the client here
    // client, err := as.NewClient("127.0.0.1", 3000)
    // if err != nil {
    // 	log.Fatal(err)
    // }

    now1 := time.Unix(123123123, 0)
    now2 := time.Unix(123123124, 0)
    now3 := time.Unix(123123125, 0)
    var v as.Value = as.NewValue(myListTime([]time.Time{now1, now2, now3}))
    key, err := as.NewKey("test", "test", 1)
    if err != nil {
        log.Fatal(err)
    }

    err = client.Put(nil, key, as.BinMap{"myBin": v})
    if err != nil {
        log.Fatal(err)
    }

    rec, err := client.Get(nil, key)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(rec.Bins["myBin"])
}

type ListOrderType Uses

type ListOrderType int
const (
    // ListOrderUnordered signifies that list is not ordered. This is the default.
    ListOrderUnordered ListOrderType = 0

    // ListOrderOrdered signifies that list is Ordered.
    ListOrderOrdered ListOrderType = 1
)

Map storage order.

type ListPolicy Uses

type ListPolicy struct {
    // contains filtered or unexported fields
}

ListPolicy directives when creating a list and writing list items.

func DefaultListPolicy Uses

func DefaultListPolicy() *ListPolicy

func NewListPolicy Uses

func NewListPolicy(order ListOrderType, flags int) *ListPolicy

Create unique key map with specified order when map does not exist. Use specified write mode when writing map items.

type ListReturnType Uses

type ListReturnType int
const (
    // Do not return a result.
    ListReturnTypeNone ListReturnType = 0

    // Return index offset order.
    // 0 = first key
    // N = Nth key
    // -1 = last key
    ListReturnTypeIndex ListReturnType = 1

    // Return reverse index offset order.
    // 0 = last key
    // -1 = first key
    ListReturnTypeReverseIndex ListReturnType = 2

    // Return value order.
    // 0 = smallest value
    // N = Nth smallest value
    // -1 = largest value
    ListReturnTypeRank ListReturnType = 3

    // Return reserve value order.
    // 0 = largest value
    // N = Nth largest value
    // -1 = smallest value
    ListReturnTypeReverseRank ListReturnType = 4

    // Return count of items selected.
    ListReturnTypeCount ListReturnType = 5

    // Return value for single key read and value list for range read.
    ListReturnTypeValue ListReturnType = 7

    // Invert meaning of list command and return values.  For example:
    // ListOperation.getByIndexRange(binName, index, count, ListReturnType.INDEX | ListReturnType.INVERTED)
    // With the INVERTED flag enabled, the items outside of the specified index range will be returned.
    // The meaning of the list command can also be inverted.  For example:
    // ListOperation.removeByIndexRange(binName, index, count, ListReturnType.INDEX | ListReturnType.INVERTED);
    // With the INVERTED flag enabled, the items outside of the specified index range will be removed and returned.
    ListReturnTypeInverted ListReturnType = 0x10000
)

type ListValue Uses

type ListValue []interface{}

ListValue encapsulates any arbitrary array. Supported by Aerospike 3 servers only.

func NewListValue Uses

func NewListValue(list []interface{}) ListValue

NewListValue generates a ListValue instance.

func (ListValue) GetObject Uses

func (vl ListValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (ListValue) GetType Uses

func (vl ListValue) GetType() int

GetType returns wire protocol value type.

func (ListValue) String Uses

func (vl ListValue) String() string

String implements Stringer interface.

type ListerValue Uses

type ListerValue struct {
    // contains filtered or unexported fields
}

ListValue encapsulates any arbitrary array. Supported by Aerospike 3 servers only.

func NewListerValue Uses

func NewListerValue(list ListIter) *ListerValue

NewListValue generates a ListValue instance.

func (*ListerValue) GetObject Uses

func (vl *ListerValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (*ListerValue) GetType Uses

func (vl *ListerValue) GetType() int

GetType returns wire protocol value type.

func (*ListerValue) String Uses

func (vl *ListerValue) String() string

String implements Stringer interface.

type LoginCommand Uses

type LoginCommand struct {

    // SessionToken for the current session on the external authentication server.
    SessionToken []byte

    // SessionExpiration for the current session on the external authentication server.
    SessionExpiration time.Time
    // contains filtered or unexported fields
}

Login command authenticates to the server. If the authentication is external, Session Information will be returned.

func NewLoginCommand Uses

func NewLoginCommand(buf []byte) *LoginCommand

func (*LoginCommand) Login Uses

func (lcmd *LoginCommand) Login(policy *ClientPolicy, conn *Connection) error

Login tries to authenticate to the aerospike server. Depending on the server configuration and ClientPolicy, the session information will be returned.

type LongValue Uses

type LongValue int64

LongValue encapsulates an int64 value.

func NewLongValue Uses

func NewLongValue(value int64) LongValue

NewLongValue generates a LongValue instance.

func (LongValue) GetObject Uses

func (vl LongValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (LongValue) GetType Uses

func (vl LongValue) GetType() int

GetType returns wire protocol value type.

func (LongValue) String Uses

func (vl LongValue) String() string

String implements Stringer interface.

type MapIter Uses

type MapIter interface {
    PackMap(buf BufferEx) (int, error)
    Len() int
}
	n, err = PackXXX(buf, v)
	size += n
	if err != nil {
		return size, err
	}
}
return size, nil

}

Code:

package main

import (
    "fmt"
    "log"
    "time"

    as "github.com/aerospike/aerospike-client-go"
)

/*
	myMapStringTime
*/
var _ as.MapIter = myMapStringTime(map[string]time.Time{})

// your custom list
type myMapStringTime map[string]time.Time

func (mm myMapStringTime) PackMap(buf as.BufferEx) (int, error) {
    size := 0
    for key, val := range mm {
        n, err := as.PackString(buf, key)
        size += n
        if err != nil {
            return size, err
        }

        n, err = as.PackInt64(buf, val.UnixNano())
        size += n
        if err != nil {
            return size, err
        }
    }
    return size, nil
}

func (mm myMapStringTime) Len() int {
    return len(mm)
}

func main() {
    // Setup the client here
    // client, err := as.NewClient("127.0.0.1", 3000)
    // if err != nil {
    // 	log.Fatal(err)
    // }

    now := time.Unix(123123123, 0)
    var v as.Value = as.NewValue(myMapStringTime(map[string]time.Time{"now": now}))
    key, err := as.NewKey("test", "test", 1)
    if err != nil {
        log.Fatal(err)
    }

    err = client.Put(nil, key, as.BinMap{"myBin": v})
    if err != nil {
        log.Fatal(err)
    }

    rec, err := client.Get(nil, key)
    if err != nil {
        log.Fatal(err)
    }

    fmt.Println(rec.Bins["myBin"])
}

type MapPair Uses

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 Uses

type MapPolicy struct {
    // contains filtered or unexported fields
}

MapPolicy directives when creating a map and writing map items.

func DefaultMapPolicy Uses

func DefaultMapPolicy() *MapPolicy

DefaultMapPolicy returns the default map policy

func NewMapPolicy Uses

func NewMapPolicy(order mapOrderType, writeMode *mapWriteMode) *MapPolicy

NewMapPolicy creates a MapPolicy with WriteMode. Use with servers before v4.3

func NewMapPolicyWithFlags Uses

func NewMapPolicyWithFlags(order mapOrderType, flags int) *MapPolicy

NewMapPolicyWithFlags creates a MapPolicy with WriteFlags. Use with servers v4.3+

type MapValue Uses

type MapValue map[interface{}]interface{}

MapValue encapsulates an arbitrary map. Supported by Aerospike 3 servers only.

func NewMapValue Uses

func NewMapValue(vmap map[interface{}]interface{}) MapValue

NewMapValue generates a MapValue instance.

func (MapValue) GetObject Uses

func (vl MapValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (MapValue) GetType Uses

func (vl MapValue) GetType() int

GetType returns wire protocol value type.

func (MapValue) String Uses

func (vl MapValue) String() string

type MapperValue Uses

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 Uses

func NewMapperValue(vmap MapIter) *MapperValue

NewMapValue generates a MapperValue instance.

func (*MapperValue) GetObject Uses

func (vl *MapperValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (*MapperValue) GetType Uses

func (vl *MapperValue) GetType() int

GetType returns wire protocol value type.

func (*MapperValue) String Uses

func (vl *MapperValue) String() string

type MultiPolicy Uses

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

    // ServerSocketTimeout defines maximum time that the server will before droping an idle socket.
    // Zero means there is no socket timeout.
    // Default is 10 seconds.
    ServerSocketTimeout time.Duration //= 10 seconds

    // FailOnClusterChange determines scan termination if cluster is in fluctuating state.
    FailOnClusterChange bool

    // Number of records to place in queue before blocking.
    // Records received from multiple server nodes will be placed in a queue.
    // A separate goroutine consumes these records in parallel.
    // If the queue is full, the producer goroutines will block until records are consumed.
    RecordQueueSize int //= 50

    // Indicates if bin data is retrieved. If false, only record digests are retrieved.
    IncludeBinData bool //= true;

    // Blocks until on-going migrations are over
    WaitUntilMigrationsAreOver bool //=false
}

MultiPolicy contains parameters for policy attributes used in query and scan operations.

func NewMultiPolicy Uses

func NewMultiPolicy() *MultiPolicy

NewMultiPolicy initializes a MultiPolicy instance with default values.

type Node Uses

type Node struct {
    // contains filtered or unexported fields
}

Node represents an Aerospike Database Server Node

func (*Node) Close Uses

func (nd *Node) Close()

Close marks node as inactive and closes all of its pooled connections.

func (*Node) Equals Uses

func (nd *Node) Equals(other *Node) bool

Equals compares equality of two nodes based on their names.

func (*Node) GetAliases Uses

func (nd *Node) GetAliases() []*Host

GetAliases returns node aliases.

func (*Node) GetConnection Uses

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) GetHost Uses

func (nd *Node) GetHost() *Host

GetHost retrieves host for the node.

func (*Node) GetName Uses

func (nd *Node) GetName() string

GetName returns node name.

func (*Node) InvalidateConnection Uses

func (nd *Node) InvalidateConnection(conn *Connection)

InvalidateConnection closes and discards a connection from the pool.

func (*Node) IsActive Uses

func (nd *Node) IsActive() bool

IsActive Checks if the node is active.

func (*Node) MigrationInProgress Uses

func (nd *Node) MigrationInProgress() (bool, error)

MigrationInProgress determines if the node is participating in a data migration

func (*Node) PutConnection Uses

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) Rack Uses

func (nd *Node) Rack(namespace string) (int, error)

Rack returns the rack number for the namespace.

func (*Node) Refresh Uses

func (nd *Node) Refresh(peers *peers) error

Refresh requests current status from server node, and updates node with the result.

func (*Node) RequestInfo Uses

func (nd *Node) RequestInfo(name ...string) (map[string]string, error)

RequestInfo gets info values by name from the specified database server node.

func (*Node) String Uses

func (nd *Node) String() string

String implements stringer interface

func (*Node) WaitUntillMigrationIsFinished Uses

func (nd *Node) WaitUntillMigrationIsFinished(timeout time.Duration) (err error)

WaitUntillMigrationIsFinished will block until migration operations are finished.

type NodeError Uses

type NodeError struct {
    // contains filtered or unexported fields
}

NodeError is a type to encapsulate the node that the error occurred in.

func (*NodeError) Err Uses

func (ne *NodeError) Err() error

Err returns the error

func (*NodeError) Node Uses

func (ne *NodeError) Node() *Node

Node returns the node where the error occurred.

type NullValue Uses

type NullValue struct{}

NullValue is an empty value.

func NewNullValue Uses

func NewNullValue() NullValue

NewNullValue generates a NullValue instance.

func (NullValue) GetObject Uses

func (vl NullValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (NullValue) GetType Uses

func (vl NullValue) GetType() int

GetType returns wire protocol value type.

func (NullValue) String Uses

func (vl NullValue) String() string

type Operation Uses

type Operation struct {
    // contains filtered or unexported fields
}

Operation contains operation definition. This struct is used in client's operate() method.

func AddOp Uses

func AddOp(bin *Bin) *Operation

AddOp creates integer add database operation.

func AppendOp Uses

func AppendOp(bin *Bin) *Operation

AppendOp creates string append database operation.

func GetHeaderOp Uses

func GetHeaderOp() *Operation

GetHeaderOp creates read record header database operation.

func GetOp Uses

func GetOp() *Operation

GetOp creates read all record bins database operation.

func GetOpForBin Uses

func GetOpForBin(binName string) *Operation

GetOpForBin creates read bin database operation.

func ListAppendOp Uses

func ListAppendOp(binName string, values ...interface{}) *Operation

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 ListAppendWithPolicyOp Uses

func ListAppendWithPolicyOp(policy *ListPolicy, binName string, values ...interface{}) *Operation

ListAppendWithPolicyOp 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 Uses

func ListClearOp(binName string) *Operation

ListClearOp creates a list clear operation. Server removes all items in list bin. Server does not return a result by default.

func ListGetByIndexOp Uses

func ListGetByIndexOp(binName string, index int, returnType ListReturnType) *Operation

ListGetByIndexOp creates list get by index operation. Server selects list item identified by index and returns selected data specified by returnType

func ListGetByIndexRangeCountOp Uses

func ListGetByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType) *Operation

ListGetByIndexRangeCountOp creates list get by index range operation. Server selects "count" list items starting at specified index and returns selected data specified by returnType.

func ListGetByIndexRangeOp Uses

func ListGetByIndexRangeOp(binName string, index int, returnType ListReturnType) *Operation

ListGetByIndexRangeOp creates list get by index range operation. Server selects list items starting at specified index to the end of list and returns selected data specified by returnType.

func ListGetByRankOp Uses

func ListGetByRankOp(binName string, rank int, returnType ListReturnType) *Operation

ListGetByRankOp creates a list get by rank operation. Server selects list item identified by rank and returns selected data specified by returnType.

func ListGetByRankRangeCountOp Uses

func ListGetByRankRangeCountOp(binName string, rank, count int, returnType ListReturnType) *Operation

ListGetByRankRangeCountOp creates a list get by rank range operation. Server selects "count" list items starting at specified rank and returns selected data specified by returnType.

func ListGetByRankRangeOp Uses

func ListGetByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation

ListGetByRankRangeOp creates a list get by rank range operation. Server selects list items starting at specified rank to the last ranked item and returns selected data specified by returnType.

func ListGetByValueListOp Uses

func ListGetByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation

ListGetByValueListOp creates list get by value list operation. Server selects list items identified by values and returns selected data specified by returnType.

func ListGetByValueOp Uses

func ListGetByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation

ListGetByValueOp creates a list get by value operation. Server selects list items identified by value and returns selected data specified by returnType.

func ListGetByValueRangeOp Uses

func ListGetByValueRangeOp(binName string, beginValue, endValue interface{}, returnType ListReturnType) *Operation

ListGetByValueRangeOp creates a list get by value range operation. Server selects list 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 ListGetOp Uses

func ListGetOp(binName string, index int) *Operation

ListGetOp creates a list get operation. Server returns item at specified index in list bin.

func ListGetRangeFromOp Uses

func ListGetRangeFromOp(binName string, index int) *Operation

ListGetRangeFromOp creates a list get range operation. Server returns items starting at specified index to the end of list.

func ListGetRangeOp Uses

func ListGetRangeOp(binName string, index int, count int) *Operation

ListGetRangeOp creates a list get range operation. Server returns "count" items starting at specified index in list bin.

func ListIncrementByOneOp Uses

func ListIncrementByOneOp(binName string, index int) *Operation

ListIncrementOp creates list increment operation with policy. Server increments list[index] by 1. Server returns list[index] after incrementing.

func ListIncrementByOneWithPolicyOp Uses

func ListIncrementByOneWithPolicyOp(policy *ListPolicy, binName string, index int) *Operation

ListIncrementByOneWithPolicyOp creates list increment operation with policy. Server increments list[index] by 1. Server returns list[index] after incrementing.

func ListIncrementOp Uses

func ListIncrementOp(binName string, index int, value interface{}) *Operation

ListIncrementOp creates a list increment operation. Server increments list[index] by value. Value should be integer(IntegerValue, LongValue) or float(FloatValue). Server returns list[index] after incrementing.

func ListIncrementWithPolicyOp Uses

func ListIncrementWithPolicyOp(policy *ListPolicy, binName string, index int, value interface{}) *Operation

ListInsertWithPolicyOp 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 ListInsertOp Uses

func ListInsertOp(binName string, index int, values ...interface{}) *Operation

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 ListInsertWithPolicyOp Uses

func ListInsertWithPolicyOp(policy *ListPolicy, binName string, index int, values ...interface{}) *Operation

ListInsertWithPolicyOp 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 Uses

func ListPopOp(binName string, index int) *Operation

ListPopOp creates list pop operation. Server returns item at specified index and removes item from list bin.

func ListPopRangeFromOp Uses

func ListPopRangeFromOp(binName string, index int) *Operation

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 Uses

func ListPopRangeOp(binName string, index int, count int) *Operation

ListPopRangeOp creates a list pop range operation. Server returns items starting at specified index and removes items from list bin.

func ListRemoveByIndexOp Uses

func ListRemoveByIndexOp(binName string, index int, returnType ListReturnType) *Operation

ListRemoveByIndexOp creates a list remove operation. Server removes list item identified by index and returns removed data specified by returnType.

func ListRemoveByIndexRangeCountOp Uses

func ListRemoveByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType) *Operation

ListRemoveByIndexRangeCountOp creates a list remove operation. Server removes "count" list items starting at specified index and returns removed data specified by returnType.

func ListRemoveByIndexRangeOp Uses

func ListRemoveByIndexRangeOp(binName string, index, returnType ListReturnType) *Operation

ListRemoveByIndexRangeOp creates a list remove operation. Server removes list items starting at specified index to the end of list and returns removed data specified by returnType.

func ListRemoveByRankOp Uses

func ListRemoveByRankOp(binName string, rank int, returnType ListReturnType) *Operation

ListRemoveByRankOp creates a list remove operation. Server removes list item identified by rank and returns removed data specified by returnType.

func ListRemoveByRankRangeCountOp Uses

func ListRemoveByRankRangeCountOp(binName string, rank int, count int, returnType ListReturnType) *Operation

ListRemoveByRankRangeCountOp creates a list remove operation. Server removes "count" list items starting at specified rank and returns removed data specified by returnType.

func ListRemoveByRankRangeOp Uses

func ListRemoveByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation

ListRemoveByRankRangeOp creates a list remove operation. Server removes list items starting at specified rank to the last ranked item and returns removed data specified by returnType.

func ListRemoveByValueListOp Uses

func ListRemoveByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation

ListRemoveByValueListOp creates list remove by value operation. Server removes list items identified by value and returns removed data specified by returnType.

func ListRemoveByValueOp Uses

func ListRemoveByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation

ListRemoveByValueOp creates list remove by value operation. Server removes the item identified by value and returns removed data specified by returnType.

func ListRemoveByValueRangeOp Uses

func ListRemoveByValueRangeOp(binName string, returnType ListReturnType, valueBegin, valueEnd interface{}) *Operation

ListRemoveByValueRangeOp creates a list remove operation. Server removes list items identified by value range (valueBegin inclusive, valueEnd exclusive). If valueBegin is nil, the range is less than valueEnd. If valueEnd is nil, the range is greater than equal to valueBegin. Server returns removed data specified by returnType

func ListRemoveOp Uses

func ListRemoveOp(binName string, index int) *Operation

ListRemoveOp creates a list remove operation. Server removes item at specified index from list bin. Server returns number of items removed.

func ListRemoveRangeFromOp Uses

func ListRemoveRangeFromOp(binName string, index int) *Operation

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 Uses

func ListRemoveRangeOp(binName string, index int, count int) *Operation

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 Uses

func ListSetOp(binName string, index int, value interface{}) *Operation

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 ListSetOrderOp Uses

func ListSetOrderOp(binName string, listOrder ListOrderType) *Operation

ListSetOrderOp creates a set list order operation. Server sets list order. Server returns null.

func ListSizeOp Uses

func ListSizeOp(binName string) *Operation

ListSizeOp creates a list size operation. Server returns size of list on bin name.

func ListSortOp Uses

func ListSortOp(binName string, sortFlags int) *Operation

ListSortOp creates list sort operation. Server sorts list according to sortFlags. Server does not return a result by default.

func ListTrimOp Uses

func ListTrimOp(binName string, index int, count int) *Operation

ListTrimOp creates a list trim operation. Server removes 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 Uses

func MapClearOp(binName string) *Operation

MapClearOp creates map clear operation. Server removes all items in map. Server returns null.

func MapDecrementOp Uses

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 Uses

func MapGetByIndexOp(binName string, index int, returnType mapReturnType) *Operation

MapGetByIndexOp creates map get by index operation. Server selects map item identified by index and returns selected data specified by returnType.

func MapGetByIndexRangeCountOp Uses

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 Uses

func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation

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 MapGetByKeyListOp Uses

func MapGetByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation

MapGetByKeyListOp creates a map get by key list operation. Server selects map items identified by keys and returns selected data specified by returnType.

func MapGetByKeyOp Uses

func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation

MapGetByKeyOp creates map get by key operation. Server selects map item identified by key and returns selected data specified by returnType.

func MapGetByKeyRangeOp Uses

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 Uses

func MapGetByRankOp(binName string, rank int, returnType mapReturnType) *Operation

MapGetByRankOp creates map get by rank operation. Server selects map item identified by rank and returns selected data specified by returnType.

func MapGetByRankRangeCountOp Uses

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 Uses

func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation

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 MapGetByValueListOp Uses

func MapGetByValueListOp(binName string, values []interface{}, returnType mapReturnType) *Operation

func MapGetByValueOp Uses

func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation

MapGetByValueOp creates map get by value operation. Server selects map items identified by value and returns selected data specified by returnType.

func MapGetByValueRangeOp Uses

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 Uses

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 Uses

func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}) *Operation

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 Uses

func MapPutOp(policy *MapPolicy, binName string, key interface{}, value interface{}) *Operation

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 Uses

func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType) *Operation

MapRemoveByIndexOp creates map remove operation. Server removes map item identified by index and returns removed data specified by returnType.

func MapRemoveByIndexRangeCountOp Uses

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 Uses

func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation

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 Uses

func MapRemoveByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation

MapRemoveByKeyListOp creates map remove operation. Server removes map items identified by keys and returns removed data specified by returnType.

func MapRemoveByKeyOp Uses

func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation

MapRemoveByKeyOp creates map remove operation. Server removes map item identified by key and returns removed data specified by returnType.

func MapRemoveByKeyRangeOp Uses

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 Uses

func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType) *Operation

MapRemoveByRankOp creates map remove operation. Server removes map item identified by rank and returns removed data specified by returnType.

func MapRemoveByRankRangeCountOp Uses

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 Uses

func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation

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 Uses

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 Uses

func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation

MapRemoveByValueOp creates map remove operation. Server removes map items identified by value and returns removed data specified by returnType.

func MapRemoveByValueRangeOp Uses

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 Uses

func MapSetPolicyOp(policy *MapPolicy, binName string) *Operation

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.

func MapSizeOp Uses

func MapSizeOp(binName string) *Operation

MapSizeOp creates map size operation. Server returns size of map.

func PrependOp Uses

func PrependOp(bin *Bin) *Operation

PrependOp creates string prepend database operation.

func PutOp Uses

func PutOp(bin *Bin) *Operation

PutOp creates set database operation.

func TouchOp Uses

func TouchOp() *Operation

TouchOp creates touch database operation.

type OperationSubType Uses

type OperationSubType *int

type OperationType Uses

type OperationType *struct{ op byte }

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 Uses

type Partition struct {
    Namespace   string
    PartitionId int
}

Partition encapsulates partition information.

func NewPartition Uses

func NewPartition(namespace string, partitionId int) *Partition

NewPartition generates a partition instance.

func NewPartitionByKey Uses

func NewPartitionByKey(key *Key) *Partition

NewPartitionByKey initializes a partition and determines the Partition Id from key digest automatically.

func (*Partition) Equals Uses

func (ptn *Partition) Equals(other *Partition) bool

Equals checks equality of two partitions.

func (*Partition) String Uses

func (ptn *Partition) String() string

String implements the Stringer interface.

type Partitions Uses

type Partitions struct {
    Replicas [][]*Node
    CPMode   bool
    // contains filtered or unexported fields
}

type Policy Uses

type Policy interface {
    // Retrieves BasePolicy
    GetBasePolicy() *BasePolicy
}

Policy Interface

type PredExp Uses

type PredExp interface {
    String() string
    // contains filtered or unexported methods
}

type Priority Uses

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 Privilege Uses

type Privilege struct {
    // Role
    Code privilegeCode

    // Namespace determines namespace scope. Apply permission to this namespace only.
    // If namespace is zero value, the privilege applies to all namespaces.
    Namespace string

    // Set name scope. Apply permission to this set within namespace only.
    // If set is zero value, the privilege applies to all sets within namespace.
    SetName string
}

Privilege determines user access granularity.

type QueryPolicy Uses

type QueryPolicy struct {
    *MultiPolicy
}

QueryPolicy encapsulates parameters for policy attributes used in query operations.

func NewQueryPolicy Uses

func NewQueryPolicy() *QueryPolicy

NewQueryPolicy generates a new QueryPolicy instance with default values.

type Record Uses

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.

func (*Record) String Uses

func (rc *Record) String() string

String implements the Stringer interface. Returns string representation of record.

type RecordExistsAction Uses

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 Uses

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 Uses

func (rcs *Recordset) Close() error

Close all streams from different nodes. A successful close return nil, subsequent calls to the method will return ErrRecordsetClosed.

func (*Recordset) IsActive Uses

func (rcs *Recordset) IsActive() bool

IsActive returns true if the operation hasn't been finished or cancelled.

func (*Recordset) Read Uses

func (rcs *Recordset) Read() (record *Record, err error)

Read reads the next record from the Recordset. If the Recordset has been closed, it returns ErrRecordsetClosed.

func (*Recordset) Results Uses

func (rcs *Recordset) Results() <-chan *Result

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)
  }
}

func (*Recordset) TaskId Uses

func (os *Recordset) TaskId() uint64

TaskId returns the transactionId/jobId sent to the server for this recordset.

type RegisterTask Uses

type RegisterTask struct {
    // contains filtered or unexported fields
}

RegisterTask is used to poll for UDF registration completion.

func NewRegisterTask Uses

func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask

NewRegisterTask initializes a RegisterTask with fields needed to query server nodes.

func (*RegisterTask) IsDone Uses

func (tskr *RegisterTask) IsDone() (bool, error)

IsDone will query all nodes for task completion status.

func (*RegisterTask) OnComplete Uses

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 Uses

type RemoveTask struct {
    // contains filtered or unexported fields
}

RemoveTask is used to poll for UDF registration completion.

func NewRemoveTask Uses

func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask

NewRemoveTask initializes a RemoveTask with fields needed to query server nodes.

func (*RemoveTask) IsDone Uses

func (tskr *RemoveTask) IsDone() (bool, error)

IsDone will query all nodes for task completion status.

func (*RemoveTask) OnComplete Uses

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 Uses

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

    // SEQUENCE Tries node containing master partition first.
    // If connection fails, all commands try nodes containing replicated partitions.
    // If socketTimeout is reached, reads also try nodes containing replicated partitions,
    // but writes remain on master node.
    //
    // This option requires ClientPolicy.RequestProleReplicas to be enabled
    // in order to function properly.
    SEQUENCE

    // PREFER_RACK Tries nodes on the same rack first.
    //
    // This option requires ClientPolicy.Rackaware to be enabled
    // in order to function properly.
    PREFER_RACK
)

type Result Uses

type Result struct {
    Record *Record
    Err    error
}

func (*Result) String Uses

func (res *Result) String() string

String implements the Stringer interface

type Role Uses

type Role struct {
    Name string

    Privileges []Privilege
}

Role allows granular access to database entities for users.

type ScanPolicy Uses

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;

    // 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.
    // Warning: LDT as a feature is deprecated on the servers v3.15+ and will be removed from the client in 2018.
    IncludeLDT bool
}

ScanPolicy encapsulates parameters used in scan operations.

func NewScanPolicy Uses

func NewScanPolicy() *ScanPolicy

NewScanPolicy creates a new ScanPolicy instance with default values.

type Statement Uses

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 Uses

func NewStatement(ns string, set string, binNames ...string) *Statement

NewStatement initializes a new Statement instance.

func (*Statement) Addfilter Uses

func (stmt *Statement) Addfilter(filter *Filter) error

Addfilter adds a filter to the statement. Aerospike Server currently only supports using a single filter per statement/query.

func (*Statement) IsScan Uses

func (stmt *Statement) IsScan() bool

IsScan determines is the Statement is a full namespace/set scan or a selective Query.

func (*Statement) SetAggregateFunction Uses

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.

func (*Statement) SetPredExp Uses

func (stmt *Statement) SetPredExp(predexp ...PredExp) error

SetPredExp sets low-level predicate expressions for the statement in postfix notation. Supported only by Aerospike Server v3.12+. Predicate expression filters are applied on the query results on the server. Predicate expression filters may occur on any bin in the record. To learn how to use this API, consult predexp_test.go file.

Postfix notation is described here: http://wiki.c2.com/?PostfixNotation

Example: (c >= 11 and c <= 20) or (d > 3 and (d < 5)

stmt.SetPredExp(

NewPredExpIntegerValue(11),
NewPredExpIntegerBin("c"),
NewPredExpIntegerGreaterEq(),
NewPredExpIntegerValue(20),
NewPredExpIntegerBin("c"),
NewPredExpIntegerLessEq(),
NewPredExpAnd(2),
NewPredExpIntegerValue(3),
NewPredExpIntegerBin("d"),
NewPredExpIntegerGreater(),
NewPredExpIntegerValue(5),
NewPredExpIntegerBin("d"),
NewPredExpIntegerLess(),
NewPredExpAnd(2),
NewPredExpOr(2)

);

// Record last update time > 2017-01-15 stmt.SetPredExp(

NewIntegerValue(time.Date(2017, 0, 15, 0, 0, 0, 0, time.UTC).UnixNano()),
NewPredExpLastUpdate(),
NewPredExpIntegerGreater(),

);

type StringValue Uses

type StringValue string

StringValue encapsulates a string value.

func NewStringValue Uses

func NewStringValue(value string) StringValue

NewStringValue generates a StringValue instance.

func (StringValue) GetObject Uses

func (vl StringValue) GetObject() interface{}

GetObject returns original value as an interface{}.

func (StringValue) GetType Uses

func (vl StringValue) GetType() int

GetType returns wire protocol value type.

func (StringValue) String Uses

func (vl StringValue) String() string

String implements Stringer interface.

type Task Uses

type Task interface {
    IsDone() (bool, error)

    OnComplete() chan error
    // contains filtered or unexported methods
}

Task interface defines methods for asynchronous tasks.

type UDF Uses

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 Uses

type UserRoles struct {
    // User name.
    User string

    // Roles is a list of assigned roles.
    Roles []string
}

UserRoles contains information about a user.

type Value Uses

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 Uses

func NewValue(v interface{}) Value

NewValue generates a new Value object based on the type. If the type is not supported, NewValue will panic. This method is a convenience method, and should not be used when absolute performance is required unless for the reason mentioned below.

If you have custom maps or slices like:

type MyMap map[primitive1]primitive2, eg: map[int]string

or

type MySlice []primitive, eg: []float64

cast them to their primitive type when passing them to this method:

v := NewValue(map[int]string(myVar))
v := NewValue([]float64(myVar))

This way you will avoid hitting reflection. To completely avoid reflection in the library, use the build tag: as_performance while building your program.

func ToValueSlice Uses

func ToValueSlice(array []interface{}) []Value

ToValueSlice converts a []interface{} to []Value. It will panic if any of array element types are not supported.

type ValueArray Uses

type ValueArray []Value

ValueArray encapsulates an array of Value. Supported by Aerospike 3 servers only.

func NewValueArray Uses

func NewValueArray(array []Value) *ValueArray

NewValueArray generates a ValueArray instance.

func ToValueArray Uses

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 Uses

func (va ValueArray) GetObject() interface{}

GetObject returns original value as an interface{}.

func (ValueArray) GetType Uses

func (va ValueArray) GetType() int

GetType returns wire protocol value type.

func (ValueArray) String Uses

func (va ValueArray) String() string

String implements Stringer interface.

type WritePolicy Uses

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

    // 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 3.10+ 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 Uses

func NewWritePolicy(generation, expiration uint32) *WritePolicy

NewWritePolicy initializes a new WritePolicy instance with default parameters.

Directories

PathSynopsis
examples
examples/get
examples/put
examples/query-aggregate
examples/shared
internal/lua
internal/lua/resources
logger
pkg/bcrypt
pkg/ripemd160Package ripemd160 implements the RIPEMD-160 hash algorithm.
tools/asinfo
tools/benchmark
tools/cli
types
types/atomic
types/particle_type
types/rand
utils
utils/buffer

Package aerospike imports 31 packages (graph) and is imported by 238 packages. Updated 2018-11-02. Refresh now. Tools for package owners.