Documentation ¶
Index ¶
Constants ¶
const ( // MSG_HEADER_SIZE is a message's header size MSG_HEADER_SIZE = 8 // MSG_INFO defines an info message MSG_INFO messageType = 1 // MSG_MESSAGE defines an info message MSG_MESSAGE = 3 )
const (
// CITRUSLEAF_EPOCH defines the citrusleaf epoc: Jan 01 2010 00:00:00 GMT
CITRUSLEAF_EPOCH = 1262304000
)
Variables ¶
This section is empty.
Functions ¶
func ResultCodeToString ¶
func ResultCodeToString(resultCode ResultCode) string
ResultCodeToString returns a human readable errors message based on the result code.
Types ¶
type BufferPool ¶
type BufferPool struct {
// contains filtered or unexported fields
}
BufferPool implements a specialized buffer pool. Pool size will be limited, and each buffer size will be constrained to the init and max buffer sizes.
func NewBufferPool ¶
func NewBufferPool(poolSize, initBufferSize, maxBufferSize int) *BufferPool
NewBufferPool creates a new buffer pool. New buffers will be created with size and capacity of initBufferSize. If cap(buffer) is larger than maxBufferSize when it is put back in the buffer, it will be thrown away. This will prevent unwanted memory bloat and set a deterministic maximum-size for the pool which will not be exceeded.
func (*BufferPool) Get ¶
func (bp *BufferPool) Get() (res []byte)
Get returns a buffer from the pool. If pool is empty, a new buffer of size initBufSize will be created and returned.
func (*BufferPool) Put ¶
func (bp *BufferPool) Put(buf []byte)
Put will put the buffer back in the pool, unless cap(buf) is bigger than initBufSize, in which case it will be thrown away
type Message ¶
type Message struct { MessageHeader Data []byte }
Message encapsulates a message sent or received from the Aerospike server
func NewMessage ¶
NewMessage generates a new Message instance.
type MessageHeader ¶
MessageHeader is the message's header
func (*MessageHeader) Length ¶
func (msg *MessageHeader) Length() int64
Length returns the length of the message
type Pool ¶
type Pool struct { // New will create a new object New func(params ...interface{}) interface{} // IsUsable checks if the object polled from the pool is still fresh and usable IsUsable func(obj interface{}, params ...interface{}) bool // CanReturn checkes if the object is eligible to go back to the pool CanReturn func(obj interface{}) bool // Finalize will be called when an object is not eligible to go back to the pool. // Usable to close connections, file handles, ... Finalize func(obj interface{}) // contains filtered or unexported fields }
Pool implements a general purpose fixed-size pool.
type ResultCode ¶
type ResultCode int
ResultCode signifies the database operation error codes. The positive numbers align with the server side file kvs.h.
const ( // GRPC_ERROR is wrapped and directly returned from the grpc library GRPC_ERROR ResultCode = -21 // BATCH_FAILED means one or more keys failed in a batch. BATCH_FAILED ResultCode = -20 // NO_RESPONSE means no response was received from the server. NO_RESPONSE ResultCode = -19 // NETWORK_ERROR defines a network error. Checked the wrapped error for detail. NETWORK_ERROR ResultCode = -18 // COMMON_ERROR defines a common, none-aerospike error. Checked the wrapped error for detail. COMMON_ERROR ResultCode = -17 // MAX_RETRIES_EXCEEDED defines max retries limit reached. MAX_RETRIES_EXCEEDED ResultCode = -16 // MAX_ERROR_RATE defines max errors limit reached. MAX_ERROR_RATE ResultCode = -15 // RACK_NOT_DEFINED defines requested Rack for node/namespace was not defined in the cluster. RACK_NOT_DEFINED ResultCode = -13 // INVALID_CLUSTER_PARTITION_MAP defines cluster has an invalid partition map, usually due to bad configuration. INVALID_CLUSTER_PARTITION_MAP ResultCode = -12 // SERVER_NOT_AVAILABLE defines server is not accepting requests. SERVER_NOT_AVAILABLE ResultCode = -11 // CLUSTER_NAME_MISMATCH_ERROR defines cluster Name does not match the ClientPolicy.ClusterName value. CLUSTER_NAME_MISMATCH_ERROR ResultCode = -10 // RECORDSET_CLOSED defines recordset has already been closed or cancelled RECORDSET_CLOSED ResultCode = -9 // NO_AVAILABLE_CONNECTIONS_TO_NODE defines there were no connections available to the node in the pool, and the pool was limited NO_AVAILABLE_CONNECTIONS_TO_NODE ResultCode = -8 // TYPE_NOT_SUPPORTED defines data type is not supported by aerospike server. TYPE_NOT_SUPPORTED ResultCode = -7 // COMMAND_REJECTED defines info Command was rejected by the server. COMMAND_REJECTED ResultCode = -6 // QUERY_TERMINATED defines query was terminated by user. QUERY_TERMINATED ResultCode = -5 // SCAN_TERMINATED defines scan was terminated by user. SCAN_TERMINATED ResultCode = -4 // INVALID_NODE_ERROR defines chosen node is not currently active. INVALID_NODE_ERROR ResultCode = -3 // PARSE_ERROR defines client parse error. PARSE_ERROR ResultCode = -2 // SERIALIZE_ERROR defines client serialization error. SERIALIZE_ERROR ResultCode = -1 // OK defines operation was successful. OK ResultCode = 0 // SERVER_ERROR defines unknown server failure. SERVER_ERROR ResultCode = 1 // KEY_NOT_FOUND_ERROR defines on retrieving, touching or replacing a record that doesn't exist. KEY_NOT_FOUND_ERROR ResultCode = 2 // GENERATION_ERROR defines on modifying a record with unexpected generation. GENERATION_ERROR ResultCode = 3 // PARAMETER_ERROR defines bad parameter(s) were passed in database operation call. PARAMETER_ERROR ResultCode = 4 // KEY_EXISTS_ERROR defines on create-only (write unique) operations on a record that already // exists. KEY_EXISTS_ERROR ResultCode = 5 // BIN_EXISTS_ERROR defines bin already exists on a create-only operation. BIN_EXISTS_ERROR ResultCode = 6 // CLUSTER_KEY_MISMATCH defines expected cluster ID was not received. CLUSTER_KEY_MISMATCH ResultCode = 7 // SERVER_MEM_ERROR defines server has run out of memory. SERVER_MEM_ERROR ResultCode = 8 // TIMEOUT defines client or server has timed out. TIMEOUT ResultCode = 9 // ALWAYS_FORBIDDEN defines operation not allowed in current configuration. ALWAYS_FORBIDDEN ResultCode = 10 // PARTITION_UNAVAILABLE defines partition is unavailable. PARTITION_UNAVAILABLE ResultCode = 11 // BIN_TYPE_ERROR defines operation is not supported with configured bin type (single-bin or // multi-bin). BIN_TYPE_ERROR ResultCode = 12 // RECORD_TOO_BIG defines record size exceeds limit. RECORD_TOO_BIG ResultCode = 13 // KEY_BUSY defines too many concurrent operations on the same record. KEY_BUSY ResultCode = 14 // SCAN_ABORT defines scan aborted by server. SCAN_ABORT ResultCode = 15 // UNSUPPORTED_FEATURE defines unsupported Server Feature (e.g. Scan + UDF) UNSUPPORTED_FEATURE ResultCode = 16 // BIN_NOT_FOUND defines bin not found on update-only operation. BIN_NOT_FOUND ResultCode = 17 // DEVICE_OVERLOAD defines device not keeping up with writes. DEVICE_OVERLOAD ResultCode = 18 // KEY_MISMATCH defines key type mismatch. KEY_MISMATCH ResultCode = 19 // INVALID_NAMESPACE defines invalid namespace. INVALID_NAMESPACE ResultCode = 20 // BIN_NAME_TOO_LONG defines bin name length greater than 14 characters, // or maximum number of unique bin names are exceeded. BIN_NAME_TOO_LONG ResultCode = 21 // FAIL_FORBIDDEN defines operation not allowed at this time. FAIL_FORBIDDEN ResultCode = 22 // FAIL_ELEMENT_NOT_FOUND defines element Not Found in CDT FAIL_ELEMENT_NOT_FOUND ResultCode = 23 // FAIL_ELEMENT_EXISTS defines element Already Exists in CDT FAIL_ELEMENT_EXISTS ResultCode = 24 // ENTERPRISE_ONLY defines attempt to use an Enterprise feature on a Community server or a server // without the applicable feature key. ENTERPRISE_ONLY ResultCode = 25 // OP_NOT_APPLICABLE defines the operation cannot be applied to the current bin value on the server. OP_NOT_APPLICABLE ResultCode = 26 // FILTERED_OUT defines the transaction was not performed because the filter was false. FILTERED_OUT ResultCode = 27 // LOST_CONFLICT defines write command loses conflict to XDR. LOST_CONFLICT = 28 // QUERY_END defines there are no more records left for query. QUERY_END ResultCode = 50 // SECURITY_NOT_SUPPORTED defines security type not supported by connected server. SECURITY_NOT_SUPPORTED ResultCode = 51 // SECURITY_NOT_ENABLED defines administration command is invalid. SECURITY_NOT_ENABLED ResultCode = 52 // SECURITY_SCHEME_NOT_SUPPORTED defines administration field is invalid. SECURITY_SCHEME_NOT_SUPPORTED ResultCode = 53 // INVALID_COMMAND defines administration command is invalid. INVALID_COMMAND ResultCode = 54 // INVALID_FIELD defines administration field is invalid. INVALID_FIELD ResultCode = 55 // ILLEGAL_STATE defines security protocol not followed. ILLEGAL_STATE ResultCode = 56 // INVALID_USER defines user name is invalid. INVALID_USER ResultCode = 60 // USER_ALREADY_EXISTS defines user was previously created. USER_ALREADY_EXISTS ResultCode = 61 // INVALID_PASSWORD defines password is invalid. INVALID_PASSWORD ResultCode = 62 // EXPIRED_PASSWORD defines security credential is invalid. EXPIRED_PASSWORD ResultCode = 63 // FORBIDDEN_PASSWORD defines forbidden password (e.g. recently used) FORBIDDEN_PASSWORD ResultCode = 64 // INVALID_CREDENTIAL defines security credential is invalid. INVALID_CREDENTIAL ResultCode = 65 // EXPIRED_SESSION defines login session expired. EXPIRED_SESSION ResultCode = 66 // INVALID_ROLE defines role name is invalid. INVALID_ROLE ResultCode = 70 // ROLE_ALREADY_EXISTS defines role already exists. ROLE_ALREADY_EXISTS ResultCode = 71 // INVALID_PRIVILEGE defines privilege is invalid. INVALID_PRIVILEGE ResultCode = 72 // INVALID_WHITELIST defines invalid IP address whiltelist INVALID_WHITELIST = 73 // QUOTAS_NOT_ENABLED defines Quotas not enabled on server. QUOTAS_NOT_ENABLED = 74 // INVALID_QUOTA defines invalid quota value. INVALID_QUOTA = 75 // NOT_AUTHENTICATED defines user must be authentication before performing database operations. NOT_AUTHENTICATED ResultCode = 80 // ROLE_VIOLATION defines user does not posses the required role to perform the database operation. ROLE_VIOLATION ResultCode = 81 // NOT_WHITELISTED defines command not allowed because sender IP address not whitelisted. NOT_WHITELISTED = 82 // QUOTA_EXCEEDED defines Quota exceeded. QUOTA_EXCEEDED = 83 // UDF_BAD_RESPONSE defines a user defined function returned an error code. UDF_BAD_RESPONSE ResultCode = 100 // BATCH_DISABLED defines batch functionality has been disabled. BATCH_DISABLED ResultCode = 150 // BATCH_MAX_REQUESTS_EXCEEDED defines batch max requests have been exceeded. BATCH_MAX_REQUESTS_EXCEEDED ResultCode = 151 // BATCH_QUEUES_FULL defines all batch queues are full. BATCH_QUEUES_FULL ResultCode = 152 // GEO_INVALID_GEOJSON defines invalid GeoJSON on insert/update GEO_INVALID_GEOJSON ResultCode = 160 // INDEX_FOUND defines secondary index already exists. INDEX_FOUND ResultCode = 200 // INDEX_NOTFOUND defines requested secondary index does not exist. INDEX_NOTFOUND ResultCode = 201 // INDEX_OOM defines secondary index memory space exceeded. INDEX_OOM ResultCode = 202 // INDEX_NOTREADABLE defines secondary index not available. INDEX_NOTREADABLE ResultCode = 203 // INDEX_GENERIC defines generic secondary index error. INDEX_GENERIC ResultCode = 204 // INDEX_NAME_MAXLEN defines index name maximum length exceeded. INDEX_NAME_MAXLEN ResultCode = 205 // INDEX_MAXCOUNT defines maximum number of indexes exceeded. INDEX_MAXCOUNT ResultCode = 206 // QUERY_ABORTED defines secondary index query aborted. QUERY_ABORTED ResultCode = 210 // QUERY_QUEUEFULL defines secondary index queue full. QUERY_QUEUEFULL ResultCode = 211 // QUERY_TIMEOUT defines secondary index query timed out on server. QUERY_TIMEOUT ResultCode = 212 // QUERY_GENERIC defines generic query error. QUERY_GENERIC ResultCode = 213 // QUERY_NETIO_ERR defines query NetIO error on server QUERY_NETIO_ERR ResultCode = 214 // QUERY_DUPLICATE defines duplicate TaskId sent for the statement QUERY_DUPLICATE ResultCode = 215 // AEROSPIKE_ERR_UDF_NOT_FOUND defines uDF does not exist. AEROSPIKE_ERR_UDF_NOT_FOUND ResultCode = 1301 // AEROSPIKE_ERR_LUA_FILE_NOT_FOUND defines lUA file does not exist. AEROSPIKE_ERR_LUA_FILE_NOT_FOUND ResultCode = 1302 )
func (ResultCode) String ¶
func (rc ResultCode) String() string