id
int32
0
167k
repo
stringlengths
5
54
path
stringlengths
4
155
func_name
stringlengths
1
118
original_string
stringlengths
52
85.5k
language
stringclasses
1 value
code
stringlengths
52
85.5k
code_tokens
listlengths
21
1.41k
docstring
stringlengths
6
2.61k
docstring_tokens
listlengths
3
215
sha
stringlengths
40
40
url
stringlengths
85
252
9,900
aerospike/aerospike-client-go
key.go
SetValue
func (ky *Key) SetValue(val Value) error { ky.userKey = val return ky.computeDigest() }
go
func (ky *Key) SetValue(val Value) error { ky.userKey = val return ky.computeDigest() }
[ "func", "(", "ky", "*", "Key", ")", "SetValue", "(", "val", "Value", ")", "error", "{", "ky", ".", "userKey", "=", "val", "\n", "return", "ky", ".", "computeDigest", "(", ")", "\n", "}" ]
// SetValue sets the Key's value and recompute's its digest without allocating new memory. // This allows the keys to be reusable.
[ "SetValue", "sets", "the", "Key", "s", "value", "and", "recompute", "s", "its", "digest", "without", "allocating", "new", "memory", ".", "This", "allows", "the", "keys", "to", "be", "reusable", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L68-L71
9,901
aerospike/aerospike-client-go
key.go
Equals
func (ky *Key) Equals(other *Key) bool { return bytes.Equal(ky.digest[:], other.digest[:]) }
go
func (ky *Key) Equals(other *Key) bool { return bytes.Equal(ky.digest[:], other.digest[:]) }
[ "func", "(", "ky", "*", "Key", ")", "Equals", "(", "other", "*", "Key", ")", "bool", "{", "return", "bytes", ".", "Equal", "(", "ky", ".", "digest", "[", ":", "]", ",", "other", ".", "digest", "[", ":", "]", ")", "\n", "}" ]
// Equals uses key digests to compare key equality.
[ "Equals", "uses", "key", "digests", "to", "compare", "key", "equality", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L79-L81
9,902
aerospike/aerospike-client-go
key.go
String
func (ky *Key) String() string { if ky == nil { return "" } if ky.userKey != nil { return fmt.Sprintf("%s:%s:%s:%v", ky.namespace, ky.setName, ky.userKey.String(), Buffer.BytesToHexString(ky.digest[:])) } return fmt.Sprintf("%s:%s::%v", ky.namespace, ky.setName, Buffer.BytesToHexString(ky.digest[:])) }
go
func (ky *Key) String() string { if ky == nil { return "" } if ky.userKey != nil { return fmt.Sprintf("%s:%s:%s:%v", ky.namespace, ky.setName, ky.userKey.String(), Buffer.BytesToHexString(ky.digest[:])) } return fmt.Sprintf("%s:%s::%v", ky.namespace, ky.setName, Buffer.BytesToHexString(ky.digest[:])) }
[ "func", "(", "ky", "*", "Key", ")", "String", "(", ")", "string", "{", "if", "ky", "==", "nil", "{", "return", "\"", "\"", "\n", "}", "\n\n", "if", "ky", ".", "userKey", "!=", "nil", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", ...
// String implements Stringer interface and returns string representation of key.
[ "String", "implements", "Stringer", "interface", "and", "returns", "string", "representation", "of", "key", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L84-L93
9,903
aerospike/aerospike-client-go
key.go
NewKey
func NewKey(namespace string, setName string, key interface{}) (*Key, error) { newKey := &Key{ namespace: namespace, setName: setName, userKey: NewValue(key), } if err := newKey.computeDigest(); err != nil { return nil, err } return newKey, nil }
go
func NewKey(namespace string, setName string, key interface{}) (*Key, error) { newKey := &Key{ namespace: namespace, setName: setName, userKey: NewValue(key), } if err := newKey.computeDigest(); err != nil { return nil, err } return newKey, nil }
[ "func", "NewKey", "(", "namespace", "string", ",", "setName", "string", ",", "key", "interface", "{", "}", ")", "(", "*", "Key", ",", "error", ")", "{", "newKey", ":=", "&", "Key", "{", "namespace", ":", "namespace", ",", "setName", ":", "setName", "...
// 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.
[ "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", ".",...
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L98-L110
9,904
aerospike/aerospike-client-go
key.go
NewKeyWithDigest
func NewKeyWithDigest(namespace string, setName string, key interface{}, digest []byte) (*Key, error) { newKey := &Key{ namespace: namespace, setName: setName, userKey: NewValue(key), } if err := newKey.SetDigest(digest); err != nil { return nil, err } return newKey, nil }
go
func NewKeyWithDigest(namespace string, setName string, key interface{}, digest []byte) (*Key, error) { newKey := &Key{ namespace: namespace, setName: setName, userKey: NewValue(key), } if err := newKey.SetDigest(digest); err != nil { return nil, err } return newKey, nil }
[ "func", "NewKeyWithDigest", "(", "namespace", "string", ",", "setName", "string", ",", "key", "interface", "{", "}", ",", "digest", "[", "]", "byte", ")", "(", "*", "Key", ",", "error", ")", "{", "newKey", ":=", "&", "Key", "{", "namespace", ":", "na...
// NewKeyWithDigest initializes a key from namespace, optional set name and user key. // The server handles record identifiers by digest only.
[ "NewKeyWithDigest", "initializes", "a", "key", "from", "namespace", "optional", "set", "name", "and", "user", "key", ".", "The", "server", "handles", "record", "identifiers", "by", "digest", "only", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L114-L125
9,905
aerospike/aerospike-client-go
key.go
SetDigest
func (ky *Key) SetDigest(digest []byte) error { if len(digest) != 20 { return NewAerospikeError(PARAMETER_ERROR, "Invalid digest: Digest is required to be exactly 20 bytes.") } copy(ky.digest[:], digest) return nil }
go
func (ky *Key) SetDigest(digest []byte) error { if len(digest) != 20 { return NewAerospikeError(PARAMETER_ERROR, "Invalid digest: Digest is required to be exactly 20 bytes.") } copy(ky.digest[:], digest) return nil }
[ "func", "(", "ky", "*", "Key", ")", "SetDigest", "(", "digest", "[", "]", "byte", ")", "error", "{", "if", "len", "(", "digest", ")", "!=", "20", "{", "return", "NewAerospikeError", "(", "PARAMETER_ERROR", ",", "\"", "\"", ")", "\n", "}", "\n", "co...
// SetDigest sets a custom hash
[ "SetDigest", "sets", "a", "custom", "hash" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/key.go#L128-L134
9,906
aerospike/aerospike-client-go
batch_read.go
NewBatchRead
func NewBatchRead(key *Key, binNames []string) *BatchRead { res := &BatchRead{ Key: key, BinNames: binNames, } if len(binNames) == 0 { res.ReadAllBins = true } return res }
go
func NewBatchRead(key *Key, binNames []string) *BatchRead { res := &BatchRead{ Key: key, BinNames: binNames, } if len(binNames) == 0 { res.ReadAllBins = true } return res }
[ "func", "NewBatchRead", "(", "key", "*", "Key", ",", "binNames", "[", "]", "string", ")", "*", "BatchRead", "{", "res", ":=", "&", "BatchRead", "{", "Key", ":", "key", ",", "BinNames", ":", "binNames", ",", "}", "\n\n", "if", "len", "(", "binNames", ...
// NewBatchRead defines a key and bins to retrieve in a batch operation.
[ "NewBatchRead", "defines", "a", "key", "and", "bins", "to", "retrieve", "in", "a", "batch", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/batch_read.go#L41-L52
9,907
aerospike/aerospike-client-go
internal/lua/lua.go
LValueToInterface
func LValueToInterface(val lua.LValue) interface{} { switch val.Type() { case lua.LTNil: return nil case lua.LTBool: return lua.LVAsBool(val) case lua.LTNumber: return float64(lua.LVAsNumber(val)) case lua.LTString: return lua.LVAsString(val) case lua.LTUserData: ud := val.(*lua.LUserData).Value switc...
go
func LValueToInterface(val lua.LValue) interface{} { switch val.Type() { case lua.LTNil: return nil case lua.LTBool: return lua.LVAsBool(val) case lua.LTNumber: return float64(lua.LVAsNumber(val)) case lua.LTString: return lua.LVAsString(val) case lua.LTUserData: ud := val.(*lua.LUserData).Value switc...
[ "func", "LValueToInterface", "(", "val", "lua", ".", "LValue", ")", "interface", "{", "}", "{", "switch", "val", ".", "Type", "(", ")", "{", "case", "lua", ".", "LTNil", ":", "return", "nil", "\n", "case", "lua", ".", "LTBool", ":", "return", "lua", ...
// LValueToInterface converts a generic LValue to a native type
[ "LValueToInterface", "converts", "a", "generic", "LValue", "to", "a", "native", "type" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/lua/lua.go#L117-L146
9,908
aerospike/aerospike-client-go
index_collection_type.go
ictToString
func ictToString(ict IndexCollectionType) string { switch ict { case ICT_LIST: return "LIST" case ICT_MAPKEYS: return "MAPKEYS" case ICT_MAPVALUES: return "MAPVALUES" default: panic(fmt.Sprintf("Unknown IndexCollectionType value %v", ict)) } }
go
func ictToString(ict IndexCollectionType) string { switch ict { case ICT_LIST: return "LIST" case ICT_MAPKEYS: return "MAPKEYS" case ICT_MAPVALUES: return "MAPVALUES" default: panic(fmt.Sprintf("Unknown IndexCollectionType value %v", ict)) } }
[ "func", "ictToString", "(", "ict", "IndexCollectionType", ")", "string", "{", "switch", "ict", "{", "case", "ICT_LIST", ":", "return", "\"", "\"", "\n\n", "case", "ICT_MAPKEYS", ":", "return", "\"", "\"", "\n\n", "case", "ICT_MAPVALUES", ":", "return", "\"",...
// ictToString converts IndexCollectionType to string representations
[ "ictToString", "converts", "IndexCollectionType", "to", "string", "representations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/index_collection_type.go#L38-L53
9,909
aerospike/aerospike-client-go
write_policy.go
NewWritePolicy
func NewWritePolicy(generation, expiration uint32) *WritePolicy { res := &WritePolicy{ BasePolicy: *NewPolicy(), RecordExistsAction: UPDATE, GenerationPolicy: NONE, CommitLevel: COMMIT_ALL, Generation: generation, Expiration: expiration, } // Writes may not be idempotent...
go
func NewWritePolicy(generation, expiration uint32) *WritePolicy { res := &WritePolicy{ BasePolicy: *NewPolicy(), RecordExistsAction: UPDATE, GenerationPolicy: NONE, CommitLevel: COMMIT_ALL, Generation: generation, Expiration: expiration, } // Writes may not be idempotent...
[ "func", "NewWritePolicy", "(", "generation", ",", "expiration", "uint32", ")", "*", "WritePolicy", "{", "res", ":=", "&", "WritePolicy", "{", "BasePolicy", ":", "*", "NewPolicy", "(", ")", ",", "RecordExistsAction", ":", "UPDATE", ",", "GenerationPolicy", ":",...
// NewWritePolicy initializes a new WritePolicy instance with default parameters.
[ "NewWritePolicy", "initializes", "a", "new", "WritePolicy", "instance", "with", "default", "parameters", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/write_policy.go#L78-L93
9,910
aerospike/aerospike-client-go
policy.go
NewPolicy
func NewPolicy() *BasePolicy { return &BasePolicy{ Priority: DEFAULT, ConsistencyLevel: CONSISTENCY_ONE, TotalTimeout: 0 * time.Millisecond, SocketTimeout: 30 * time.Second, MaxRetries: 2, SleepBetweenRetries: 1 * time.Millisecond, SleepMultiplier: 1.0, ReplicaPo...
go
func NewPolicy() *BasePolicy { return &BasePolicy{ Priority: DEFAULT, ConsistencyLevel: CONSISTENCY_ONE, TotalTimeout: 0 * time.Millisecond, SocketTimeout: 30 * time.Second, MaxRetries: 2, SleepBetweenRetries: 1 * time.Millisecond, SleepMultiplier: 1.0, ReplicaPo...
[ "func", "NewPolicy", "(", ")", "*", "BasePolicy", "{", "return", "&", "BasePolicy", "{", "Priority", ":", "DEFAULT", ",", "ConsistencyLevel", ":", "CONSISTENCY_ONE", ",", "TotalTimeout", ":", "0", "*", "time", ".", "Millisecond", ",", "SocketTimeout", ":", "...
// NewPolicy generates a new BasePolicy instance with default values.
[ "NewPolicy", "generates", "a", "new", "BasePolicy", "instance", "with", "default", "values", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/policy.go#L126-L139
9,911
aerospike/aerospike-client-go
policy.go
socketTimeout
func (p *BasePolicy) socketTimeout() time.Duration { if p.TotalTimeout == 0 && p.SocketTimeout == 0 { return 0 } else if p.TotalTimeout > 0 && p.SocketTimeout == 0 { return p.TotalTimeout } else if p.TotalTimeout == 0 && p.SocketTimeout > 0 { return p.SocketTimeout } else if p.TotalTimeout > 0 && p.SocketTime...
go
func (p *BasePolicy) socketTimeout() time.Duration { if p.TotalTimeout == 0 && p.SocketTimeout == 0 { return 0 } else if p.TotalTimeout > 0 && p.SocketTimeout == 0 { return p.TotalTimeout } else if p.TotalTimeout == 0 && p.SocketTimeout > 0 { return p.SocketTimeout } else if p.TotalTimeout > 0 && p.SocketTime...
[ "func", "(", "p", "*", "BasePolicy", ")", "socketTimeout", "(", ")", "time", ".", "Duration", "{", "if", "p", ".", "TotalTimeout", "==", "0", "&&", "p", ".", "SocketTimeout", "==", "0", "{", "return", "0", "\n", "}", "else", "if", "p", ".", "TotalT...
// socketTimeout validates and then calculates the timeout to be used for the socket // based on Timeout and SocketTimeout values.
[ "socketTimeout", "validates", "and", "then", "calculates", "the", "timeout", "to", "be", "used", "for", "the", "socket", "based", "on", "Timeout", "and", "SocketTimeout", "values", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/policy.go#L148-L161
9,912
aerospike/aerospike-client-go
examples/blob.go
EncodeBlob
func (p Person) EncodeBlob() ([]byte, error) { return append([]byte(p.name)), nil }
go
func (p Person) EncodeBlob() ([]byte, error) { return append([]byte(p.name)), nil }
[ "func", "(", "p", "Person", ")", "EncodeBlob", "(", ")", "(", "[", "]", "byte", ",", "error", ")", "{", "return", "append", "(", "[", "]", "byte", "(", "p", ".", "name", ")", ")", ",", "nil", "\n", "}" ]
// Define The AerospikeBlob interface
[ "Define", "The", "AerospikeBlob", "interface" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/blob.go#L28-L30
9,913
aerospike/aerospike-client-go
examples/blob.go
DecodeBlob
func (p *Person) DecodeBlob(buf []byte) error { p.name = string(buf) return nil }
go
func (p *Person) DecodeBlob(buf []byte) error { p.name = string(buf) return nil }
[ "func", "(", "p", "*", "Person", ")", "DecodeBlob", "(", "buf", "[", "]", "byte", ")", "error", "{", "p", ".", "name", "=", "string", "(", "buf", ")", "\n", "return", "nil", "\n", "}" ]
// Decoder is optional, and should be used manually
[ "Decoder", "is", "optional", "and", "should", "be", "used", "manually" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/blob.go#L33-L36
9,914
aerospike/aerospike-client-go
statement.go
NewStatement
func NewStatement(ns string, set string, binNames ...string) *Statement { return &Statement{ Namespace: ns, SetName: set, BinNames: binNames, returnData: true, TaskId: uint64(xornd.Int64()), } }
go
func NewStatement(ns string, set string, binNames ...string) *Statement { return &Statement{ Namespace: ns, SetName: set, BinNames: binNames, returnData: true, TaskId: uint64(xornd.Int64()), } }
[ "func", "NewStatement", "(", "ns", "string", ",", "set", "string", ",", "binNames", "...", "string", ")", "*", "Statement", "{", "return", "&", "Statement", "{", "Namespace", ":", "ns", ",", "SetName", ":", "set", ",", "BinNames", ":", "binNames", ",", ...
// NewStatement initializes a new Statement instance.
[ "NewStatement", "initializes", "a", "new", "Statement", "instance", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/statement.go#L54-L62
9,915
aerospike/aerospike-client-go
statement.go
SetAggregateFunction
func (stmt *Statement) SetAggregateFunction(packageName string, functionName string, functionArgs []Value, returnData bool) { stmt.packageName = packageName stmt.functionName = functionName stmt.functionArgs = functionArgs stmt.returnData = returnData }
go
func (stmt *Statement) SetAggregateFunction(packageName string, functionName string, functionArgs []Value, returnData bool) { stmt.packageName = packageName stmt.functionName = functionName stmt.functionArgs = functionArgs stmt.returnData = returnData }
[ "func", "(", "stmt", "*", "Statement", ")", "SetAggregateFunction", "(", "packageName", "string", ",", "functionName", "string", ",", "functionArgs", "[", "]", "Value", ",", "returnData", "bool", ")", "{", "stmt", ".", "packageName", "=", "packageName", "\n", ...
// SetAggregateFunction sets aggregation function parameters. // This function will be called on both the server // and client for each selected item.
[ "SetAggregateFunction", "sets", "aggregation", "function", "parameters", ".", "This", "function", "will", "be", "called", "on", "both", "the", "server", "and", "client", "for", "each", "selected", "item", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/statement.go#L114-L119
9,916
aerospike/aerospike-client-go
statement.go
setTaskID
func (stmt *Statement) setTaskID() { for stmt.TaskId == 0 { stmt.TaskId = uint64(xornd.Int64()) } }
go
func (stmt *Statement) setTaskID() { for stmt.TaskId == 0 { stmt.TaskId = uint64(xornd.Int64()) } }
[ "func", "(", "stmt", "*", "Statement", ")", "setTaskID", "(", ")", "{", "for", "stmt", ".", "TaskId", "==", "0", "{", "stmt", ".", "TaskId", "=", "uint64", "(", "xornd", ".", "Int64", "(", ")", ")", "\n", "}", "\n", "}" ]
// Always set the taskID client-side to a non-zero random value
[ "Always", "set", "the", "taskID", "client", "-", "side", "to", "a", "non", "-", "zero", "random", "value" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/statement.go#L127-L131
9,917
aerospike/aerospike-client-go
logger/logger.go
SetLevel
func (lgr *logger) SetLevel(level LogPriority) { lgr.mutex.Lock() defer lgr.mutex.Unlock() lgr.level = level }
go
func (lgr *logger) SetLevel(level LogPriority) { lgr.mutex.Lock() defer lgr.mutex.Unlock() lgr.level = level }
[ "func", "(", "lgr", "*", "logger", ")", "SetLevel", "(", "level", "LogPriority", ")", "{", "lgr", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "lgr", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "lgr", ".", "level", "=", "level", "\n", "...
// SetLevel sets logging level. Default is ERR.
[ "SetLevel", "sets", "logging", "level", ".", "Default", "is", "ERR", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/logger/logger.go#L65-L70
9,918
aerospike/aerospike-client-go
logger/logger.go
LogAtLevel
func (lgr *logger) LogAtLevel(level LogPriority, format string, v ...interface{}) { switch level { case DEBUG: lgr.Debug(format, v...) case INFO: lgr.Info(format, v...) case WARNING: lgr.Warn(format, v...) case ERR: lgr.Error(format, v...) } }
go
func (lgr *logger) LogAtLevel(level LogPriority, format string, v ...interface{}) { switch level { case DEBUG: lgr.Debug(format, v...) case INFO: lgr.Info(format, v...) case WARNING: lgr.Warn(format, v...) case ERR: lgr.Error(format, v...) } }
[ "func", "(", "lgr", "*", "logger", ")", "LogAtLevel", "(", "level", "LogPriority", ",", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "switch", "level", "{", "case", "DEBUG", ":", "lgr", ".", "Debug", "(", "format", ",", "v", ...
// Error logs a message if log level allows to do so.
[ "Error", "logs", "a", "message", "if", "log", "level", "allows", "to", "do", "so", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/logger/logger.go#L73-L84
9,919
aerospike/aerospike-client-go
logger/logger.go
Debug
func (lgr *logger) Debug(format string, v ...interface{}) { lgr.mutex.RLock() defer lgr.mutex.RUnlock() if lgr.level <= DEBUG { if l, ok := lgr.Logger.(*log.Logger); ok { l.Output(2, fmt.Sprintf(format, v...)) } else { lgr.Logger.Printf(format, v...) } } }
go
func (lgr *logger) Debug(format string, v ...interface{}) { lgr.mutex.RLock() defer lgr.mutex.RUnlock() if lgr.level <= DEBUG { if l, ok := lgr.Logger.(*log.Logger); ok { l.Output(2, fmt.Sprintf(format, v...)) } else { lgr.Logger.Printf(format, v...) } } }
[ "func", "(", "lgr", "*", "logger", ")", "Debug", "(", "format", "string", ",", "v", "...", "interface", "{", "}", ")", "{", "lgr", ".", "mutex", ".", "RLock", "(", ")", "\n", "defer", "lgr", ".", "mutex", ".", "RUnlock", "(", ")", "\n\n", "if", ...
// Debug logs a message if log level allows to do so.
[ "Debug", "logs", "a", "message", "if", "log", "level", "allows", "to", "do", "so", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/logger/logger.go#L87-L98
9,920
aerospike/aerospike-client-go
types/result_code.go
KeepConnection
func KeepConnection(err error) bool { // if error is not an AerospikeError, Throw the connection away conservatively ae, ok := err.(AerospikeError) if !ok { return false } switch ae.resultCode { case 0, // Zero Value QUERY_TERMINATED, SCAN_TERMINATED, PARSE_ERROR, SERIALIZE_ERROR, SERVER_NOT_AVAILABL...
go
func KeepConnection(err error) bool { // if error is not an AerospikeError, Throw the connection away conservatively ae, ok := err.(AerospikeError) if !ok { return false } switch ae.resultCode { case 0, // Zero Value QUERY_TERMINATED, SCAN_TERMINATED, PARSE_ERROR, SERIALIZE_ERROR, SERVER_NOT_AVAILABL...
[ "func", "KeepConnection", "(", "err", "error", ")", "bool", "{", "// if error is not an AerospikeError, Throw the connection away conservatively", "ae", ",", "ok", ":=", "err", ".", "(", "AerospikeError", ")", "\n", "if", "!", "ok", "{", "return", "false", "\n", "...
// Should connection be put back into pool.
[ "Should", "connection", "be", "put", "back", "into", "pool", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/result_code.go#L254-L280
9,921
aerospike/aerospike-client-go
batch_policy.go
NewBatchPolicy
func NewBatchPolicy() *BatchPolicy { return &BatchPolicy{ BasePolicy: *NewPolicy(), ConcurrentNodes: 1, AllowInline: true, AllowPartialResults: false, SendSetName: false, } }
go
func NewBatchPolicy() *BatchPolicy { return &BatchPolicy{ BasePolicy: *NewPolicy(), ConcurrentNodes: 1, AllowInline: true, AllowPartialResults: false, SendSetName: false, } }
[ "func", "NewBatchPolicy", "(", ")", "*", "BatchPolicy", "{", "return", "&", "BatchPolicy", "{", "BasePolicy", ":", "*", "NewPolicy", "(", ")", ",", "ConcurrentNodes", ":", "1", ",", "AllowInline", ":", "true", ",", "AllowPartialResults", ":", "false", ",", ...
// NewBatchPolicy initializes a new BatchPolicy instance with default parameters.
[ "NewBatchPolicy", "initializes", "a", "new", "BatchPolicy", "instance", "with", "default", "parameters", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/batch_policy.go#L69-L77
9,922
aerospike/aerospike-client-go
connection_heap.go
newSingleConnectionHeap
func newSingleConnectionHeap(size int) *singleConnectionHeap { if size <= 0 { panic("Heap size cannot be less than 1") } return &singleConnectionHeap{ full: false, data: make([]*Connection, uint32(size)), size: uint32(size), } }
go
func newSingleConnectionHeap(size int) *singleConnectionHeap { if size <= 0 { panic("Heap size cannot be less than 1") } return &singleConnectionHeap{ full: false, data: make([]*Connection, uint32(size)), size: uint32(size), } }
[ "func", "newSingleConnectionHeap", "(", "size", "int", ")", "*", "singleConnectionHeap", "{", "if", "size", "<=", "0", "{", "panic", "(", "\"", "\"", ")", "\n", "}", "\n\n", "return", "&", "singleConnectionHeap", "{", "full", ":", "false", ",", "data", "...
// newSingleConnectionHeap creates a new heap with initial size.
[ "newSingleConnectionHeap", "creates", "a", "new", "heap", "with", "initial", "size", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection_heap.go#L34-L44
9,923
aerospike/aerospike-client-go
connection_heap.go
DropIdleTail
func (h *singleConnectionHeap) DropIdleTail() bool { h.mutex.Lock() defer h.mutex.Unlock() // if heap is not empty if h.full || (h.tail != h.head) { conn := h.data[(h.tail+1)%h.size] if conn.IsConnected() && !conn.isIdle() { return false } h.tail = (h.tail + 1) % h.size h.data[h.tail] = nil h.full...
go
func (h *singleConnectionHeap) DropIdleTail() bool { h.mutex.Lock() defer h.mutex.Unlock() // if heap is not empty if h.full || (h.tail != h.head) { conn := h.data[(h.tail+1)%h.size] if conn.IsConnected() && !conn.isIdle() { return false } h.tail = (h.tail + 1) % h.size h.data[h.tail] = nil h.full...
[ "func", "(", "h", "*", "singleConnectionHeap", ")", "DropIdleTail", "(", ")", "bool", "{", "h", ".", "mutex", ".", "Lock", "(", ")", "\n", "defer", "h", ".", "mutex", ".", "Unlock", "(", ")", "\n\n", "// if heap is not empty", "if", "h", ".", "full", ...
// DropIdleTail closes idle connection in tail. // It will return true if tail connection was idle and dropped
[ "DropIdleTail", "closes", "idle", "connection", "in", "tail", ".", "It", "will", "return", "true", "if", "tail", "connection", "was", "idle", "and", "dropped" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection_heap.go#L87-L108
9,924
aerospike/aerospike-client-go
connection_heap.go
Len
func (h *singleConnectionHeap) Len() int { cnt := 0 h.mutex.Lock() if !h.full { if h.head >= h.tail { cnt = int(h.head) - int(h.tail) } else { cnt = int(h.size) - (int(h.tail) - int(h.head)) } } else { cnt = int(h.size) } h.mutex.Unlock() return cnt }
go
func (h *singleConnectionHeap) Len() int { cnt := 0 h.mutex.Lock() if !h.full { if h.head >= h.tail { cnt = int(h.head) - int(h.tail) } else { cnt = int(h.size) - (int(h.tail) - int(h.head)) } } else { cnt = int(h.size) } h.mutex.Unlock() return cnt }
[ "func", "(", "h", "*", "singleConnectionHeap", ")", "Len", "(", ")", "int", "{", "cnt", ":=", "0", "\n", "h", ".", "mutex", ".", "Lock", "(", ")", "\n\n", "if", "!", "h", ".", "full", "{", "if", "h", ".", "head", ">=", "h", ".", "tail", "{", ...
// Len returns the number of connections in the heap
[ "Len", "returns", "the", "number", "of", "connections", "in", "the", "heap" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection_heap.go#L111-L126
9,925
aerospike/aerospike-client-go
connection_heap.go
DropIdle
func (h *connectionHeap) DropIdle() { for i := 0; i < len(h.heaps); i++ { for h.heaps[i].DropIdleTail() { } } }
go
func (h *connectionHeap) DropIdle() { for i := 0; i < len(h.heaps); i++ { for h.heaps[i].DropIdleTail() { } } }
[ "func", "(", "h", "*", "connectionHeap", ")", "DropIdle", "(", ")", "{", "for", "i", ":=", "0", ";", "i", "<", "len", "(", "h", ".", "heaps", ")", ";", "i", "++", "{", "for", "h", ".", "heaps", "[", "i", "]", ".", "DropIdleTail", "(", ")", ...
// DropIdle closes all idle connections.
[ "DropIdle", "closes", "all", "idle", "connections", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection_heap.go#L191-L196
9,926
aerospike/aerospike-client-go
connection_heap.go
Len
func (h *connectionHeap) Len(hint byte) (cnt int) { if int(hint) < len(h.heaps) { cnt = h.heaps[hint].Len() } else { for i := range h.heaps { cnt += h.heaps[i].Len() } } return cnt }
go
func (h *connectionHeap) Len(hint byte) (cnt int) { if int(hint) < len(h.heaps) { cnt = h.heaps[hint].Len() } else { for i := range h.heaps { cnt += h.heaps[i].Len() } } return cnt }
[ "func", "(", "h", "*", "connectionHeap", ")", "Len", "(", "hint", "byte", ")", "(", "cnt", "int", ")", "{", "if", "int", "(", "hint", ")", "<", "len", "(", "h", ".", "heaps", ")", "{", "cnt", "=", "h", ".", "heaps", "[", "hint", "]", ".", "...
// Len returns the number of connections in all or a specific sub-heap. // If hint is < 0 or invalid, then the total number of connections will be returned.
[ "Len", "returns", "the", "number", "of", "connections", "in", "all", "or", "a", "specific", "sub", "-", "heap", ".", "If", "hint", "is", "<", "0", "or", "invalid", "then", "the", "total", "number", "of", "connections", "will", "be", "returned", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection_heap.go#L205-L215
9,927
aerospike/aerospike-client-go
partitions.go
clone
func (p *Partitions) clone() *Partitions { replicas := make([][]*Node, len(p.Replicas)) for i := range p.Replicas { r := make([]*Node, len(p.Replicas[i])) copy(r, p.Replicas[i]) replicas[i] = r } regimes := make([]int, len(p.regimes)) copy(regimes, p.regimes) return &Partitions{ Replicas: replicas, C...
go
func (p *Partitions) clone() *Partitions { replicas := make([][]*Node, len(p.Replicas)) for i := range p.Replicas { r := make([]*Node, len(p.Replicas[i])) copy(r, p.Replicas[i]) replicas[i] = r } regimes := make([]int, len(p.regimes)) copy(regimes, p.regimes) return &Partitions{ Replicas: replicas, C...
[ "func", "(", "p", "*", "Partitions", ")", "clone", "(", ")", "*", "Partitions", "{", "replicas", ":=", "make", "(", "[", "]", "[", "]", "*", "Node", ",", "len", "(", "p", ".", "Replicas", ")", ")", "\n\n", "for", "i", ":=", "range", "p", ".", ...
// Copy partition map while reserving space for a new replica count.
[ "Copy", "partition", "map", "while", "reserving", "space", "for", "a", "new", "replica", "count", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/partitions.go#L60-L77
9,928
aerospike/aerospike-client-go
partitions.go
validate
func (pm partitionMap) validate() error { masterNodePartitionNotDefined := map[string][]int{} replicaNodePartitionNotDefined := map[string][]int{} var errList []error for nsName, partition := range pm { if len(partition.regimes) != _PARTITIONS { errList = append(errList, fmt.Errorf("Wrong number of regimes fo...
go
func (pm partitionMap) validate() error { masterNodePartitionNotDefined := map[string][]int{} replicaNodePartitionNotDefined := map[string][]int{} var errList []error for nsName, partition := range pm { if len(partition.regimes) != _PARTITIONS { errList = append(errList, fmt.Errorf("Wrong number of regimes fo...
[ "func", "(", "pm", "partitionMap", ")", "validate", "(", ")", "error", "{", "masterNodePartitionNotDefined", ":=", "map", "[", "string", "]", "[", "]", "int", "{", "}", "\n", "replicaNodePartitionNotDefined", ":=", "map", "[", "string", "]", "[", "]", "int...
// naively validates the partition map
[ "naively", "validates", "the", "partition", "map" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/partitions.go#L129-L170
9,929
aerospike/aerospike-client-go
examples/batch.go
writeRecords
func writeRecords( client *as.Client, keyPrefix string, binName string, valuePrefix string, size int, ) { for i := 1; i <= size; i++ { key, _ := as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i)) bin := as.NewBin(binName, valuePrefix+strconv.Itoa(i)) log.Printf("Put: ns=%s set=%s key=%s b...
go
func writeRecords( client *as.Client, keyPrefix string, binName string, valuePrefix string, size int, ) { for i := 1; i <= size; i++ { key, _ := as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i)) bin := as.NewBin(binName, valuePrefix+strconv.Itoa(i)) log.Printf("Put: ns=%s set=%s key=%s b...
[ "func", "writeRecords", "(", "client", "*", "as", ".", "Client", ",", "keyPrefix", "string", ",", "binName", "string", ",", "valuePrefix", "string", ",", "size", "int", ",", ")", "{", "for", "i", ":=", "1", ";", "i", "<=", "size", ";", "i", "++", "...
/** * Write records individually. */
[ "Write", "records", "individually", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/batch.go#L45-L61
9,930
aerospike/aerospike-client-go
examples/batch.go
batchExists
func batchExists( client *as.Client, keyPrefix string, size int, ) { // Batch into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } existsArray, err := client.BatchExists(nil, keys) shared.PanicOnError(...
go
func batchExists( client *as.Client, keyPrefix string, size int, ) { // Batch into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } existsArray, err := client.BatchExists(nil, keys) shared.PanicOnError(...
[ "func", "batchExists", "(", "client", "*", "as", ".", "Client", ",", "keyPrefix", "string", ",", "size", "int", ",", ")", "{", "// Batch into one call.", "keys", ":=", "make", "(", "[", "]", "*", "as", ".", "Key", ",", "size", ")", "\n", "for", "i", ...
/** * Check existence of records in one batch. */
[ "Check", "existence", "of", "records", "in", "one", "batch", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/batch.go#L66-L87
9,931
aerospike/aerospike-client-go
examples/batch.go
batchReads
func batchReads( client *as.Client, keyPrefix string, binName string, size int, ) { // Batch gets into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } records, err := client.BatchGet(nil, keys, binName)...
go
func batchReads( client *as.Client, keyPrefix string, binName string, size int, ) { // Batch gets into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } records, err := client.BatchGet(nil, keys, binName)...
[ "func", "batchReads", "(", "client", "*", "as", ".", "Client", ",", "keyPrefix", "string", ",", "binName", "string", ",", "size", "int", ",", ")", "{", "// Batch gets into one call.", "keys", ":=", "make", "(", "[", "]", "*", "as", ".", "Key", ",", "si...
/** * Read records in one batch. */
[ "Read", "records", "in", "one", "batch", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/batch.go#L92-L124
9,932
aerospike/aerospike-client-go
examples/batch.go
batchReadHeaders
func batchReadHeaders( client *as.Client, keyPrefix string, size int, ) { // Batch gets into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } records, err := client.BatchGetHeader(nil, keys) shared.Panic...
go
func batchReadHeaders( client *as.Client, keyPrefix string, size int, ) { // Batch gets into one call. keys := make([]*as.Key, size) for i := 0; i < size; i++ { keys[i], _ = as.NewKey(*shared.Namespace, *shared.Set, keyPrefix+strconv.Itoa(i+1)) } records, err := client.BatchGetHeader(nil, keys) shared.Panic...
[ "func", "batchReadHeaders", "(", "client", "*", "as", ".", "Client", ",", "keyPrefix", "string", ",", "size", "int", ",", ")", "{", "// Batch gets into one call.", "keys", ":=", "make", "(", "[", "]", "*", "as", ".", "Key", ",", "size", ")", "\n", "for...
/** * Read record header data in one batch. */
[ "Read", "record", "header", "data", "in", "one", "batch", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/batch.go#L129-L162
9,933
aerospike/aerospike-client-go
task_register.go
NewRegisterTask
func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask { return &RegisterTask{ baseTask: newTask(cluster), packageName: packageName, } }
go
func NewRegisterTask(cluster *Cluster, packageName string) *RegisterTask { return &RegisterTask{ baseTask: newTask(cluster), packageName: packageName, } }
[ "func", "NewRegisterTask", "(", "cluster", "*", "Cluster", ",", "packageName", "string", ")", "*", "RegisterTask", "{", "return", "&", "RegisterTask", "{", "baseTask", ":", "newTask", "(", "cluster", ")", ",", "packageName", ":", "packageName", ",", "}", "\n...
// NewRegisterTask initializes a RegisterTask with fields needed to query server nodes.
[ "NewRegisterTask", "initializes", "a", "RegisterTask", "with", "fields", "needed", "to", "query", "server", "nodes", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/task_register.go#L29-L34
9,934
aerospike/aerospike-client-go
task_register.go
IsDone
func (tskr *RegisterTask) IsDone() (bool, error) { command := "udf-list" nodes := tskr.cluster.GetNodes() done := false for _, node := range nodes { responseMap, err := node.requestInfoWithRetry(&tskr.cluster.infoPolicy, 5, command) if err != nil { return false, err } for _, response := range responseM...
go
func (tskr *RegisterTask) IsDone() (bool, error) { command := "udf-list" nodes := tskr.cluster.GetNodes() done := false for _, node := range nodes { responseMap, err := node.requestInfoWithRetry(&tskr.cluster.infoPolicy, 5, command) if err != nil { return false, err } for _, response := range responseM...
[ "func", "(", "tskr", "*", "RegisterTask", ")", "IsDone", "(", ")", "(", "bool", ",", "error", ")", "{", "command", ":=", "\"", "\"", "\n", "nodes", ":=", "tskr", ".", "cluster", ".", "GetNodes", "(", ")", "\n", "done", ":=", "false", "\n\n", "for",...
// IsDone will query all nodes for task completion status.
[ "IsDone", "will", "query", "all", "nodes", "for", "task", "completion", "status", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/task_register.go#L37-L59
9,935
aerospike/aerospike-client-go
internal/lua/lua_list.go
registerLuaListType
func registerLuaListType(L *lua.LState) { mt := L.NewTypeMetatable(luaLuaListTypeName) // List package L.SetGlobal("List", mt) // static attributes L.SetMetatable(mt, mt) // list package mt = L.NewTypeMetatable(luaLuaListTypeName) L.SetGlobal("list", mt) // static attributes L.SetField(mt, "__call", L.Ne...
go
func registerLuaListType(L *lua.LState) { mt := L.NewTypeMetatable(luaLuaListTypeName) // List package L.SetGlobal("List", mt) // static attributes L.SetMetatable(mt, mt) // list package mt = L.NewTypeMetatable(luaLuaListTypeName) L.SetGlobal("list", mt) // static attributes L.SetField(mt, "__call", L.Ne...
[ "func", "registerLuaListType", "(", "L", "*", "lua", ".", "LState", ")", "{", "mt", ":=", "L", ".", "NewTypeMetatable", "(", "luaLuaListTypeName", ")", "\n\n", "// List package", "L", ".", "SetGlobal", "(", "\"", "\"", ",", "mt", ")", "\n\n", "// static at...
// Registers my luaList type to given L.
[ "Registers", "my", "luaList", "type", "to", "given", "L", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/lua/lua_list.go#L32-L72
9,936
aerospike/aerospike-client-go
internal/atomic/array.go
NewAtomicArray
func NewAtomicArray(length int) *AtomicArray { return &AtomicArray{ length: length, items: make([]interface{}, length), } }
go
func NewAtomicArray(length int) *AtomicArray { return &AtomicArray{ length: length, items: make([]interface{}, length), } }
[ "func", "NewAtomicArray", "(", "length", "int", ")", "*", "AtomicArray", "{", "return", "&", "AtomicArray", "{", "length", ":", "length", ",", "items", ":", "make", "(", "[", "]", "interface", "{", "}", ",", "length", ")", ",", "}", "\n", "}" ]
// NewAtomicArray generates a new AtomicArray instance.
[ "NewAtomicArray", "generates", "a", "new", "AtomicArray", "instance", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/array.go#L30-L35
9,937
aerospike/aerospike-client-go
internal/atomic/array.go
Get
func (aa *AtomicArray) Get(idx int) interface{} { // do not lock if not needed if idx < 0 || idx >= aa.length { return nil } aa.mutex.RLock() res := aa.items[idx] aa.mutex.RUnlock() return res }
go
func (aa *AtomicArray) Get(idx int) interface{} { // do not lock if not needed if idx < 0 || idx >= aa.length { return nil } aa.mutex.RLock() res := aa.items[idx] aa.mutex.RUnlock() return res }
[ "func", "(", "aa", "*", "AtomicArray", ")", "Get", "(", "idx", "int", ")", "interface", "{", "}", "{", "// do not lock if not needed", "if", "idx", "<", "0", "||", "idx", ">=", "aa", ".", "length", "{", "return", "nil", "\n", "}", "\n\n", "aa", ".", ...
// Get atomically retrieves an element from the Array. // If idx is out of range, it will return nil
[ "Get", "atomically", "retrieves", "an", "element", "from", "the", "Array", ".", "If", "idx", "is", "out", "of", "range", "it", "will", "return", "nil" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/array.go#L39-L49
9,938
aerospike/aerospike-client-go
internal/atomic/array.go
Set
func (aa *AtomicArray) Set(idx int, node interface{}) error { // do not lock if not needed if idx < 0 || idx >= aa.length { return fmt.Errorf("index %d is larger than array size (%d)", idx, aa.length) } aa.mutex.Lock() aa.items[idx] = node aa.mutex.Unlock() return nil }
go
func (aa *AtomicArray) Set(idx int, node interface{}) error { // do not lock if not needed if idx < 0 || idx >= aa.length { return fmt.Errorf("index %d is larger than array size (%d)", idx, aa.length) } aa.mutex.Lock() aa.items[idx] = node aa.mutex.Unlock() return nil }
[ "func", "(", "aa", "*", "AtomicArray", ")", "Set", "(", "idx", "int", ",", "node", "interface", "{", "}", ")", "error", "{", "// do not lock if not needed", "if", "idx", "<", "0", "||", "idx", ">=", "aa", ".", "length", "{", "return", "fmt", ".", "Er...
// Set atomically sets an element in the Array. // If idx is out of range, it will return an error
[ "Set", "atomically", "sets", "an", "element", "in", "the", "Array", ".", "If", "idx", "is", "out", "of", "range", "it", "will", "return", "an", "error" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/array.go#L53-L63
9,939
aerospike/aerospike-client-go
internal/atomic/array.go
Length
func (aa *AtomicArray) Length() int { aa.mutex.RLock() res := aa.length aa.mutex.RUnlock() return res }
go
func (aa *AtomicArray) Length() int { aa.mutex.RLock() res := aa.length aa.mutex.RUnlock() return res }
[ "func", "(", "aa", "*", "AtomicArray", ")", "Length", "(", ")", "int", "{", "aa", ".", "mutex", ".", "RLock", "(", ")", "\n", "res", ":=", "aa", ".", "length", "\n", "aa", ".", "mutex", ".", "RUnlock", "(", ")", "\n\n", "return", "res", "\n", "...
// Length returns the array size.
[ "Length", "returns", "the", "array", "size", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/array.go#L66-L72
9,940
aerospike/aerospike-client-go
generics.go
PackList
func (ts stringSlice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackString(buf, elem) size += n if err != nil { return size, err } } return size, nil }
go
func (ts stringSlice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackString(buf, elem) size += n if err != nil { return size, err } } return size, nil }
[ "func", "(", "ts", "stringSlice", ")", "PackList", "(", "buf", "BufferEx", ")", "(", "int", ",", "error", ")", "{", "size", ":=", "0", "\n", "for", "_", ",", "elem", ":=", "range", "ts", "{", "n", ",", "err", ":=", "PackString", "(", "buf", ",", ...
// PackList packs StringSlice as msgpack.
[ "PackList", "packs", "StringSlice", "as", "msgpack", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/generics.go#L20-L30
9,941
aerospike/aerospike-client-go
generics.go
PackList
func (ts intSlice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackInt64(buf, int64(elem)) size += n if err != nil { return size, err } } return size, nil }
go
func (ts intSlice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackInt64(buf, int64(elem)) size += n if err != nil { return size, err } } return size, nil }
[ "func", "(", "ts", "intSlice", ")", "PackList", "(", "buf", "BufferEx", ")", "(", "int", ",", "error", ")", "{", "size", ":=", "0", "\n", "for", "_", ",", "elem", ":=", "range", "ts", "{", "n", ",", "err", ":=", "PackInt64", "(", "buf", ",", "i...
// PackList packs IntSlice as msgpack.
[ "PackList", "packs", "IntSlice", "as", "msgpack", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/generics.go#L40-L50
9,942
aerospike/aerospike-client-go
generics.go
PackList
func (ts uint64Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackUInt64(buf, elem) size += n if err != nil { return size, err } } return size, nil }
go
func (ts uint64Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackUInt64(buf, elem) size += n if err != nil { return size, err } } return size, nil }
[ "func", "(", "ts", "uint64Slice", ")", "PackList", "(", "buf", "BufferEx", ")", "(", "int", ",", "error", ")", "{", "size", ":=", "0", "\n", "for", "_", ",", "elem", ":=", "range", "ts", "{", "n", ",", "err", ":=", "PackUInt64", "(", "buf", ",", ...
// PackList packs Uint64Slice as msgpack.
[ "PackList", "packs", "Uint64Slice", "as", "msgpack", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/generics.go#L180-L190
9,943
aerospike/aerospike-client-go
generics.go
PackList
func (ts float32Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackFloat32(buf, elem) size += n if err != nil { return size, err } } return size, nil }
go
func (ts float32Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackFloat32(buf, elem) size += n if err != nil { return size, err } } return size, nil }
[ "func", "(", "ts", "float32Slice", ")", "PackList", "(", "buf", "BufferEx", ")", "(", "int", ",", "error", ")", "{", "size", ":=", "0", "\n", "for", "_", ",", "elem", ":=", "range", "ts", "{", "n", ",", "err", ":=", "PackFloat32", "(", "buf", ","...
// PackList packs Float32Slice as msgpack.
[ "PackList", "packs", "Float32Slice", "as", "msgpack", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/generics.go#L200-L210
9,944
aerospike/aerospike-client-go
generics.go
PackList
func (ts float64Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackFloat64(buf, elem) size += n if err != nil { return size, err } } return size, nil }
go
func (ts float64Slice) PackList(buf BufferEx) (int, error) { size := 0 for _, elem := range ts { n, err := PackFloat64(buf, elem) size += n if err != nil { return size, err } } return size, nil }
[ "func", "(", "ts", "float64Slice", ")", "PackList", "(", "buf", "BufferEx", ")", "(", "int", ",", "error", ")", "{", "size", ":=", "0", "\n", "for", "_", ",", "elem", ":=", "range", "ts", "{", "n", ",", "err", ":=", "PackFloat64", "(", "buf", ","...
// PackList packs Float64Slice as msgpack.
[ "PackList", "packs", "Float64Slice", "as", "msgpack", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/generics.go#L220-L230
9,945
aerospike/aerospike-client-go
packer.go
PackList
func PackList(cmd BufferEx, list ListIter) (int, error) { return packList(cmd, list) }
go
func PackList(cmd BufferEx, list ListIter) (int, error) { return packList(cmd, list) }
[ "func", "PackList", "(", "cmd", "BufferEx", ",", "list", "ListIter", ")", "(", "int", ",", "error", ")", "{", "return", "packList", "(", "cmd", ",", "list", ")", "\n", "}" ]
// PackList packs any slice that implement the ListIter interface
[ "PackList", "packs", "any", "slice", "that", "implement", "the", "ListIter", "interface" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L51-L53
9,946
aerospike/aerospike-client-go
packer.go
PackJson
func PackJson(cmd BufferEx, theMap map[string]interface{}) (int, error) { return packJsonMap(cmd, theMap) }
go
func PackJson(cmd BufferEx, theMap map[string]interface{}) (int, error) { return packJsonMap(cmd, theMap) }
[ "func", "PackJson", "(", "cmd", "BufferEx", ",", "theMap", "map", "[", "string", "]", "interface", "{", "}", ")", "(", "int", ",", "error", ")", "{", "return", "packJsonMap", "(", "cmd", ",", "theMap", ")", "\n", "}" ]
// PackJson packs json data
[ "PackJson", "packs", "json", "data" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L121-L123
9,947
aerospike/aerospike-client-go
packer.go
PackMap
func PackMap(cmd BufferEx, theMap MapIter) (int, error) { return packMap(cmd, theMap) }
go
func PackMap(cmd BufferEx, theMap MapIter) (int, error) { return packMap(cmd, theMap) }
[ "func", "PackMap", "(", "cmd", "BufferEx", ",", "theMap", "MapIter", ")", "(", "int", ",", "error", ")", "{", "return", "packMap", "(", "cmd", ",", "theMap", ")", "\n", "}" ]
// PackMap packs any map that implements the MapIter interface
[ "PackMap", "packs", "any", "map", "that", "implements", "the", "MapIter", "interface" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L150-L152
9,948
aerospike/aerospike-client-go
packer.go
PackBytes
func PackBytes(cmd BufferEx, b []byte) (int, error) { return packBytes(cmd, b) }
go
func PackBytes(cmd BufferEx, b []byte) (int, error) { return packBytes(cmd, b) }
[ "func", "PackBytes", "(", "cmd", "BufferEx", ",", "b", "[", "]", "byte", ")", "(", "int", ",", "error", ")", "{", "return", "packBytes", "(", "cmd", ",", "b", ")", "\n", "}" ]
// PackBytes backs a byte array
[ "PackBytes", "backs", "a", "byte", "array" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L177-L179
9,949
aerospike/aerospike-client-go
packer.go
PackInt64
func PackInt64(cmd BufferEx, val int64) (int, error) { return packAInt64(cmd, val) }
go
func PackInt64(cmd BufferEx, val int64) (int, error) { return packAInt64(cmd, val) }
[ "func", "PackInt64", "(", "cmd", "BufferEx", ",", "val", "int64", ")", "(", "int", ",", "error", ")", "{", "return", "packAInt64", "(", "cmd", ",", "val", ")", "\n", "}" ]
// PackInt64 packs an int64
[ "PackInt64", "packs", "an", "int64" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L343-L345
9,950
aerospike/aerospike-client-go
packer.go
PackString
func PackString(cmd BufferEx, val string) (int, error) { return packString(cmd, val) }
go
func PackString(cmd BufferEx, val string) (int, error) { return packString(cmd, val) }
[ "func", "PackString", "(", "cmd", "BufferEx", ",", "val", "string", ")", "(", "int", ",", "error", ")", "{", "return", "packString", "(", "cmd", ",", "val", ")", "\n", "}" ]
// PackString packs a string
[ "PackString", "packs", "a", "string" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L352-L354
9,951
aerospike/aerospike-client-go
packer.go
PackUInt64
func PackUInt64(cmd BufferEx, val uint64) (int, error) { return packUInt64(cmd, val) }
go
func PackUInt64(cmd BufferEx, val uint64) (int, error) { return packUInt64(cmd, val) }
[ "func", "PackUInt64", "(", "cmd", "BufferEx", ",", "val", "uint64", ")", "(", "int", ",", "error", ")", "{", "return", "packUInt64", "(", "cmd", ",", "val", ")", "\n", "}" ]
// PackUInt64 packs a uint64
[ "PackUInt64", "packs", "a", "uint64" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L433-L435
9,952
aerospike/aerospike-client-go
packer.go
PackBool
func PackBool(cmd BufferEx, val bool) (int, error) { return packBool(cmd, val) }
go
func PackBool(cmd BufferEx, val bool) (int, error) { return packBool(cmd, val) }
[ "func", "PackBool", "(", "cmd", "BufferEx", ",", "val", "bool", ")", "(", "int", ",", "error", ")", "{", "return", "packBool", "(", "cmd", ",", "val", ")", "\n", "}" ]
// Pack bool packs a bool value
[ "Pack", "bool", "packs", "a", "bool", "value" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L569-L571
9,953
aerospike/aerospike-client-go
packer.go
PackFloat32
func PackFloat32(cmd BufferEx, val float32) (int, error) { return packFloat32(cmd, val) }
go
func PackFloat32(cmd BufferEx, val float32) (int, error) { return packFloat32(cmd, val) }
[ "func", "PackFloat32", "(", "cmd", "BufferEx", ",", "val", "float32", ")", "(", "int", ",", "error", ")", "{", "return", "packFloat32", "(", "cmd", ",", "val", ")", "\n", "}" ]
// PackFloat32 packs float32 value
[ "PackFloat32", "packs", "float32", "value" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L584-L586
9,954
aerospike/aerospike-client-go
packer.go
PackFloat64
func PackFloat64(cmd BufferEx, val float64) (int, error) { return packFloat64(cmd, val) }
go
func PackFloat64(cmd BufferEx, val float64) (int, error) { return packFloat64(cmd, val) }
[ "func", "PackFloat64", "(", "cmd", "BufferEx", ",", "val", "float64", ")", "(", "int", ",", "error", ")", "{", "return", "packFloat64", "(", "cmd", ",", "val", ")", "\n", "}" ]
// PackFloat64 packs float64 value
[ "PackFloat64", "packs", "float64", "value" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/packer.go#L603-L605
9,955
aerospike/aerospike-client-go
operation.go
cache
func (op *Operation) cache() error { packer := newPacker() if _, err := op.encoder(op, packer); err != nil { return err } op.binValue = BytesValue(packer.Bytes()) op.encoder = nil // do not encode anymore; just use the cache op.used = false // do not encode anymore; just use the cache return nil }
go
func (op *Operation) cache() error { packer := newPacker() if _, err := op.encoder(op, packer); err != nil { return err } op.binValue = BytesValue(packer.Bytes()) op.encoder = nil // do not encode anymore; just use the cache op.used = false // do not encode anymore; just use the cache return nil }
[ "func", "(", "op", "*", "Operation", ")", "cache", "(", ")", "error", "{", "packer", ":=", "newPacker", "(", ")", "\n\n", "if", "_", ",", "err", ":=", "op", ".", "encoder", "(", "op", ",", "packer", ")", ";", "err", "!=", "nil", "{", "return", ...
// cache uses the encoder and caches the packed operation for further use.
[ "cache", "uses", "the", "encoder", "and", "caches", "the", "packed", "operation", "for", "further", "use", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L68-L79
9,956
aerospike/aerospike-client-go
operation.go
GetOpForBin
func GetOpForBin(binName string) *Operation { return &Operation{opType: _READ, binName: binName, binValue: NewNullValue()} }
go
func GetOpForBin(binName string) *Operation { return &Operation{opType: _READ, binName: binName, binValue: NewNullValue()} }
[ "func", "GetOpForBin", "(", "binName", "string", ")", "*", "Operation", "{", "return", "&", "Operation", "{", "opType", ":", "_READ", ",", "binName", ":", "binName", ",", "binValue", ":", "NewNullValue", "(", ")", "}", "\n", "}" ]
// GetOpForBin creates read bin database operation.
[ "GetOpForBin", "creates", "read", "bin", "database", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L82-L84
9,957
aerospike/aerospike-client-go
operation.go
PutOp
func PutOp(bin *Bin) *Operation { return &Operation{opType: _WRITE, binName: bin.Name, binValue: bin.Value} }
go
func PutOp(bin *Bin) *Operation { return &Operation{opType: _WRITE, binName: bin.Name, binValue: bin.Value} }
[ "func", "PutOp", "(", "bin", "*", "Bin", ")", "*", "Operation", "{", "return", "&", "Operation", "{", "opType", ":", "_WRITE", ",", "binName", ":", "bin", ".", "Name", ",", "binValue", ":", "bin", ".", "Value", "}", "\n", "}" ]
// PutOp creates set database operation.
[ "PutOp", "creates", "set", "database", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L97-L99
9,958
aerospike/aerospike-client-go
operation.go
AppendOp
func AppendOp(bin *Bin) *Operation { return &Operation{opType: _APPEND, binName: bin.Name, binValue: bin.Value} }
go
func AppendOp(bin *Bin) *Operation { return &Operation{opType: _APPEND, binName: bin.Name, binValue: bin.Value} }
[ "func", "AppendOp", "(", "bin", "*", "Bin", ")", "*", "Operation", "{", "return", "&", "Operation", "{", "opType", ":", "_APPEND", ",", "binName", ":", "bin", ".", "Name", ",", "binValue", ":", "bin", ".", "Value", "}", "\n", "}" ]
// AppendOp creates string append database operation.
[ "AppendOp", "creates", "string", "append", "database", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L102-L104
9,959
aerospike/aerospike-client-go
operation.go
PrependOp
func PrependOp(bin *Bin) *Operation { return &Operation{opType: _PREPEND, binName: bin.Name, binValue: bin.Value} }
go
func PrependOp(bin *Bin) *Operation { return &Operation{opType: _PREPEND, binName: bin.Name, binValue: bin.Value} }
[ "func", "PrependOp", "(", "bin", "*", "Bin", ")", "*", "Operation", "{", "return", "&", "Operation", "{", "opType", ":", "_PREPEND", ",", "binName", ":", "bin", ".", "Name", ",", "binValue", ":", "bin", ".", "Value", "}", "\n", "}" ]
// PrependOp creates string prepend database operation.
[ "PrependOp", "creates", "string", "prepend", "database", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L107-L109
9,960
aerospike/aerospike-client-go
operation.go
AddOp
func AddOp(bin *Bin) *Operation { return &Operation{opType: _ADD, binName: bin.Name, binValue: bin.Value} }
go
func AddOp(bin *Bin) *Operation { return &Operation{opType: _ADD, binName: bin.Name, binValue: bin.Value} }
[ "func", "AddOp", "(", "bin", "*", "Bin", ")", "*", "Operation", "{", "return", "&", "Operation", "{", "opType", ":", "_ADD", ",", "binName", ":", "bin", ".", "Name", ",", "binValue", ":", "bin", ".", "Value", "}", "\n", "}" ]
// AddOp creates integer add database operation.
[ "AddOp", "creates", "integer", "add", "database", "operation", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/operation.go#L112-L114
9,961
aerospike/aerospike-client-go
multi_policy.go
NewMultiPolicy
func NewMultiPolicy() *MultiPolicy { bp := *NewPolicy() bp.SocketTimeout = 30 * time.Second return &MultiPolicy{ BasePolicy: bp, MaxConcurrentNodes: 0, RecordQueueSize: 50, IncludeBinData: true, FailOnClusterChange: true, } }
go
func NewMultiPolicy() *MultiPolicy { bp := *NewPolicy() bp.SocketTimeout = 30 * time.Second return &MultiPolicy{ BasePolicy: bp, MaxConcurrentNodes: 0, RecordQueueSize: 50, IncludeBinData: true, FailOnClusterChange: true, } }
[ "func", "NewMultiPolicy", "(", ")", "*", "MultiPolicy", "{", "bp", ":=", "*", "NewPolicy", "(", ")", "\n", "bp", ".", "SocketTimeout", "=", "30", "*", "time", ".", "Second", "\n\n", "return", "&", "MultiPolicy", "{", "BasePolicy", ":", "bp", ",", "MaxC...
// NewMultiPolicy initializes a MultiPolicy instance with default values.
[ "NewMultiPolicy", "initializes", "a", "MultiPolicy", "instance", "with", "default", "values", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/multi_policy.go#L45-L56
9,962
aerospike/aerospike-client-go
types/buffer_pool.go
Get
func (bp *BufferPool) Get() (res []byte) { bp.mutex.Lock() if bp.pos >= 0 { res = bp.pool[bp.pos] bp.pos-- } else { res = make([]byte, bp.initBufSize, bp.initBufSize) } bp.mutex.Unlock() return res }
go
func (bp *BufferPool) Get() (res []byte) { bp.mutex.Lock() if bp.pos >= 0 { res = bp.pool[bp.pos] bp.pos-- } else { res = make([]byte, bp.initBufSize, bp.initBufSize) } bp.mutex.Unlock() return res }
[ "func", "(", "bp", "*", "BufferPool", ")", "Get", "(", ")", "(", "res", "[", "]", "byte", ")", "{", "bp", ".", "mutex", ".", "Lock", "(", ")", "\n", "if", "bp", ".", "pos", ">=", "0", "{", "res", "=", "bp", ".", "pool", "[", "bp", ".", "p...
// Get returns a buffer from the pool. If pool is empty, a new buffer of // size initBufSize will be created and returned.
[ "Get", "returns", "a", "buffer", "from", "the", "pool", ".", "If", "pool", "is", "empty", "a", "new", "buffer", "of", "size", "initBufSize", "will", "be", "created", "and", "returned", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/buffer_pool.go#L51-L62
9,963
aerospike/aerospike-client-go
node.go
newNode
func newNode(cluster *Cluster, nv *nodeValidator) *Node { newNode := &Node{ cluster: cluster, name: nv.name, // address: nv.primaryAddress, host: nv.primaryHost, // Assign host to first IP alias because the server identifies nodes // by IP address (not hostname). connections: *newConnectionHe...
go
func newNode(cluster *Cluster, nv *nodeValidator) *Node { newNode := &Node{ cluster: cluster, name: nv.name, // address: nv.primaryAddress, host: nv.primaryHost, // Assign host to first IP alias because the server identifies nodes // by IP address (not hostname). connections: *newConnectionHe...
[ "func", "newNode", "(", "cluster", "*", "Cluster", ",", "nv", "*", "nodeValidator", ")", "*", "Node", "{", "newNode", ":=", "&", "Node", "{", "cluster", ":", "cluster", ",", "name", ":", "nv", ".", "name", ",", "// address: nv.primaryAddress,", "host", "...
// NewNode initializes a server node with connection parameters.
[ "NewNode", "initializes", "a", "server", "node", "with", "connection", "parameters", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L73-L109
9,964
aerospike/aerospike-client-go
node.go
refreshSessionToken
func (nd *Node) refreshSessionToken() error { // no session token to refresh if !nd.cluster.clientPolicy.RequiresAuthentication() || nd.cluster.clientPolicy.AuthMode != AuthModeExternal { return nil } var deadline time.Time deadlineIfc := nd._sessionExpiration.Load() if deadlineIfc != nil { deadline = deadli...
go
func (nd *Node) refreshSessionToken() error { // no session token to refresh if !nd.cluster.clientPolicy.RequiresAuthentication() || nd.cluster.clientPolicy.AuthMode != AuthModeExternal { return nil } var deadline time.Time deadlineIfc := nd._sessionExpiration.Load() if deadlineIfc != nil { deadline = deadli...
[ "func", "(", "nd", "*", "Node", ")", "refreshSessionToken", "(", ")", "error", "{", "// no session token to refresh", "if", "!", "nd", ".", "cluster", ".", "clientPolicy", ".", "RequiresAuthentication", "(", ")", "||", "nd", ".", "cluster", ".", "clientPolicy"...
// refreshSessionToken refreshes the session token if it has been expired
[ "refreshSessionToken", "refreshes", "the", "session", "token", "if", "it", "has", "been", "expired" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L203-L237
9,965
aerospike/aerospike-client-go
node.go
GetConnection
func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err error) { if timeout == 0 { timeout = _DEFAULT_TIMEOUT } deadline := time.Now().Add(timeout) return nd.getConnection(deadline, timeout) }
go
func (nd *Node) GetConnection(timeout time.Duration) (conn *Connection, err error) { if timeout == 0 { timeout = _DEFAULT_TIMEOUT } deadline := time.Now().Add(timeout) return nd.getConnection(deadline, timeout) }
[ "func", "(", "nd", "*", "Node", ")", "GetConnection", "(", "timeout", "time", ".", "Duration", ")", "(", "conn", "*", "Connection", ",", "err", "error", ")", "{", "if", "timeout", "==", "0", "{", "timeout", "=", "_DEFAULT_TIMEOUT", "\n", "}", "\n", "...
// 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.
[ "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", ...
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L492-L499
9,966
aerospike/aerospike-client-go
node.go
getConnection
func (nd *Node) getConnection(deadline time.Time, timeout time.Duration) (conn *Connection, err error) { return nd.getConnectionWithHint(deadline, timeout, 0) }
go
func (nd *Node) getConnection(deadline time.Time, timeout time.Duration) (conn *Connection, err error) { return nd.getConnectionWithHint(deadline, timeout, 0) }
[ "func", "(", "nd", "*", "Node", ")", "getConnection", "(", "deadline", "time", ".", "Time", ",", "timeout", "time", ".", "Duration", ")", "(", "conn", "*", "Connection", ",", "err", "error", ")", "{", "return", "nd", ".", "getConnectionWithHint", "(", ...
// getConnection gets a connection to the node. // If no pooled connection is available, a new connection will be created.
[ "getConnection", "gets", "a", "connection", "to", "the", "node", ".", "If", "no", "pooled", "connection", "is", "available", "a", "new", "connection", "will", "be", "created", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L503-L505
9,967
aerospike/aerospike-client-go
node.go
connectionLimitReached
func (nd *Node) connectionLimitReached() (res bool) { if nd.cluster.clientPolicy.LimitConnectionsToQueueSize { cc := nd.connectionCount.IncrementAndGet() if cc > nd.cluster.clientPolicy.ConnectionQueueSize { res = true } nd.connectionCount.DecrementAndGet() } return res }
go
func (nd *Node) connectionLimitReached() (res bool) { if nd.cluster.clientPolicy.LimitConnectionsToQueueSize { cc := nd.connectionCount.IncrementAndGet() if cc > nd.cluster.clientPolicy.ConnectionQueueSize { res = true } nd.connectionCount.DecrementAndGet() } return res }
[ "func", "(", "nd", "*", "Node", ")", "connectionLimitReached", "(", ")", "(", "res", "bool", ")", "{", "if", "nd", ".", "cluster", ".", "clientPolicy", ".", "LimitConnectionsToQueueSize", "{", "cc", ":=", "nd", ".", "connectionCount", ".", "IncrementAndGet",...
// connectionLimitReached return true if connection pool is fully serviced.
[ "connectionLimitReached", "return", "true", "if", "connection", "pool", "is", "fully", "serviced", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L508-L519
9,968
aerospike/aerospike-client-go
node.go
newConnection
func (nd *Node) newConnection(overrideThreshold bool) (*Connection, error) { // if connection count is limited and enough connections are already created, don't create a new one cc := nd.connectionCount.IncrementAndGet() if nd.cluster.clientPolicy.LimitConnectionsToQueueSize && cc > nd.cluster.clientPolicy.Connectio...
go
func (nd *Node) newConnection(overrideThreshold bool) (*Connection, error) { // if connection count is limited and enough connections are already created, don't create a new one cc := nd.connectionCount.IncrementAndGet() if nd.cluster.clientPolicy.LimitConnectionsToQueueSize && cc > nd.cluster.clientPolicy.Connectio...
[ "func", "(", "nd", "*", "Node", ")", "newConnection", "(", "overrideThreshold", "bool", ")", "(", "*", "Connection", ",", "error", ")", "{", "// if connection count is limited and enough connections are already created, don't create a new one", "cc", ":=", "nd", ".", "c...
// newConnection will make a new connection for the node.
[ "newConnection", "will", "make", "a", "new", "connection", "for", "the", "node", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L522-L565
9,969
aerospike/aerospike-client-go
node.go
makeConnectionForPool
func (nd *Node) makeConnectionForPool(deadline time.Time, hint byte) { if deadline.IsZero() { deadline = time.Now().Add(_DEFAULT_TIMEOUT) } // don't even try to make a new connection if connection limit is reached if nd.connectionLimitReached() { return } L: // don't loop forever; free the goroutine after t...
go
func (nd *Node) makeConnectionForPool(deadline time.Time, hint byte) { if deadline.IsZero() { deadline = time.Now().Add(_DEFAULT_TIMEOUT) } // don't even try to make a new connection if connection limit is reached if nd.connectionLimitReached() { return } L: // don't loop forever; free the goroutine after t...
[ "func", "(", "nd", "*", "Node", ")", "makeConnectionForPool", "(", "deadline", "time", ".", "Time", ",", "hint", "byte", ")", "{", "if", "deadline", ".", "IsZero", "(", ")", "{", "deadline", "=", "time", ".", "Now", "(", ")", ".", "Add", "(", "_DEF...
// makeConnectionForPool will try to open a connection until deadline. // if no deadline is defined, it will only try for _DEFAULT_TIMEOUT.
[ "makeConnectionForPool", "will", "try", "to", "open", "a", "connection", "until", "deadline", ".", "if", "no", "deadline", "is", "defined", "it", "will", "only", "try", "for", "_DEFAULT_TIMEOUT", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L569-L601
9,970
aerospike/aerospike-client-go
node.go
getConnectionWithHint
func (nd *Node) getConnectionWithHint(deadline time.Time, timeout time.Duration, hint byte) (conn *Connection, err error) { var socketDeadline time.Time connReqd := false L: // try to get a valid connection from the connection pool for conn = nd.connections.Poll(hint); conn != nil; conn = nd.connections.Poll(hint...
go
func (nd *Node) getConnectionWithHint(deadline time.Time, timeout time.Duration, hint byte) (conn *Connection, err error) { var socketDeadline time.Time connReqd := false L: // try to get a valid connection from the connection pool for conn = nd.connections.Poll(hint); conn != nil; conn = nd.connections.Poll(hint...
[ "func", "(", "nd", "*", "Node", ")", "getConnectionWithHint", "(", "deadline", "time", ".", "Time", ",", "timeout", "time", ".", "Duration", ",", "hint", "byte", ")", "(", "conn", "*", "Connection", ",", "err", "error", ")", "{", "var", "socketDeadline",...
// getConnectionWithHint gets a connection to the node. // If no pooled connection is available, a new connection will be created.
[ "getConnectionWithHint", "gets", "a", "connection", "to", "the", "node", ".", "If", "no", "pooled", "connection", "is", "available", "a", "new", "connection", "will", "be", "created", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L605-L660
9,971
aerospike/aerospike-client-go
node.go
putConnectionWithHint
func (nd *Node) putConnectionWithHint(conn *Connection, hint byte) bool { conn.refresh() if !nd.active.Get() || !nd.connections.Offer(conn, hint) { conn.Close() return false } return true }
go
func (nd *Node) putConnectionWithHint(conn *Connection, hint byte) bool { conn.refresh() if !nd.active.Get() || !nd.connections.Offer(conn, hint) { conn.Close() return false } return true }
[ "func", "(", "nd", "*", "Node", ")", "putConnectionWithHint", "(", "conn", "*", "Connection", ",", "hint", "byte", ")", "bool", "{", "conn", ".", "refresh", "(", ")", "\n", "if", "!", "nd", ".", "active", ".", "Get", "(", ")", "||", "!", "nd", "....
// PutConnection puts back a connection to the pool. // If connection pool is full, the connection will be // closed and discarded.
[ "PutConnection", "puts", "back", "a", "connection", "to", "the", "pool", ".", "If", "connection", "pool", "is", "full", "the", "connection", "will", "be", "closed", "and", "discarded", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L665-L672
9,972
aerospike/aerospike-client-go
node.go
IsActive
func (nd *Node) IsActive() bool { return nd != nil && nd.active.Get() && nd.partitionGeneration.Get() >= -1 }
go
func (nd *Node) IsActive() bool { return nd != nil && nd.active.Get() && nd.partitionGeneration.Get() >= -1 }
[ "func", "(", "nd", "*", "Node", ")", "IsActive", "(", ")", "bool", "{", "return", "nd", "!=", "nil", "&&", "nd", ".", "active", ".", "Get", "(", ")", "&&", "nd", ".", "partitionGeneration", ".", "Get", "(", ")", ">=", "-", "1", "\n", "}" ]
// IsActive Checks if the node is active.
[ "IsActive", "Checks", "if", "the", "node", "is", "active", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L692-L694
9,973
aerospike/aerospike-client-go
node.go
addAlias
func (nd *Node) addAlias(aliasToAdd *Host) { // Aliases are only referenced in the cluster tend goroutine, // so synchronization is not necessary. aliases := nd.GetAliases() if aliases == nil { aliases = []*Host{} } aliases = append(aliases, aliasToAdd) nd.setAliases(aliases) }
go
func (nd *Node) addAlias(aliasToAdd *Host) { // Aliases are only referenced in the cluster tend goroutine, // so synchronization is not necessary. aliases := nd.GetAliases() if aliases == nil { aliases = []*Host{} } aliases = append(aliases, aliasToAdd) nd.setAliases(aliases) }
[ "func", "(", "nd", "*", "Node", ")", "addAlias", "(", "aliasToAdd", "*", "Host", ")", "{", "// Aliases are only referenced in the cluster tend goroutine,", "// so synchronization is not necessary.", "aliases", ":=", "nd", ".", "GetAliases", "(", ")", "\n", "if", "alia...
// AddAlias adds an alias for the node
[ "AddAlias", "adds", "an", "alias", "for", "the", "node" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L712-L722
9,974
aerospike/aerospike-client-go
node.go
Close
func (nd *Node) Close() { nd.active.Set(false) atomic.AddInt64(&nd.stats.NodeRemoved, 1) nd.closeConnections() }
go
func (nd *Node) Close() { nd.active.Set(false) atomic.AddInt64(&nd.stats.NodeRemoved, 1) nd.closeConnections() }
[ "func", "(", "nd", "*", "Node", ")", "Close", "(", ")", "{", "nd", ".", "active", ".", "Set", "(", "false", ")", "\n", "atomic", ".", "AddInt64", "(", "&", "nd", ".", "stats", ".", "NodeRemoved", ",", "1", ")", "\n", "nd", ".", "closeConnections"...
// Close marks node as inactive and closes all of its pooled connections.
[ "Close", "marks", "node", "as", "inactive", "and", "closes", "all", "of", "its", "pooled", "connections", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L725-L729
9,975
aerospike/aerospike-client-go
node.go
Equals
func (nd *Node) Equals(other *Node) bool { return nd != nil && other != nil && (nd == other || nd.name == other.name) }
go
func (nd *Node) Equals(other *Node) bool { return nd != nil && other != nil && (nd == other || nd.name == other.name) }
[ "func", "(", "nd", "*", "Node", ")", "Equals", "(", "other", "*", "Node", ")", "bool", "{", "return", "nd", "!=", "nil", "&&", "other", "!=", "nil", "&&", "(", "nd", "==", "other", "||", "nd", ".", "name", "==", "other", ".", "name", ")", "\n",...
// Equals compares equality of two nodes based on their names.
[ "Equals", "compares", "equality", "of", "two", "nodes", "based", "on", "their", "names", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L751-L753
9,976
aerospike/aerospike-client-go
node.go
MigrationInProgress
func (nd *Node) MigrationInProgress() (bool, error) { values, err := nd.RequestStats(&nd.cluster.infoPolicy) if err != nil { return false, err } // if the migrate_partitions_remaining exists and is not `0`, then migration is in progress if migration, exists := values["migrate_partitions_remaining"]; exists && m...
go
func (nd *Node) MigrationInProgress() (bool, error) { values, err := nd.RequestStats(&nd.cluster.infoPolicy) if err != nil { return false, err } // if the migrate_partitions_remaining exists and is not `0`, then migration is in progress if migration, exists := values["migrate_partitions_remaining"]; exists && m...
[ "func", "(", "nd", "*", "Node", ")", "MigrationInProgress", "(", ")", "(", "bool", ",", "error", ")", "{", "values", ",", "err", ":=", "nd", ".", "RequestStats", "(", "&", "nd", ".", "cluster", ".", "infoPolicy", ")", "\n", "if", "err", "!=", "nil"...
// MigrationInProgress determines if the node is participating in a data migration
[ "MigrationInProgress", "determines", "if", "the", "node", "is", "participating", "in", "a", "data", "migration" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L756-L769
9,977
aerospike/aerospike-client-go
node.go
initTendConn
func (nd *Node) initTendConn(timeout time.Duration) error { var deadline time.Time if timeout > 0 { deadline = time.Now().Add(timeout) } if nd.tendConn == nil || !nd.tendConn.IsConnected() { // Tend connection required a long timeout tendConn, err := nd.getConnection(deadline, timeout) if err != nil { r...
go
func (nd *Node) initTendConn(timeout time.Duration) error { var deadline time.Time if timeout > 0 { deadline = time.Now().Add(timeout) } if nd.tendConn == nil || !nd.tendConn.IsConnected() { // Tend connection required a long timeout tendConn, err := nd.getConnection(deadline, timeout) if err != nil { r...
[ "func", "(", "nd", "*", "Node", ")", "initTendConn", "(", "timeout", "time", ".", "Duration", ")", "error", "{", "var", "deadline", "time", ".", "Time", "\n", "if", "timeout", ">", "0", "{", "deadline", "=", "time", ".", "Now", "(", ")", ".", "Add"...
// initTendConn sets up a connection to be used for info requests. // The same connection will be used for tend.
[ "initTendConn", "sets", "up", "a", "connection", "to", "be", "used", "for", "info", "requests", ".", "The", "same", "connection", "will", "be", "used", "for", "tend", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L800-L818
9,978
aerospike/aerospike-client-go
node.go
requestInfoWithRetry
func (nd *Node) requestInfoWithRetry(policy *InfoPolicy, n int, name ...string) (res map[string]string, err error) { for i := 0; i < n; i++ { if res, err = nd.requestInfo(policy.Timeout, name...); err == nil { return res, nil } Logger.Error("Error occurred while fetching info from the server node %s: %s", nd...
go
func (nd *Node) requestInfoWithRetry(policy *InfoPolicy, n int, name ...string) (res map[string]string, err error) { for i := 0; i < n; i++ { if res, err = nd.requestInfo(policy.Timeout, name...); err == nil { return res, nil } Logger.Error("Error occurred while fetching info from the server node %s: %s", nd...
[ "func", "(", "nd", "*", "Node", ")", "requestInfoWithRetry", "(", "policy", "*", "InfoPolicy", ",", "n", "int", ",", "name", "...", "string", ")", "(", "res", "map", "[", "string", "]", "string", ",", "err", "error", ")", "{", "for", "i", ":=", "0"...
// requestInfoWithRetry gets info values by name from the specified database server node. // It will try at least N times before returning an error.
[ "requestInfoWithRetry", "gets", "info", "values", "by", "name", "from", "the", "specified", "database", "server", "node", ".", "It", "will", "try", "at", "least", "N", "times", "before", "returning", "an", "error", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L822-L834
9,979
aerospike/aerospike-client-go
node.go
requestRawInfo
func (nd *Node) requestRawInfo(policy *InfoPolicy, name ...string) (*info, error) { nd.tendConnLock.Lock() defer nd.tendConnLock.Unlock() if err := nd.initTendConn(policy.Timeout); err != nil { return nil, err } response, err := newInfo(nd.tendConn, name...) if err != nil { nd.tendConn.Close() return nil,...
go
func (nd *Node) requestRawInfo(policy *InfoPolicy, name ...string) (*info, error) { nd.tendConnLock.Lock() defer nd.tendConnLock.Unlock() if err := nd.initTendConn(policy.Timeout); err != nil { return nil, err } response, err := newInfo(nd.tendConn, name...) if err != nil { nd.tendConn.Close() return nil,...
[ "func", "(", "nd", "*", "Node", ")", "requestRawInfo", "(", "policy", "*", "InfoPolicy", ",", "name", "...", "string", ")", "(", "*", "info", ",", "error", ")", "{", "nd", ".", "tendConnLock", ".", "Lock", "(", ")", "\n", "defer", "nd", ".", "tendC...
// requestRawInfo gets info values by name from the specified database server node. // It won't parse the results.
[ "requestRawInfo", "gets", "info", "values", "by", "name", "from", "the", "specified", "database", "server", "node", ".", "It", "won", "t", "parse", "the", "results", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L860-L874
9,980
aerospike/aerospike-client-go
node.go
RequestStats
func (node *Node) RequestStats(policy *InfoPolicy) (map[string]string, error) { infoMap, err := node.RequestInfo(policy, "statistics") if err != nil { return nil, err } res := map[string]string{} v, exists := infoMap["statistics"] if !exists { return res, nil } values := strings.Split(v, ";") for i := r...
go
func (node *Node) RequestStats(policy *InfoPolicy) (map[string]string, error) { infoMap, err := node.RequestInfo(policy, "statistics") if err != nil { return nil, err } res := map[string]string{} v, exists := infoMap["statistics"] if !exists { return res, nil } values := strings.Split(v, ";") for i := r...
[ "func", "(", "node", "*", "Node", ")", "RequestStats", "(", "policy", "*", "InfoPolicy", ")", "(", "map", "[", "string", "]", "string", ",", "error", ")", "{", "infoMap", ",", "err", ":=", "node", ".", "RequestInfo", "(", "policy", ",", "\"", "\"", ...
// RequestStats returns statistics for the specified node as a map
[ "RequestStats", "returns", "statistics", "for", "the", "specified", "node", "as", "a", "map" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L877-L899
9,981
aerospike/aerospike-client-go
node.go
sessionToken
func (nd *Node) sessionToken() []byte { var deadline time.Time deadlineIfc := nd._sessionExpiration.Load() if deadlineIfc != nil { deadline = deadlineIfc.(time.Time) } if deadline.IsZero() || time.Now().After(deadline) { return nil } st := nd._sessionToken.Load() if st != nil { return st.([]byte) } re...
go
func (nd *Node) sessionToken() []byte { var deadline time.Time deadlineIfc := nd._sessionExpiration.Load() if deadlineIfc != nil { deadline = deadlineIfc.(time.Time) } if deadline.IsZero() || time.Now().After(deadline) { return nil } st := nd._sessionToken.Load() if st != nil { return st.([]byte) } re...
[ "func", "(", "nd", "*", "Node", ")", "sessionToken", "(", ")", "[", "]", "byte", "{", "var", "deadline", "time", ".", "Time", "\n", "deadlineIfc", ":=", "nd", ".", "_sessionExpiration", ".", "Load", "(", ")", "\n", "if", "deadlineIfc", "!=", "nil", "...
// sessionToken returns the session token for the node. // It will return nil if the session has expired.
[ "sessionToken", "returns", "the", "session", "token", "for", "the", "node", ".", "It", "will", "return", "nil", "if", "the", "session", "has", "expired", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L903-L919
9,982
aerospike/aerospike-client-go
node.go
Rack
func (nd *Node) Rack(namespace string) (int, error) { racks := nd.racks.Load().(map[string]int) v, exists := racks[namespace] if exists { return v, nil } return -1, newAerospikeNodeError(nd, RACK_NOT_DEFINED) }
go
func (nd *Node) Rack(namespace string) (int, error) { racks := nd.racks.Load().(map[string]int) v, exists := racks[namespace] if exists { return v, nil } return -1, newAerospikeNodeError(nd, RACK_NOT_DEFINED) }
[ "func", "(", "nd", "*", "Node", ")", "Rack", "(", "namespace", "string", ")", "(", "int", ",", "error", ")", "{", "racks", ":=", "nd", ".", "racks", ".", "Load", "(", ")", ".", "(", "map", "[", "string", "]", "int", ")", "\n", "v", ",", "exis...
// Rack returns the rack number for the namespace.
[ "Rack", "returns", "the", "rack", "number", "for", "the", "namespace", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/node.go#L922-L931
9,983
aerospike/aerospike-client-go
partition.go
newPartitionByKey
func newPartitionByKey(key *Key) Partition { return Partition{ Namespace: key.namespace, // CAN'T USE MOD directly - mod will give negative numbers. // First AND makes positive and negative correctly, then mod. // For any x, y : x % 2^y = x & (2^y - 1); the second method is twice as fast PartitionId: int(Bu...
go
func newPartitionByKey(key *Key) Partition { return Partition{ Namespace: key.namespace, // CAN'T USE MOD directly - mod will give negative numbers. // First AND makes positive and negative correctly, then mod. // For any x, y : x % 2^y = x & (2^y - 1); the second method is twice as fast PartitionId: int(Bu...
[ "func", "newPartitionByKey", "(", "key", "*", "Key", ")", "Partition", "{", "return", "Partition", "{", "Namespace", ":", "key", ".", "namespace", ",", "// CAN'T USE MOD directly - mod will give negative numbers.", "// First AND makes positive and negative correctly, then mod."...
// newPartitionByKey initializes a partition and determines the Partition Id // from key digest automatically. It return the struct itself, and not the address
[ "newPartitionByKey", "initializes", "a", "partition", "and", "determines", "the", "Partition", "Id", "from", "key", "digest", "automatically", ".", "It", "return", "the", "struct", "itself", "and", "not", "the", "address" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/partition.go#L38-L47
9,984
aerospike/aerospike-client-go
partition.go
NewPartition
func NewPartition(namespace string, partitionID int) *Partition { return &Partition{ Namespace: namespace, PartitionId: partitionID, } }
go
func NewPartition(namespace string, partitionID int) *Partition { return &Partition{ Namespace: namespace, PartitionId: partitionID, } }
[ "func", "NewPartition", "(", "namespace", "string", ",", "partitionID", "int", ")", "*", "Partition", "{", "return", "&", "Partition", "{", "Namespace", ":", "namespace", ",", "PartitionId", ":", "partitionID", ",", "}", "\n", "}" ]
// NewPartition generates a partition instance.
[ "NewPartition", "generates", "a", "partition", "instance", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/partition.go#L50-L55
9,985
aerospike/aerospike-client-go
partition.go
Equals
func (ptn *Partition) Equals(other *Partition) bool { return ptn.PartitionId == other.PartitionId && ptn.Namespace == other.Namespace }
go
func (ptn *Partition) Equals(other *Partition) bool { return ptn.PartitionId == other.PartitionId && ptn.Namespace == other.Namespace }
[ "func", "(", "ptn", "*", "Partition", ")", "Equals", "(", "other", "*", "Partition", ")", "bool", "{", "return", "ptn", ".", "PartitionId", "==", "other", ".", "PartitionId", "&&", "ptn", ".", "Namespace", "==", "other", ".", "Namespace", "\n", "}" ]
// Equals checks equality of two partitions.
[ "Equals", "checks", "equality", "of", "two", "partitions", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/partition.go#L63-L65
9,986
aerospike/aerospike-client-go
command.go
setWrite
func (cmd *baseCommand) setWrite(policy *WritePolicy, operation OperationType, key *Key, bins []*Bin, binMap BinMap) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, policy.SendKey) if err != nil { return err } if binMap == nil { for i := range bins { if err := cmd.estimateOperationSizeForBi...
go
func (cmd *baseCommand) setWrite(policy *WritePolicy, operation OperationType, key *Key, bins []*Bin, binMap BinMap) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, policy.SendKey) if err != nil { return err } if binMap == nil { for i := range bins { if err := cmd.estimateOperationSizeForBi...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setWrite", "(", "policy", "*", "WritePolicy", ",", "operation", "OperationType", ",", "key", "*", "Key", ",", "bins", "[", "]", "*", "Bin", ",", "binMap", "BinMap", ")", "error", "{", "cmd", ".", "begin", ...
// Writes the command for write operations
[ "Writes", "the", "command", "for", "write", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L116-L166
9,987
aerospike/aerospike-client-go
command.go
setDelete
func (cmd *baseCommand) setDelete(policy *WritePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE|_INFO2_DELETE, fieldCount, 0) cmd.write...
go
func (cmd *baseCommand) setDelete(policy *WritePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE|_INFO2_DELETE, fieldCount, 0) cmd.write...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setDelete", "(", "policy", "*", "WritePolicy", ",", "key", "*", "Key", ")", "error", "{", "cmd", ".", "begin", "(", ")", "\n", "fieldCount", ",", "err", ":=", "cmd", ".", "estimateKeySize", "(", "key", ",...
// Writes the command for delete operations
[ "Writes", "the", "command", "for", "delete", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L169-L183
9,988
aerospike/aerospike-client-go
command.go
setTouch
func (cmd *baseCommand) setTouch(policy *WritePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, policy.SendKey) if err != nil { return err } cmd.estimateOperationSize() if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, f...
go
func (cmd *baseCommand) setTouch(policy *WritePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, policy.SendKey) if err != nil { return err } cmd.estimateOperationSize() if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, f...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setTouch", "(", "policy", "*", "WritePolicy", ",", "key", "*", "Key", ")", "error", "{", "cmd", ".", "begin", "(", ")", "\n", "fieldCount", ",", "err", ":=", "cmd", ".", "estimateKeySize", "(", "key", ","...
// Writes the command for touch operations
[ "Writes", "the", "command", "for", "touch", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L186-L203
9,989
aerospike/aerospike-client-go
command.go
setExists
func (cmd *baseCommand) setExists(policy *BasePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeader(policy, _INFO1_READ|_INFO1_NOBINDATA, 0, fieldCount, 0) cmd.writeKey(key, ...
go
func (cmd *baseCommand) setExists(policy *BasePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeader(policy, _INFO1_READ|_INFO1_NOBINDATA, 0, fieldCount, 0) cmd.writeKey(key, ...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setExists", "(", "policy", "*", "BasePolicy", ",", "key", "*", "Key", ")", "error", "{", "cmd", ".", "begin", "(", ")", "\n", "fieldCount", ",", "err", ":=", "cmd", ".", "estimateKeySize", "(", "key", ","...
// Writes the command for exist operations
[ "Writes", "the", "command", "for", "exist", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L206-L220
9,990
aerospike/aerospike-client-go
command.go
setReadHeader
func (cmd *baseCommand) setReadHeader(policy *BasePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } cmd.estimateOperationSizeForBinName("") if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeader(policy, _INFO1_READ|_INFO1_NO...
go
func (cmd *baseCommand) setReadHeader(policy *BasePolicy, key *Key) error { cmd.begin() fieldCount, err := cmd.estimateKeySize(key, false) if err != nil { return err } cmd.estimateOperationSizeForBinName("") if err := cmd.sizeBuffer(); err != nil { return err } cmd.writeHeader(policy, _INFO1_READ|_INFO1_NO...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setReadHeader", "(", "policy", "*", "BasePolicy", ",", "key", "*", "Key", ")", "error", "{", "cmd", ".", "begin", "(", ")", "\n", "fieldCount", ",", "err", ":=", "cmd", ".", "estimateKeySize", "(", "key", ...
// Writes the command for getting metadata operations
[ "Writes", "the", "command", "for", "getting", "metadata", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L269-L287
9,991
aerospike/aerospike-client-go
command.go
setOperate
func (cmd *baseCommand) setOperate(policy *WritePolicy, key *Key, operations []*Operation) (bool, error) { if len(operations) == 0 { return false, NewAerospikeError(PARAMETER_ERROR, "No operations were passed.") } cmd.begin() fieldCount := 0 readAttr := 0 writeAttr := 0 hasWrite := false readBin := false re...
go
func (cmd *baseCommand) setOperate(policy *WritePolicy, key *Key, operations []*Operation) (bool, error) { if len(operations) == 0 { return false, NewAerospikeError(PARAMETER_ERROR, "No operations were passed.") } cmd.begin() fieldCount := 0 readAttr := 0 writeAttr := 0 hasWrite := false readBin := false re...
[ "func", "(", "cmd", "*", "baseCommand", ")", "setOperate", "(", "policy", "*", "WritePolicy", ",", "key", "*", "Key", ",", "operations", "[", "]", "*", "Operation", ")", "(", "bool", ",", "error", ")", "{", "if", "len", "(", "operations", ")", "==", ...
// Implements different command operations
[ "Implements", "different", "command", "operations" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L290-L370
9,992
aerospike/aerospike-client-go
command.go
writeHeader
func (cmd *baseCommand) writeHeader(policy *BasePolicy, readAttr int, writeAttr int, fieldCount int, operationCount int) { infoAttr := 0 if policy.LinearizeRead { infoAttr |= _INFO3_LINEARIZE_READ } if policy.ConsistencyLevel == CONSISTENCY_ALL { readAttr |= _INFO1_CONSISTENCY_ALL } // Write all header data...
go
func (cmd *baseCommand) writeHeader(policy *BasePolicy, readAttr int, writeAttr int, fieldCount int, operationCount int) { infoAttr := 0 if policy.LinearizeRead { infoAttr |= _INFO3_LINEARIZE_READ } if policy.ConsistencyLevel == CONSISTENCY_ALL { readAttr |= _INFO1_CONSISTENCY_ALL } // Write all header data...
[ "func", "(", "cmd", "*", "baseCommand", ")", "writeHeader", "(", "policy", "*", "BasePolicy", ",", "readAttr", "int", ",", "writeAttr", "int", ",", "fieldCount", "int", ",", "operationCount", "int", ")", "{", "infoAttr", ":=", "0", "\n", "if", "policy", ...
// Generic header write.
[ "Generic", "header", "write", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L1079-L1102
9,993
aerospike/aerospike-client-go
command.go
writeHeaderWithPolicy
func (cmd *baseCommand) writeHeaderWithPolicy(policy *WritePolicy, readAttr int, writeAttr int, fieldCount int, operationCount int) { // Set flags. generation := uint32(0) infoAttr := 0 switch policy.RecordExistsAction { case UPDATE: case UPDATE_ONLY: infoAttr |= _INFO3_UPDATE_ONLY case REPLACE: infoAttr |=...
go
func (cmd *baseCommand) writeHeaderWithPolicy(policy *WritePolicy, readAttr int, writeAttr int, fieldCount int, operationCount int) { // Set flags. generation := uint32(0) infoAttr := 0 switch policy.RecordExistsAction { case UPDATE: case UPDATE_ONLY: infoAttr |= _INFO3_UPDATE_ONLY case REPLACE: infoAttr |=...
[ "func", "(", "cmd", "*", "baseCommand", ")", "writeHeaderWithPolicy", "(", "policy", "*", "WritePolicy", ",", "readAttr", "int", ",", "writeAttr", "int", ",", "fieldCount", "int", ",", "operationCount", "int", ")", "{", "// Set flags.", "generation", ":=", "ui...
// Header write for write operations.
[ "Header", "write", "for", "write", "operations", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/command.go#L1105-L1170
9,994
aerospike/aerospike-client-go
record.go
String
func (rc *Record) String() string { return fmt.Sprintf("%s %v", rc.Key, rc.Bins) }
go
func (rc *Record) String() string { return fmt.Sprintf("%s %v", rc.Key, rc.Bins) }
[ "func", "(", "rc", "*", "Record", ")", "String", "(", ")", "string", "{", "return", "fmt", ".", "Sprintf", "(", "\"", "\"", ",", "rc", ".", "Key", ",", "rc", ".", "Bins", ")", "\n", "}" ]
// String implements the Stringer interface. // Returns string representation of record.
[ "String", "implements", "the", "Stringer", "interface", ".", "Returns", "string", "representation", "of", "record", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/record.go#L59-L61
9,995
aerospike/aerospike-client-go
pkg/bcrypt/cipher.go
streamtoword
func streamtoword(data []byte, off int) (uint, int) { var word uint for i := 0; i < 4; i++ { word = (word << 8) | uint(data[off]&0xff) off = (off + 1) % len(data) } return word, off }
go
func streamtoword(data []byte, off int) (uint, int) { var word uint for i := 0; i < 4; i++ { word = (word << 8) | uint(data[off]&0xff) off = (off + 1) % len(data) } return word, off }
[ "func", "streamtoword", "(", "data", "[", "]", "byte", ",", "off", "int", ")", "(", "uint", ",", "int", ")", "{", "var", "word", "uint", "\n", "for", "i", ":=", "0", ";", "i", "<", "4", ";", "i", "++", "{", "word", "=", "(", "word", "<<", "...
/** * Cycically extract a word of key material * @param data the string to extract the data from * @param off the current offset into the data * @return the next word of material from data and the next offset into the data */
[ "Cycically", "extract", "a", "word", "of", "key", "material" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/pkg/bcrypt/cipher.go#L301-L309
9,996
aerospike/aerospike-client-go
pkg/bcrypt/cipher.go
key
func (c *cipher) key(key []byte) { var word uint off := 0 lr := []uint{0, 0} plen := len(c.P) slen := len(c.S) for i := 0; i < plen; i++ { word, off = streamtoword(key, off) c.P[i] = c.P[i] ^ word } for i := 0; i < plen; i += 2 { c.encipher(lr, 0) c.P[i] = lr[0] c.P[i+1] = lr[1] } for i := 0; i <...
go
func (c *cipher) key(key []byte) { var word uint off := 0 lr := []uint{0, 0} plen := len(c.P) slen := len(c.S) for i := 0; i < plen; i++ { word, off = streamtoword(key, off) c.P[i] = c.P[i] ^ word } for i := 0; i < plen; i += 2 { c.encipher(lr, 0) c.P[i] = lr[0] c.P[i+1] = lr[1] } for i := 0; i <...
[ "func", "(", "c", "*", "cipher", ")", "key", "(", "key", "[", "]", "byte", ")", "{", "var", "word", "uint", "\n", "off", ":=", "0", "\n", "lr", ":=", "[", "]", "uint", "{", "0", ",", "0", "}", "\n", "plen", ":=", "len", "(", "c", ".", "P"...
/** * Key the Blowfish cipher * @param key an array containing the key */
[ "Key", "the", "Blowfish", "cipher" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/pkg/bcrypt/cipher.go#L315-L338
9,997
aerospike/aerospike-client-go
pkg/bcrypt/cipher.go
crypt_raw
func crypt_raw(password []byte, salt []byte, log_rounds uint) []byte { c := &cipher{P: p_orig, S: s_orig, data: bf_crypt_ciphertext} rounds := 1 << log_rounds c.ekskey(salt, password) for i := 0; i < rounds; i++ { c.key(password) c.key(salt) } for i := 0; i < 64; i++ { for j := 0; j < (6 >> 1); j++ { c...
go
func crypt_raw(password []byte, salt []byte, log_rounds uint) []byte { c := &cipher{P: p_orig, S: s_orig, data: bf_crypt_ciphertext} rounds := 1 << log_rounds c.ekskey(salt, password) for i := 0; i < rounds; i++ { c.key(password) c.key(salt) } for i := 0; i < 64; i++ { for j := 0; j < (6 >> 1); j++ { c...
[ "func", "crypt_raw", "(", "password", "[", "]", "byte", ",", "salt", "[", "]", "byte", ",", "log_rounds", "uint", ")", "[", "]", "byte", "{", "c", ":=", "&", "cipher", "{", "P", ":", "p_orig", ",", "S", ":", "s_orig", ",", "data", ":", "bf_crypt_...
/** * Perform the central password hashing step in the * bcrypt scheme * @param password the password to hash * @param salt the binary salt to hash with the password * @param log_rounds the binary logarithm of the number * of rounds of hashing to apply * @return an array containing the binary hashed password */
[ "Perform", "the", "central", "password", "hashing", "step", "in", "the", "bcrypt", "scheme" ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/pkg/bcrypt/cipher.go#L390-L415
9,998
aerospike/aerospike-client-go
types/message.go
NewMessage
func NewMessage(mtype messageType, data []byte) *Message { return &Message{ MessageHeader: MessageHeader{ Version: uint8(2), Type: uint8(mtype), DataLen: msgLenToBytes(int64(len(data))), }, Data: data, } }
go
func NewMessage(mtype messageType, data []byte) *Message { return &Message{ MessageHeader: MessageHeader{ Version: uint8(2), Type: uint8(mtype), DataLen: msgLenToBytes(int64(len(data))), }, Data: data, } }
[ "func", "NewMessage", "(", "mtype", "messageType", ",", "data", "[", "]", "byte", ")", "*", "Message", "{", "return", "&", "Message", "{", "MessageHeader", ":", "MessageHeader", "{", "Version", ":", "uint8", "(", "2", ")", ",", "Type", ":", "uint8", "(...
// NewMessage generates a new Message instance.
[ "NewMessage", "generates", "a", "new", "Message", "instance", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/message.go#L50-L59
9,999
aerospike/aerospike-client-go
types/message.go
Resize
func (msg *Message) Resize(newSize int64) error { if newSize > maxAllowedBufferSize || newSize < 0 { return fmt.Errorf("Requested new buffer size is invalid. Requested: %d, allowed: 0..%d", newSize, maxAllowedBufferSize) } if int64(len(msg.Data)) == newSize { return nil } msg.Data = make([]byte, newSize) retu...
go
func (msg *Message) Resize(newSize int64) error { if newSize > maxAllowedBufferSize || newSize < 0 { return fmt.Errorf("Requested new buffer size is invalid. Requested: %d, allowed: 0..%d", newSize, maxAllowedBufferSize) } if int64(len(msg.Data)) == newSize { return nil } msg.Data = make([]byte, newSize) retu...
[ "func", "(", "msg", "*", "Message", ")", "Resize", "(", "newSize", "int64", ")", "error", "{", "if", "newSize", ">", "maxAllowedBufferSize", "||", "newSize", "<", "0", "{", "return", "fmt", ".", "Errorf", "(", "\"", "\"", ",", "newSize", ",", "maxAllow...
// Resize changes the internal buffer size for the message.
[ "Resize", "changes", "the", "internal", "buffer", "size", "for", "the", "message", "." ]
f257953b1650505cf4c357fcc4f032d160ebb07e
https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/message.go#L64-L73