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
|
---|---|---|---|---|---|---|---|---|---|---|---|
10,000 | aerospike/aerospike-client-go | types/message.go | Serialize | func (msg *Message) Serialize() []byte {
msg.DataLen = msgLenToBytes(int64(len(msg.Data)))
buf := bytes.NewBuffer([]byte{})
binary.Write(buf, binary.BigEndian, msg.MessageHeader)
binary.Write(buf, binary.BigEndian, msg.Data[:])
return buf.Bytes()
} | go | func (msg *Message) Serialize() []byte {
msg.DataLen = msgLenToBytes(int64(len(msg.Data)))
buf := bytes.NewBuffer([]byte{})
binary.Write(buf, binary.BigEndian, msg.MessageHeader)
binary.Write(buf, binary.BigEndian, msg.Data[:])
return buf.Bytes()
} | [
"func",
"(",
"msg",
"*",
"Message",
")",
"Serialize",
"(",
")",
"[",
"]",
"byte",
"{",
"msg",
".",
"DataLen",
"=",
"msgLenToBytes",
"(",
"int64",
"(",
"len",
"(",
"msg",
".",
"Data",
")",
")",
")",
"\n",
"buf",
":=",
"bytes",
".",
"NewBuffer",
"(",
"[",
"]",
"byte",
"{",
"}",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"BigEndian",
",",
"msg",
".",
"MessageHeader",
")",
"\n",
"binary",
".",
"Write",
"(",
"buf",
",",
"binary",
".",
"BigEndian",
",",
"msg",
".",
"Data",
"[",
":",
"]",
")",
"\n\n",
"return",
"buf",
".",
"Bytes",
"(",
")",
"\n",
"}"
]
| // Serialize returns a byte slice containing the message. | [
"Serialize",
"returns",
"a",
"byte",
"slice",
"containing",
"the",
"message",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/message.go#L76-L83 |
10,001 | aerospike/aerospike-client-go | tools/benchmark/benchmark.go | calcTPS | func calcTPS(count int, duration time.Duration) int {
return int(float64(count) / (float64(duration) / float64(time.Second)))
} | go | func calcTPS(count int, duration time.Duration) int {
return int(float64(count) / (float64(duration) / float64(time.Second)))
} | [
"func",
"calcTPS",
"(",
"count",
"int",
",",
"duration",
"time",
".",
"Duration",
")",
"int",
"{",
"return",
"int",
"(",
"float64",
"(",
"count",
")",
"/",
"(",
"float64",
"(",
"duration",
")",
"/",
"float64",
"(",
"time",
".",
"Second",
")",
")",
")",
"\n",
"}"
]
| // calculates transactions per second | [
"calculates",
"transactions",
"per",
"second"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/tools/benchmark/benchmark.go#L625-L627 |
10,002 | aerospike/aerospike-client-go | examples/putget.go | runMultiBinExample | func runMultiBinExample(client *as.Client) {
key, _ := as.NewKey(*shared.Namespace, *shared.Set, "putgetkey")
bin1 := as.NewBin("bin1", "value1")
bin2 := as.NewBin("bin2", "value2")
log.Printf("Put: namespace=%s set=%s key=%s bin1=%s value1=%s bin2=%s value2=%s",
key.Namespace(), key.SetName(), key.Value(), bin1.Name, bin1.Value, bin2.Name, bin2.Value)
client.PutBins(shared.WritePolicy, key, bin1, bin2)
log.Printf("Get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value())
record, err := client.Get(shared.Policy, key)
shared.PanicOnError(err)
if record == nil {
panic(fmt.Errorf("Failed to get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value()))
}
shared.ValidateBin(key, bin1, record)
shared.ValidateBin(key, bin2, record)
} | go | func runMultiBinExample(client *as.Client) {
key, _ := as.NewKey(*shared.Namespace, *shared.Set, "putgetkey")
bin1 := as.NewBin("bin1", "value1")
bin2 := as.NewBin("bin2", "value2")
log.Printf("Put: namespace=%s set=%s key=%s bin1=%s value1=%s bin2=%s value2=%s",
key.Namespace(), key.SetName(), key.Value(), bin1.Name, bin1.Value, bin2.Name, bin2.Value)
client.PutBins(shared.WritePolicy, key, bin1, bin2)
log.Printf("Get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value())
record, err := client.Get(shared.Policy, key)
shared.PanicOnError(err)
if record == nil {
panic(fmt.Errorf("Failed to get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value()))
}
shared.ValidateBin(key, bin1, record)
shared.ValidateBin(key, bin2, record)
} | [
"func",
"runMultiBinExample",
"(",
"client",
"*",
"as",
".",
"Client",
")",
"{",
"key",
",",
"_",
":=",
"as",
".",
"NewKey",
"(",
"*",
"shared",
".",
"Namespace",
",",
"*",
"shared",
".",
"Set",
",",
"\"",
"\"",
")",
"\n",
"bin1",
":=",
"as",
".",
"NewBin",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n",
"bin2",
":=",
"as",
".",
"NewBin",
"(",
"\"",
"\"",
",",
"\"",
"\"",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"key",
".",
"Namespace",
"(",
")",
",",
"key",
".",
"SetName",
"(",
")",
",",
"key",
".",
"Value",
"(",
")",
",",
"bin1",
".",
"Name",
",",
"bin1",
".",
"Value",
",",
"bin2",
".",
"Name",
",",
"bin2",
".",
"Value",
")",
"\n\n",
"client",
".",
"PutBins",
"(",
"shared",
".",
"WritePolicy",
",",
"key",
",",
"bin1",
",",
"bin2",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"key",
".",
"Namespace",
"(",
")",
",",
"key",
".",
"SetName",
"(",
")",
",",
"key",
".",
"Value",
"(",
")",
")",
"\n\n",
"record",
",",
"err",
":=",
"client",
".",
"Get",
"(",
"shared",
".",
"Policy",
",",
"key",
")",
"\n",
"shared",
".",
"PanicOnError",
"(",
"err",
")",
"\n\n",
"if",
"record",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
".",
"Namespace",
"(",
")",
",",
"key",
".",
"SetName",
"(",
")",
",",
"key",
".",
"Value",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"shared",
".",
"ValidateBin",
"(",
"key",
",",
"bin1",
",",
"record",
")",
"\n",
"shared",
".",
"ValidateBin",
"(",
"key",
",",
"bin2",
",",
"record",
")",
"\n",
"}"
]
| // Execute put and get on a server configured as multi-bin. This is the server default. | [
"Execute",
"put",
"and",
"get",
"on",
"a",
"server",
"configured",
"as",
"multi",
"-",
"bin",
".",
"This",
"is",
"the",
"server",
"default",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/putget.go#L37-L58 |
10,003 | aerospike/aerospike-client-go | examples/putget.go | runGetHeaderExample | func runGetHeaderExample(client *as.Client) {
key, _ := as.NewKey(*shared.Namespace, *shared.Set, "putgetkey")
log.Printf("Get record header: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value())
record, err := client.GetHeader(shared.Policy, key)
shared.PanicOnError(err)
if record == nil {
panic(fmt.Errorf("Failed to get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value()))
}
// Generation should be greater than zero. Make sure it's populated.
if record.Generation == 0 {
panic(fmt.Errorf("Invalid record header: generation=%d expiration=%d", record.Generation, record.Expiration))
}
log.Printf("Received: generation=%d expiration=%d (%s)\n", record.Generation, record.Expiration, time.Duration(record.Expiration)*time.Second)
} | go | func runGetHeaderExample(client *as.Client) {
key, _ := as.NewKey(*shared.Namespace, *shared.Set, "putgetkey")
log.Printf("Get record header: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value())
record, err := client.GetHeader(shared.Policy, key)
shared.PanicOnError(err)
if record == nil {
panic(fmt.Errorf("Failed to get: namespace=%s set=%s key=%s", key.Namespace(), key.SetName(), key.Value()))
}
// Generation should be greater than zero. Make sure it's populated.
if record.Generation == 0 {
panic(fmt.Errorf("Invalid record header: generation=%d expiration=%d", record.Generation, record.Expiration))
}
log.Printf("Received: generation=%d expiration=%d (%s)\n", record.Generation, record.Expiration, time.Duration(record.Expiration)*time.Second)
} | [
"func",
"runGetHeaderExample",
"(",
"client",
"*",
"as",
".",
"Client",
")",
"{",
"key",
",",
"_",
":=",
"as",
".",
"NewKey",
"(",
"*",
"shared",
".",
"Namespace",
",",
"*",
"shared",
".",
"Set",
",",
"\"",
"\"",
")",
"\n\n",
"log",
".",
"Printf",
"(",
"\"",
"\"",
",",
"key",
".",
"Namespace",
"(",
")",
",",
"key",
".",
"SetName",
"(",
")",
",",
"key",
".",
"Value",
"(",
")",
")",
"\n",
"record",
",",
"err",
":=",
"client",
".",
"GetHeader",
"(",
"shared",
".",
"Policy",
",",
"key",
")",
"\n",
"shared",
".",
"PanicOnError",
"(",
"err",
")",
"\n\n",
"if",
"record",
"==",
"nil",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"key",
".",
"Namespace",
"(",
")",
",",
"key",
".",
"SetName",
"(",
")",
",",
"key",
".",
"Value",
"(",
")",
")",
")",
"\n",
"}",
"\n\n",
"// Generation should be greater than zero. Make sure it's populated.",
"if",
"record",
".",
"Generation",
"==",
"0",
"{",
"panic",
"(",
"fmt",
".",
"Errorf",
"(",
"\"",
"\"",
",",
"record",
".",
"Generation",
",",
"record",
".",
"Expiration",
")",
")",
"\n",
"}",
"\n",
"log",
".",
"Printf",
"(",
"\"",
"\\n",
"\"",
",",
"record",
".",
"Generation",
",",
"record",
".",
"Expiration",
",",
"time",
".",
"Duration",
"(",
"record",
".",
"Expiration",
")",
"*",
"time",
".",
"Second",
")",
"\n",
"}"
]
| // Read record header data. | [
"Read",
"record",
"header",
"data",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/examples/putget.go#L83-L99 |
10,004 | aerospike/aerospike-client-go | execute_task.go | NewExecuteTask | func NewExecuteTask(cluster *Cluster, statement *Statement) *ExecuteTask {
return &ExecuteTask{
baseTask: newTask(cluster),
taskID: statement.TaskId,
scan: statement.IsScan(),
}
} | go | func NewExecuteTask(cluster *Cluster, statement *Statement) *ExecuteTask {
return &ExecuteTask{
baseTask: newTask(cluster),
taskID: statement.TaskId,
scan: statement.IsScan(),
}
} | [
"func",
"NewExecuteTask",
"(",
"cluster",
"*",
"Cluster",
",",
"statement",
"*",
"Statement",
")",
"*",
"ExecuteTask",
"{",
"return",
"&",
"ExecuteTask",
"{",
"baseTask",
":",
"newTask",
"(",
"cluster",
")",
",",
"taskID",
":",
"statement",
".",
"TaskId",
",",
"scan",
":",
"statement",
".",
"IsScan",
"(",
")",
",",
"}",
"\n",
"}"
]
| // NewExecuteTask initializes task with fields needed to query server nodes. | [
"NewExecuteTask",
"initializes",
"task",
"with",
"fields",
"needed",
"to",
"query",
"server",
"nodes",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/execute_task.go#L33-L39 |
10,005 | aerospike/aerospike-client-go | bin.go | NewBin | func NewBin(name string, value interface{}) *Bin {
return &Bin{
Name: name,
Value: NewValue(value),
}
} | go | func NewBin(name string, value interface{}) *Bin {
return &Bin{
Name: name,
Value: NewValue(value),
}
} | [
"func",
"NewBin",
"(",
"name",
"string",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"Bin",
"{",
"return",
"&",
"Bin",
"{",
"Name",
":",
"name",
",",
"Value",
":",
"NewValue",
"(",
"value",
")",
",",
"}",
"\n",
"}"
]
| // NewBin generates a new Bin instance, specifying bin name and string value.
// For servers configured as "single-bin", enter an empty name. | [
"NewBin",
"generates",
"a",
"new",
"Bin",
"instance",
"specifying",
"bin",
"name",
"and",
"string",
"value",
".",
"For",
"servers",
"configured",
"as",
"single",
"-",
"bin",
"enter",
"an",
"empty",
"name",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/bin.go#L31-L36 |
10,006 | aerospike/aerospike-client-go | tools/asinfo/asinfo.go | dieIfError | func dieIfError(err error, cleanup ...func()) {
if err != nil {
log.Println("Error:")
for _, cb := range cleanup {
cb()
}
log.Fatalln(err.Error())
}
return
} | go | func dieIfError(err error, cleanup ...func()) {
if err != nil {
log.Println("Error:")
for _, cb := range cleanup {
cb()
}
log.Fatalln(err.Error())
}
return
} | [
"func",
"dieIfError",
"(",
"err",
"error",
",",
"cleanup",
"...",
"func",
"(",
")",
")",
"{",
"if",
"err",
"!=",
"nil",
"{",
"log",
".",
"Println",
"(",
"\"",
"\"",
")",
"\n",
"for",
"_",
",",
"cb",
":=",
"range",
"cleanup",
"{",
"cb",
"(",
")",
"\n",
"}",
"\n",
"log",
".",
"Fatalln",
"(",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"}",
"\n",
"return",
"\n",
"}"
]
| // dieIfError calls each callback in turn before printing the error via log.Fatalln. | [
"dieIfError",
"calls",
"each",
"callback",
"in",
"turn",
"before",
"printing",
"the",
"error",
"via",
"log",
".",
"Fatalln",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/tools/asinfo/asinfo.go#L78-L87 |
10,007 | aerospike/aerospike-client-go | internal/atomic/bool.go | NewAtomicBool | func NewAtomicBool(value bool) *AtomicBool {
var i int32
if value {
i = 1
}
return &AtomicBool{
val: i,
}
} | go | func NewAtomicBool(value bool) *AtomicBool {
var i int32
if value {
i = 1
}
return &AtomicBool{
val: i,
}
} | [
"func",
"NewAtomicBool",
"(",
"value",
"bool",
")",
"*",
"AtomicBool",
"{",
"var",
"i",
"int32",
"\n",
"if",
"value",
"{",
"i",
"=",
"1",
"\n",
"}",
"\n",
"return",
"&",
"AtomicBool",
"{",
"val",
":",
"i",
",",
"}",
"\n",
"}"
]
| // NewAtomicBool generates a new AtomicBoolean instance. | [
"NewAtomicBool",
"generates",
"a",
"new",
"AtomicBoolean",
"instance",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/bool.go#L25-L33 |
10,008 | aerospike/aerospike-client-go | internal/atomic/bool.go | Set | func (ab *AtomicBool) Set(newVal bool) {
var i int32
if newVal {
i = 1
}
atomic.StoreInt32(&(ab.val), int32(i))
} | go | func (ab *AtomicBool) Set(newVal bool) {
var i int32
if newVal {
i = 1
}
atomic.StoreInt32(&(ab.val), int32(i))
} | [
"func",
"(",
"ab",
"*",
"AtomicBool",
")",
"Set",
"(",
"newVal",
"bool",
")",
"{",
"var",
"i",
"int32",
"\n",
"if",
"newVal",
"{",
"i",
"=",
"1",
"\n",
"}",
"\n",
"atomic",
".",
"StoreInt32",
"(",
"&",
"(",
"ab",
".",
"val",
")",
",",
"int32",
"(",
"i",
")",
")",
"\n",
"}"
]
| // Set atomically sets the boolean value. | [
"Set",
"atomically",
"sets",
"the",
"boolean",
"value",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/bool.go#L41-L47 |
10,009 | aerospike/aerospike-client-go | internal/atomic/bool.go | Or | func (ab *AtomicBool) Or(newVal bool) bool {
if !newVal {
return ab.Get()
}
atomic.StoreInt32(&(ab.val), int32(1))
return true
} | go | func (ab *AtomicBool) Or(newVal bool) bool {
if !newVal {
return ab.Get()
}
atomic.StoreInt32(&(ab.val), int32(1))
return true
} | [
"func",
"(",
"ab",
"*",
"AtomicBool",
")",
"Or",
"(",
"newVal",
"bool",
")",
"bool",
"{",
"if",
"!",
"newVal",
"{",
"return",
"ab",
".",
"Get",
"(",
")",
"\n",
"}",
"\n",
"atomic",
".",
"StoreInt32",
"(",
"&",
"(",
"ab",
".",
"val",
")",
",",
"int32",
"(",
"1",
")",
")",
"\n",
"return",
"true",
"\n",
"}"
]
| // Or atomically applies OR operation to the boolean value. | [
"Or",
"atomically",
"applies",
"OR",
"operation",
"to",
"the",
"boolean",
"value",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/bool.go#L50-L56 |
10,010 | aerospike/aerospike-client-go | internal/atomic/bool.go | CompareAndToggle | func (ab *AtomicBool) CompareAndToggle(expect bool) bool {
updated := 1
if expect {
updated = 0
}
res := atomic.CompareAndSwapInt32(&ab.val, int32(1-updated), int32(updated))
return res
} | go | func (ab *AtomicBool) CompareAndToggle(expect bool) bool {
updated := 1
if expect {
updated = 0
}
res := atomic.CompareAndSwapInt32(&ab.val, int32(1-updated), int32(updated))
return res
} | [
"func",
"(",
"ab",
"*",
"AtomicBool",
")",
"CompareAndToggle",
"(",
"expect",
"bool",
")",
"bool",
"{",
"updated",
":=",
"1",
"\n",
"if",
"expect",
"{",
"updated",
"=",
"0",
"\n",
"}",
"\n",
"res",
":=",
"atomic",
".",
"CompareAndSwapInt32",
"(",
"&",
"ab",
".",
"val",
",",
"int32",
"(",
"1",
"-",
"updated",
")",
",",
"int32",
"(",
"updated",
")",
")",
"\n",
"return",
"res",
"\n",
"}"
]
| //CompareAndToggle atomically sets the boolean value if the current value is equal to updated value. | [
"CompareAndToggle",
"atomically",
"sets",
"the",
"boolean",
"value",
"if",
"the",
"current",
"value",
"is",
"equal",
"to",
"updated",
"value",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/bool.go#L59-L66 |
10,011 | aerospike/aerospike-client-go | internal/lua/lua_stream.go | registerLuaStreamType | func registerLuaStreamType(L *lua.LState) {
mt := L.NewTypeMetatable(luaLuaStreamTypeName)
L.SetGlobal("stream", mt)
// static attributes
L.SetField(mt, "__call", L.NewFunction(newLuaStream))
L.SetField(mt, "read", L.NewFunction(luaStreamRead))
L.SetField(mt, "write", L.NewFunction(luaStreamWrite))
L.SetField(mt, "readable", L.NewFunction(luaStreamReadable))
L.SetField(mt, "writeable", L.NewFunction(luaStreamWriteable))
// methods
L.SetFuncs(mt, map[string]lua.LGFunction{
"__tostring": luaStreamToString,
})
L.SetMetatable(mt, mt)
} | go | func registerLuaStreamType(L *lua.LState) {
mt := L.NewTypeMetatable(luaLuaStreamTypeName)
L.SetGlobal("stream", mt)
// static attributes
L.SetField(mt, "__call", L.NewFunction(newLuaStream))
L.SetField(mt, "read", L.NewFunction(luaStreamRead))
L.SetField(mt, "write", L.NewFunction(luaStreamWrite))
L.SetField(mt, "readable", L.NewFunction(luaStreamReadable))
L.SetField(mt, "writeable", L.NewFunction(luaStreamWriteable))
// methods
L.SetFuncs(mt, map[string]lua.LGFunction{
"__tostring": luaStreamToString,
})
L.SetMetatable(mt, mt)
} | [
"func",
"registerLuaStreamType",
"(",
"L",
"*",
"lua",
".",
"LState",
")",
"{",
"mt",
":=",
"L",
".",
"NewTypeMetatable",
"(",
"luaLuaStreamTypeName",
")",
"\n\n",
"L",
".",
"SetGlobal",
"(",
"\"",
"\"",
",",
"mt",
")",
"\n\n",
"// static attributes",
"L",
".",
"SetField",
"(",
"mt",
",",
"\"",
"\"",
",",
"L",
".",
"NewFunction",
"(",
"newLuaStream",
")",
")",
"\n",
"L",
".",
"SetField",
"(",
"mt",
",",
"\"",
"\"",
",",
"L",
".",
"NewFunction",
"(",
"luaStreamRead",
")",
")",
"\n",
"L",
".",
"SetField",
"(",
"mt",
",",
"\"",
"\"",
",",
"L",
".",
"NewFunction",
"(",
"luaStreamWrite",
")",
")",
"\n",
"L",
".",
"SetField",
"(",
"mt",
",",
"\"",
"\"",
",",
"L",
".",
"NewFunction",
"(",
"luaStreamReadable",
")",
")",
"\n",
"L",
".",
"SetField",
"(",
"mt",
",",
"\"",
"\"",
",",
"L",
".",
"NewFunction",
"(",
"luaStreamWriteable",
")",
")",
"\n\n",
"// methods",
"L",
".",
"SetFuncs",
"(",
"mt",
",",
"map",
"[",
"string",
"]",
"lua",
".",
"LGFunction",
"{",
"\"",
"\"",
":",
"luaStreamToString",
",",
"}",
")",
"\n\n",
"L",
".",
"SetMetatable",
"(",
"mt",
",",
"mt",
")",
"\n",
"}"
]
| // Registers my luaStream type to given L. | [
"Registers",
"my",
"luaStream",
"type",
"to",
"given",
"L",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/lua/lua_stream.go#L32-L50 |
10,012 | aerospike/aerospike-client-go | internal/lua/lua_stream.go | NewLuaStream | func NewLuaStream(L *lua.LState, stream chan interface{}) *lua.LUserData {
luaStream := &LuaStream{s: stream}
ud := L.NewUserData()
ud.Value = luaStream
L.SetMetatable(ud, L.GetTypeMetatable(luaLuaStreamTypeName))
return ud
} | go | func NewLuaStream(L *lua.LState, stream chan interface{}) *lua.LUserData {
luaStream := &LuaStream{s: stream}
ud := L.NewUserData()
ud.Value = luaStream
L.SetMetatable(ud, L.GetTypeMetatable(luaLuaStreamTypeName))
return ud
} | [
"func",
"NewLuaStream",
"(",
"L",
"*",
"lua",
".",
"LState",
",",
"stream",
"chan",
"interface",
"{",
"}",
")",
"*",
"lua",
".",
"LUserData",
"{",
"luaStream",
":=",
"&",
"LuaStream",
"{",
"s",
":",
"stream",
"}",
"\n",
"ud",
":=",
"L",
".",
"NewUserData",
"(",
")",
"\n",
"ud",
".",
"Value",
"=",
"luaStream",
"\n",
"L",
".",
"SetMetatable",
"(",
"ud",
",",
"L",
".",
"GetTypeMetatable",
"(",
"luaLuaStreamTypeName",
")",
")",
"\n",
"return",
"ud",
"\n",
"}"
]
| // NewLuaStream creates a LuaStream | [
"NewLuaStream",
"creates",
"a",
"LuaStream"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/lua/lua_stream.go#L53-L59 |
10,013 | aerospike/aerospike-client-go | cdt_list.go | NewListPolicy | func NewListPolicy(order ListOrderType, flags int) *ListPolicy {
return &ListPolicy{
attributes: order,
flags: flags,
}
} | go | func NewListPolicy(order ListOrderType, flags int) *ListPolicy {
return &ListPolicy{
attributes: order,
flags: flags,
}
} | [
"func",
"NewListPolicy",
"(",
"order",
"ListOrderType",
",",
"flags",
"int",
")",
"*",
"ListPolicy",
"{",
"return",
"&",
"ListPolicy",
"{",
"attributes",
":",
"order",
",",
"flags",
":",
"flags",
",",
"}",
"\n",
"}"
]
| // Create unique key map with specified order when map does not exist.
// Use specified write mode when writing map items. | [
"Create",
"unique",
"key",
"map",
"with",
"specified",
"order",
"when",
"map",
"does",
"not",
"exist",
".",
"Use",
"specified",
"write",
"mode",
"when",
"writing",
"map",
"items",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L90-L95 |
10,014 | aerospike/aerospike-client-go | cdt_list.go | ListSetOrderOp | func ListSetOrderOp(binName string, listOrder ListOrderType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SET_TYPE, IntegerValue(listOrder)}, encoder: listGenericOpEncoder}
} | go | func ListSetOrderOp(binName string, listOrder ListOrderType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SET_TYPE, IntegerValue(listOrder)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListSetOrderOp",
"(",
"binName",
"string",
",",
"listOrder",
"ListOrderType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_SET_TYPE",
",",
"IntegerValue",
"(",
"listOrder",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListSetOrderOp creates a set list order operation.
// Server sets list order. Server returns null. | [
"ListSetOrderOp",
"creates",
"a",
"set",
"list",
"order",
"operation",
".",
"Server",
"sets",
"list",
"order",
".",
"Server",
"returns",
"null",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L240-L242 |
10,015 | aerospike/aerospike-client-go | cdt_list.go | ListAppendOp | func ListAppendOp(binName string, values ...interface{}) *Operation {
if len(values) == 1 {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND, NewValue(values[0])}, encoder: listGenericOpEncoder}
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values)}, encoder: listGenericOpEncoder}
} | go | func ListAppendOp(binName string, values ...interface{}) *Operation {
if len(values) == 1 {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND, NewValue(values[0])}, encoder: listGenericOpEncoder}
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListAppendOp",
"(",
"binName",
"string",
",",
"values",
"...",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"1",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_APPEND",
",",
"NewValue",
"(",
"values",
"[",
"0",
"]",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}",
"\n",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_APPEND_ITEMS",
",",
"ListValue",
"(",
"values",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListAppendOp creates a list append operation.
// Server appends values to end of list bin.
// Server returns list size on bin name.
// It will panic is no values have been passed. | [
"ListAppendOp",
"creates",
"a",
"list",
"append",
"operation",
".",
"Server",
"appends",
"values",
"to",
"end",
"of",
"list",
"bin",
".",
"Server",
"returns",
"list",
"size",
"on",
"bin",
"name",
".",
"It",
"will",
"panic",
"is",
"no",
"values",
"have",
"been",
"passed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L248-L253 |
10,016 | aerospike/aerospike-client-go | cdt_list.go | ListAppendWithPolicyOp | func ListAppendWithPolicyOp(policy *ListPolicy, binName string, values ...interface{}) *Operation {
switch len(values) {
case 1:
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND, NewValue(values[0]), IntegerValue(policy.attributes), IntegerValue(policy.flags)}, encoder: listGenericOpEncoder}
default:
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values), IntegerValue(policy.attributes), IntegerValue(policy.flags)}, encoder: listGenericOpEncoder}
}
} | go | func ListAppendWithPolicyOp(policy *ListPolicy, binName string, values ...interface{}) *Operation {
switch len(values) {
case 1:
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND, NewValue(values[0]), IntegerValue(policy.attributes), IntegerValue(policy.flags)}, encoder: listGenericOpEncoder}
default:
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values), IntegerValue(policy.attributes), IntegerValue(policy.flags)}, encoder: listGenericOpEncoder}
}
} | [
"func",
"ListAppendWithPolicyOp",
"(",
"policy",
"*",
"ListPolicy",
",",
"binName",
"string",
",",
"values",
"...",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"switch",
"len",
"(",
"values",
")",
"{",
"case",
"1",
":",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_APPEND",
",",
"NewValue",
"(",
"values",
"[",
"0",
"]",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"attributes",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"flags",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"default",
":",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_APPEND_ITEMS",
",",
"ListValue",
"(",
"values",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"attributes",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"flags",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}",
"\n",
"}"
]
| // ListAppendWithPolicyOp creates a list append operation.
// Server appends values to end of list bin.
// Server returns list size on bin name.
// It will panic is no values have been passed. | [
"ListAppendWithPolicyOp",
"creates",
"a",
"list",
"append",
"operation",
".",
"Server",
"appends",
"values",
"to",
"end",
"of",
"list",
"bin",
".",
"Server",
"returns",
"list",
"size",
"on",
"bin",
"name",
".",
"It",
"will",
"panic",
"is",
"no",
"values",
"have",
"been",
"passed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L259-L266 |
10,017 | aerospike/aerospike-client-go | cdt_list.go | ListInsertOp | func ListInsertOp(binName string, index int, values ...interface{}) *Operation {
if len(values) == 1 {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INSERT, IntegerValue(index), NewValue(values[0])}, encoder: listGenericOpEncoder}
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INSERT_ITEMS, IntegerValue(index), ListValue(values)}, encoder: listGenericOpEncoder}
} | go | func ListInsertOp(binName string, index int, values ...interface{}) *Operation {
if len(values) == 1 {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INSERT, IntegerValue(index), NewValue(values[0])}, encoder: listGenericOpEncoder}
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INSERT_ITEMS, IntegerValue(index), ListValue(values)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListInsertOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"values",
"...",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"if",
"len",
"(",
"values",
")",
"==",
"1",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_INSERT",
",",
"IntegerValue",
"(",
"index",
")",
",",
"NewValue",
"(",
"values",
"[",
"0",
"]",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}",
"\n",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_INSERT_ITEMS",
",",
"IntegerValue",
"(",
"index",
")",
",",
"ListValue",
"(",
"values",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListInsertOp creates a list insert operation.
// Server inserts value to specified index of list bin.
// Server returns list size on bin name.
// It will panic is no values have been passed. | [
"ListInsertOp",
"creates",
"a",
"list",
"insert",
"operation",
".",
"Server",
"inserts",
"value",
"to",
"specified",
"index",
"of",
"list",
"bin",
".",
"Server",
"returns",
"list",
"size",
"on",
"bin",
"name",
".",
"It",
"will",
"panic",
"is",
"no",
"values",
"have",
"been",
"passed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L272-L277 |
10,018 | aerospike/aerospike-client-go | cdt_list.go | ListPopOp | func ListPopOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListPopOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListPopOp",
"(",
"binName",
"string",
",",
"index",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_POP",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListPopOp creates list pop operation.
// Server returns item at specified index and removes item from list bin. | [
"ListPopOp",
"creates",
"list",
"pop",
"operation",
".",
"Server",
"returns",
"item",
"at",
"specified",
"index",
"and",
"removes",
"item",
"from",
"list",
"bin",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L292-L294 |
10,019 | aerospike/aerospike-client-go | cdt_list.go | ListPopRangeOp | func ListPopRangeOp(binName string, index int, count int) *Operation {
if count == 1 {
return ListPopOp(binName, index)
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | go | func ListPopRangeOp(binName string, index int, count int) *Operation {
if count == 1 {
return ListPopOp(binName, index)
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListPopRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
")",
"*",
"Operation",
"{",
"if",
"count",
"==",
"1",
"{",
"return",
"ListPopOp",
"(",
"binName",
",",
"index",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_POP_RANGE",
",",
"IntegerValue",
"(",
"index",
")",
",",
"IntegerValue",
"(",
"count",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListPopRangeOp creates a list pop range operation.
// Server returns items starting at specified index and removes items from list bin. | [
"ListPopRangeOp",
"creates",
"a",
"list",
"pop",
"range",
"operation",
".",
"Server",
"returns",
"items",
"starting",
"at",
"specified",
"index",
"and",
"removes",
"items",
"from",
"list",
"bin",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L298-L304 |
10,020 | aerospike/aerospike-client-go | cdt_list.go | ListPopRangeFromOp | func ListPopRangeFromOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListPopRangeFromOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListPopRangeFromOp",
"(",
"binName",
"string",
",",
"index",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_POP_RANGE",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListPopRangeFromOp creates a list pop range operation.
// Server returns items starting at specified index to the end of list and removes items from list bin. | [
"ListPopRangeFromOp",
"creates",
"a",
"list",
"pop",
"range",
"operation",
".",
"Server",
"returns",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"list",
"and",
"removes",
"items",
"from",
"list",
"bin",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L308-L310 |
10,021 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveOp | func ListRemoveOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveOp",
"(",
"binName",
"string",
",",
"index",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveOp creates a list remove operation.
// Server removes item at specified index from list bin.
// Server returns number of items removed. | [
"ListRemoveOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"item",
"at",
"specified",
"index",
"from",
"list",
"bin",
".",
"Server",
"returns",
"number",
"of",
"items",
"removed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L315-L317 |
10,022 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByValueOp | func ListRemoveByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByValueOp",
"(",
"binName",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_VALUE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"NewValue",
"(",
"value",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByValueOp creates list remove by value operation.
// Server removes the item identified by value and returns removed data specified by returnType. | [
"ListRemoveByValueOp",
"creates",
"list",
"remove",
"by",
"value",
"operation",
".",
"Server",
"removes",
"the",
"item",
"identified",
"by",
"value",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L321-L323 |
10,023 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByValueListOp | func ListRemoveByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByValueListOp",
"(",
"binName",
"string",
",",
"values",
"[",
"]",
"interface",
"{",
"}",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_VALUE_LIST",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"ListValue",
"(",
"values",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByValueListOp creates list remove by value operation.
// Server removes list items identified by value and returns removed data specified by returnType. | [
"ListRemoveByValueListOp",
"creates",
"list",
"remove",
"by",
"value",
"operation",
".",
"Server",
"removes",
"list",
"items",
"identified",
"by",
"value",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L327-L329 |
10,024 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveRangeOp | func ListRemoveRangeOp(binName string, index int, count int) *Operation {
if count == 1 {
return ListRemoveOp(binName, index)
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveRangeOp(binName string, index int, count int) *Operation {
if count == 1 {
return ListRemoveOp(binName, index)
}
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
")",
"*",
"Operation",
"{",
"if",
"count",
"==",
"1",
"{",
"return",
"ListRemoveOp",
"(",
"binName",
",",
"index",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_RANGE",
",",
"IntegerValue",
"(",
"index",
")",
",",
"IntegerValue",
"(",
"count",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveRangeOp creates a list remove range operation.
// Server removes "count" items starting at specified index from list bin.
// Server returns number of items removed. | [
"ListRemoveRangeOp",
"creates",
"a",
"list",
"remove",
"range",
"operation",
".",
"Server",
"removes",
"count",
"items",
"starting",
"at",
"specified",
"index",
"from",
"list",
"bin",
".",
"Server",
"returns",
"number",
"of",
"items",
"removed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L376-L382 |
10,025 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveRangeFromOp | func ListRemoveRangeFromOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveRangeFromOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveRangeFromOp",
"(",
"binName",
"string",
",",
"index",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_RANGE",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveRangeFromOp creates a list remove range operation.
// Server removes all items starting at specified index to the end of list.
// Server returns number of items removed. | [
"ListRemoveRangeFromOp",
"creates",
"a",
"list",
"remove",
"range",
"operation",
".",
"Server",
"removes",
"all",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"list",
".",
"Server",
"returns",
"number",
"of",
"items",
"removed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L387-L389 |
10,026 | aerospike/aerospike-client-go | cdt_list.go | ListSetOp | func ListSetOp(binName string, index int, value interface{}) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SET, IntegerValue(index), NewValue(value)}, encoder: listGenericOpEncoder}
} | go | func ListSetOp(binName string, index int, value interface{}) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SET, IntegerValue(index), NewValue(value)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListSetOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"value",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_SET",
",",
"IntegerValue",
"(",
"index",
")",
",",
"NewValue",
"(",
"value",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListSetOp creates a list set operation.
// Server sets item value at specified index in list bin.
// Server does not return a result by default. | [
"ListSetOp",
"creates",
"a",
"list",
"set",
"operation",
".",
"Server",
"sets",
"item",
"value",
"at",
"specified",
"index",
"in",
"list",
"bin",
".",
"Server",
"does",
"not",
"return",
"a",
"result",
"by",
"default",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L394-L396 |
10,027 | aerospike/aerospike-client-go | cdt_list.go | ListTrimOp | func ListTrimOp(binName string, index int, count int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_TRIM, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | go | func ListTrimOp(binName string, index int, count int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_TRIM, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListTrimOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_TRIM",
",",
"IntegerValue",
"(",
"index",
")",
",",
"IntegerValue",
"(",
"count",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListTrimOp creates a list trim operation.
// Server removes items in list bin that do not fall into range specified by index
// and count range. If the range is out of bounds, then all items will be removed.
// Server returns number of elemts that were removed. | [
"ListTrimOp",
"creates",
"a",
"list",
"trim",
"operation",
".",
"Server",
"removes",
"items",
"in",
"list",
"bin",
"that",
"do",
"not",
"fall",
"into",
"range",
"specified",
"by",
"index",
"and",
"count",
"range",
".",
"If",
"the",
"range",
"is",
"out",
"of",
"bounds",
"then",
"all",
"items",
"will",
"be",
"removed",
".",
"Server",
"returns",
"number",
"of",
"elemts",
"that",
"were",
"removed",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L402-L404 |
10,028 | aerospike/aerospike-client-go | cdt_list.go | ListClearOp | func ListClearOp(binName string) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_CLEAR}, encoder: listGenericOpEncoder}
} | go | func ListClearOp(binName string) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_CLEAR}, encoder: listGenericOpEncoder}
} | [
"func",
"ListClearOp",
"(",
"binName",
"string",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_CLEAR",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListClearOp creates a list clear operation.
// Server removes all items in list bin.
// Server does not return a result by default. | [
"ListClearOp",
"creates",
"a",
"list",
"clear",
"operation",
".",
"Server",
"removes",
"all",
"items",
"in",
"list",
"bin",
".",
"Server",
"does",
"not",
"return",
"a",
"result",
"by",
"default",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L409-L411 |
10,029 | aerospike/aerospike-client-go | cdt_list.go | ListSizeOp | func ListSizeOp(binName string) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_SIZE}, encoder: listGenericOpEncoder}
} | go | func ListSizeOp(binName string) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_SIZE}, encoder: listGenericOpEncoder}
} | [
"func",
"ListSizeOp",
"(",
"binName",
"string",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_SIZE",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListSizeOp creates a list size operation.
// Server returns size of list on bin name. | [
"ListSizeOp",
"creates",
"a",
"list",
"size",
"operation",
".",
"Server",
"returns",
"size",
"of",
"list",
"on",
"bin",
"name",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L457-L459 |
10,030 | aerospike/aerospike-client-go | cdt_list.go | ListGetOp | func ListGetOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListGetOp(binName string, index int) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET, IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetOp",
"(",
"binName",
"string",
",",
"index",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetOp creates a list get operation.
// Server returns item at specified index in list bin. | [
"ListGetOp",
"creates",
"a",
"list",
"get",
"operation",
".",
"Server",
"returns",
"item",
"at",
"specified",
"index",
"in",
"list",
"bin",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L463-L465 |
10,031 | aerospike/aerospike-client-go | cdt_list.go | ListGetRangeOp | func ListGetRangeOp(binName string, index int, count int) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | go | func ListGetRangeOp(binName string, index int, count int) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_RANGE",
",",
"IntegerValue",
"(",
"index",
")",
",",
"IntegerValue",
"(",
"count",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetRangeOp creates a list get range operation.
// Server returns "count" items starting at specified index in list bin. | [
"ListGetRangeOp",
"creates",
"a",
"list",
"get",
"range",
"operation",
".",
"Server",
"returns",
"count",
"items",
"starting",
"at",
"specified",
"index",
"in",
"list",
"bin",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L469-L471 |
10,032 | aerospike/aerospike-client-go | cdt_list.go | ListSortOp | func ListSortOp(binName string, sortFlags int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SORT, IntegerValue(sortFlags)}, encoder: listGenericOpEncoder}
} | go | func ListSortOp(binName string, sortFlags int) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_SORT, IntegerValue(sortFlags)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListSortOp",
"(",
"binName",
"string",
",",
"sortFlags",
"int",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_SORT",
",",
"IntegerValue",
"(",
"sortFlags",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListSortOp creates list sort operation.
// Server sorts list according to sortFlags.
// Server does not return a result by default. | [
"ListSortOp",
"creates",
"list",
"sort",
"operation",
".",
"Server",
"sorts",
"list",
"according",
"to",
"sortFlags",
".",
"Server",
"does",
"not",
"return",
"a",
"result",
"by",
"default",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L482-L484 |
10,033 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByIndexOp | func ListRemoveByIndexOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByIndexOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByIndexOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_INDEX",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByIndexOp creates a list remove operation.
// Server removes list item identified by index and returns removed data specified by returnType. | [
"ListRemoveByIndexOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"list",
"item",
"identified",
"by",
"index",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L488-L490 |
10,034 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByIndexRangeOp | func ListRemoveByIndexRangeOp(binName string, index, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByIndexRangeOp(binName string, index, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByIndexRangeOp",
"(",
"binName",
"string",
",",
"index",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_INDEX_RANGE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByIndexRangeOp creates a list remove operation.
// Server removes list items starting at specified index to the end of list and returns removed
// data specified by returnType. | [
"ListRemoveByIndexRangeOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"list",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"list",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L495-L497 |
10,035 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByIndexRangeCountOp | func ListRemoveByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByIndexRangeCountOp(binName string, index, count int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByIndexRangeCountOp",
"(",
"binName",
"string",
",",
"index",
",",
"count",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_INDEX_RANGE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"index",
")",
",",
"IntegerValue",
"(",
"count",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByIndexRangeCountOp creates a list remove operation.
// Server removes "count" list items starting at specified index and returns removed data specified by returnType. | [
"ListRemoveByIndexRangeCountOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"count",
"list",
"items",
"starting",
"at",
"specified",
"index",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L501-L503 |
10,036 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByRankOp | func ListRemoveByRankOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByRankOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByRankOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_RANK",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"rank",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByRankOp creates a list remove operation.
// Server removes list item identified by rank and returns removed data specified by returnType. | [
"ListRemoveByRankOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"list",
"item",
"identified",
"by",
"rank",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L507-L509 |
10,037 | aerospike/aerospike-client-go | cdt_list.go | ListRemoveByRankRangeOp | func ListRemoveByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | go | func ListRemoveByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_REMOVE_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListRemoveByRankRangeOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_MODIFY",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_REMOVE_BY_RANK_RANGE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"rank",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListRemoveByRankRangeOp creates a list remove operation.
// Server removes list items starting at specified rank to the last ranked item and returns removed
// data specified by returnType. | [
"ListRemoveByRankRangeOp",
"creates",
"a",
"list",
"remove",
"operation",
".",
"Server",
"removes",
"list",
"items",
"starting",
"at",
"specified",
"rank",
"to",
"the",
"last",
"ranked",
"item",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L514-L516 |
10,038 | aerospike/aerospike-client-go | cdt_list.go | ListGetByValueOp | func ListGetByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder}
} | go | func ListGetByValueOp(binName string, value interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByValueOp",
"(",
"binName",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_VALUE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"NewValue",
"(",
"value",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByValueOp creates a list get by value operation.
// Server selects list items identified by value and returns selected data specified by returnType. | [
"ListGetByValueOp",
"creates",
"a",
"list",
"get",
"by",
"value",
"operation",
".",
"Server",
"selects",
"list",
"items",
"identified",
"by",
"value",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L526-L528 |
10,039 | aerospike/aerospike-client-go | cdt_list.go | ListGetByValueListOp | func ListGetByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder}
} | go | func ListGetByValueListOp(binName string, values []interface{}, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByValueListOp",
"(",
"binName",
"string",
",",
"values",
"[",
"]",
"interface",
"{",
"}",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_VALUE_LIST",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"ListValue",
"(",
"values",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByValueListOp creates list get by value list operation.
// Server selects list items identified by values and returns selected data specified by returnType. | [
"ListGetByValueListOp",
"creates",
"list",
"get",
"by",
"value",
"list",
"operation",
".",
"Server",
"selects",
"list",
"items",
"identified",
"by",
"values",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L532-L534 |
10,040 | aerospike/aerospike-client-go | cdt_list.go | ListGetByIndexOp | func ListGetByIndexOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListGetByIndexOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByIndexOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_INDEX",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByIndexOp creates list get by index operation.
// Server selects list item identified by index and returns selected data specified by returnType | [
"ListGetByIndexOp",
"creates",
"list",
"get",
"by",
"index",
"operation",
".",
"Server",
"selects",
"list",
"item",
"identified",
"by",
"index",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L547-L549 |
10,041 | aerospike/aerospike-client-go | cdt_list.go | ListGetByIndexRangeOp | func ListGetByIndexRangeOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | go | func ListGetByIndexRangeOp(binName string, index int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByIndexRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_INDEX_RANGE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"index",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByIndexRangeOp creates list get by index range operation.
// Server selects list items starting at specified index to the end of list and returns selected
// data specified by returnType. | [
"ListGetByIndexRangeOp",
"creates",
"list",
"get",
"by",
"index",
"range",
"operation",
".",
"Server",
"selects",
"list",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"list",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L554-L556 |
10,042 | aerospike/aerospike-client-go | cdt_list.go | ListGetByRankOp | func ListGetByRankOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | go | func ListGetByRankOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByRankOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_RANK",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"rank",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByRankOp creates a list get by rank operation.
// Server selects list item identified by rank and returns selected data specified by returnType. | [
"ListGetByRankOp",
"creates",
"a",
"list",
"get",
"by",
"rank",
"operation",
".",
"Server",
"selects",
"list",
"item",
"identified",
"by",
"rank",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L567-L569 |
10,043 | aerospike/aerospike-client-go | cdt_list.go | ListGetByRankRangeOp | func ListGetByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | go | func ListGetByRankRangeOp(binName string, rank int, returnType ListReturnType) *Operation {
return &Operation{opType: _CDT_READ, binName: binName, binValue: ListValue{_CDT_LIST_GET_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder}
} | [
"func",
"ListGetByRankRangeOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"ListReturnType",
")",
"*",
"Operation",
"{",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_CDT_READ",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"{",
"_CDT_LIST_GET_BY_RANK_RANGE",
",",
"IntegerValue",
"(",
"returnType",
")",
",",
"IntegerValue",
"(",
"rank",
")",
"}",
",",
"encoder",
":",
"listGenericOpEncoder",
"}",
"\n",
"}"
]
| // ListGetByRankRangeOp creates a list get by rank range operation.
// Server selects list items starting at specified rank to the last ranked item and returns selected
// data specified by returnType. | [
"ListGetByRankRangeOp",
"creates",
"a",
"list",
"get",
"by",
"rank",
"range",
"operation",
".",
"Server",
"selects",
"list",
"items",
"starting",
"at",
"specified",
"rank",
"to",
"the",
"last",
"ranked",
"item",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_list.go#L574-L576 |
10,044 | aerospike/aerospike-client-go | scan_policy.go | NewScanPolicy | func NewScanPolicy() *ScanPolicy {
mp := *NewMultiPolicy()
mp.TotalTimeout = 0
return &ScanPolicy{
MultiPolicy: mp,
ScanPercent: 100,
ConcurrentNodes: true,
}
} | go | func NewScanPolicy() *ScanPolicy {
mp := *NewMultiPolicy()
mp.TotalTimeout = 0
return &ScanPolicy{
MultiPolicy: mp,
ScanPercent: 100,
ConcurrentNodes: true,
}
} | [
"func",
"NewScanPolicy",
"(",
")",
"*",
"ScanPolicy",
"{",
"mp",
":=",
"*",
"NewMultiPolicy",
"(",
")",
"\n",
"mp",
".",
"TotalTimeout",
"=",
"0",
"\n\n",
"return",
"&",
"ScanPolicy",
"{",
"MultiPolicy",
":",
"mp",
",",
"ScanPercent",
":",
"100",
",",
"ConcurrentNodes",
":",
"true",
",",
"}",
"\n",
"}"
]
| // NewScanPolicy creates a new ScanPolicy instance with default values. | [
"NewScanPolicy",
"creates",
"a",
"new",
"ScanPolicy",
"instance",
"with",
"default",
"values",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/scan_policy.go#L31-L40 |
10,045 | aerospike/aerospike-client-go | task_remove.go | NewRemoveTask | func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask {
return &RemoveTask{
baseTask: newTask(cluster),
packageName: packageName,
}
} | go | func NewRemoveTask(cluster *Cluster, packageName string) *RemoveTask {
return &RemoveTask{
baseTask: newTask(cluster),
packageName: packageName,
}
} | [
"func",
"NewRemoveTask",
"(",
"cluster",
"*",
"Cluster",
",",
"packageName",
"string",
")",
"*",
"RemoveTask",
"{",
"return",
"&",
"RemoveTask",
"{",
"baseTask",
":",
"newTask",
"(",
"cluster",
")",
",",
"packageName",
":",
"packageName",
",",
"}",
"\n",
"}"
]
| // NewRemoveTask initializes a RemoveTask with fields needed to query server nodes. | [
"NewRemoveTask",
"initializes",
"a",
"RemoveTask",
"with",
"fields",
"needed",
"to",
"query",
"server",
"nodes",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/task_remove.go#L29-L34 |
10,046 | aerospike/aerospike-client-go | types/pool.go | Get | func (bp *Pool) Get(params ...interface{}) interface{} {
res := bp.pool.Poll()
if res == nil || (bp.IsUsable != nil && !bp.IsUsable(res, params...)) {
// not usable, so finalize
if res != nil && bp.Finalize != nil {
bp.Finalize(res)
}
if bp.New != nil {
res = bp.New(params...)
}
}
return res
} | go | func (bp *Pool) Get(params ...interface{}) interface{} {
res := bp.pool.Poll()
if res == nil || (bp.IsUsable != nil && !bp.IsUsable(res, params...)) {
// not usable, so finalize
if res != nil && bp.Finalize != nil {
bp.Finalize(res)
}
if bp.New != nil {
res = bp.New(params...)
}
}
return res
} | [
"func",
"(",
"bp",
"*",
"Pool",
")",
"Get",
"(",
"params",
"...",
"interface",
"{",
"}",
")",
"interface",
"{",
"}",
"{",
"res",
":=",
"bp",
".",
"pool",
".",
"Poll",
"(",
")",
"\n",
"if",
"res",
"==",
"nil",
"||",
"(",
"bp",
".",
"IsUsable",
"!=",
"nil",
"&&",
"!",
"bp",
".",
"IsUsable",
"(",
"res",
",",
"params",
"...",
")",
")",
"{",
"// not usable, so finalize",
"if",
"res",
"!=",
"nil",
"&&",
"bp",
".",
"Finalize",
"!=",
"nil",
"{",
"bp",
".",
"Finalize",
"(",
"res",
")",
"\n",
"}",
"\n\n",
"if",
"bp",
".",
"New",
"!=",
"nil",
"{",
"res",
"=",
"bp",
".",
"New",
"(",
"params",
"...",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"res",
"\n",
"}"
]
| // Get returns an element from the pool.
// If the pool is empty, or the returned element is not usable,
// nil or the result of the New function will be returned | [
"Get",
"returns",
"an",
"element",
"from",
"the",
"pool",
".",
"If",
"the",
"pool",
"is",
"empty",
"or",
"the",
"returned",
"element",
"is",
"not",
"usable",
"nil",
"or",
"the",
"result",
"of",
"the",
"New",
"function",
"will",
"be",
"returned"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/pool.go#L46-L60 |
10,047 | aerospike/aerospike-client-go | types/pool.go | Put | func (bp *Pool) Put(obj interface{}) {
finalize := true
if bp.CanReturn == nil || bp.CanReturn(obj) {
finalize = !bp.pool.Offer(obj)
}
if finalize && bp.Finalize != nil {
bp.Finalize(obj)
}
} | go | func (bp *Pool) Put(obj interface{}) {
finalize := true
if bp.CanReturn == nil || bp.CanReturn(obj) {
finalize = !bp.pool.Offer(obj)
}
if finalize && bp.Finalize != nil {
bp.Finalize(obj)
}
} | [
"func",
"(",
"bp",
"*",
"Pool",
")",
"Put",
"(",
"obj",
"interface",
"{",
"}",
")",
"{",
"finalize",
":=",
"true",
"\n",
"if",
"bp",
".",
"CanReturn",
"==",
"nil",
"||",
"bp",
".",
"CanReturn",
"(",
"obj",
")",
"{",
"finalize",
"=",
"!",
"bp",
".",
"pool",
".",
"Offer",
"(",
"obj",
")",
"\n",
"}",
"\n\n",
"if",
"finalize",
"&&",
"bp",
".",
"Finalize",
"!=",
"nil",
"{",
"bp",
".",
"Finalize",
"(",
"obj",
")",
"\n",
"}",
"\n",
"}"
]
| // Put will add the elem back to the pool, unless the pool is full. | [
"Put",
"will",
"add",
"the",
"elem",
"back",
"to",
"the",
"pool",
"unless",
"the",
"pool",
"is",
"full",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/types/pool.go#L63-L72 |
10,048 | aerospike/aerospike-client-go | client_policy.go | NewClientPolicy | func NewClientPolicy() *ClientPolicy {
return &ClientPolicy{
AuthMode: AuthModeInternal,
Timeout: 30 * time.Second,
IdleTimeout: defaultIdleTimeout,
LoginTimeout: 10 * time.Second,
ConnectionQueueSize: 256,
OpeningConnectionThreshold: 0,
FailIfNotConnected: true,
TendInterval: time.Second,
LimitConnectionsToQueueSize: true,
IgnoreOtherSubnetAliases: false,
}
} | go | func NewClientPolicy() *ClientPolicy {
return &ClientPolicy{
AuthMode: AuthModeInternal,
Timeout: 30 * time.Second,
IdleTimeout: defaultIdleTimeout,
LoginTimeout: 10 * time.Second,
ConnectionQueueSize: 256,
OpeningConnectionThreshold: 0,
FailIfNotConnected: true,
TendInterval: time.Second,
LimitConnectionsToQueueSize: true,
IgnoreOtherSubnetAliases: false,
}
} | [
"func",
"NewClientPolicy",
"(",
")",
"*",
"ClientPolicy",
"{",
"return",
"&",
"ClientPolicy",
"{",
"AuthMode",
":",
"AuthModeInternal",
",",
"Timeout",
":",
"30",
"*",
"time",
".",
"Second",
",",
"IdleTimeout",
":",
"defaultIdleTimeout",
",",
"LoginTimeout",
":",
"10",
"*",
"time",
".",
"Second",
",",
"ConnectionQueueSize",
":",
"256",
",",
"OpeningConnectionThreshold",
":",
"0",
",",
"FailIfNotConnected",
":",
"true",
",",
"TendInterval",
":",
"time",
".",
"Second",
",",
"LimitConnectionsToQueueSize",
":",
"true",
",",
"IgnoreOtherSubnetAliases",
":",
"false",
",",
"}",
"\n",
"}"
]
| // NewClientPolicy generates a new ClientPolicy with default values. | [
"NewClientPolicy",
"generates",
"a",
"new",
"ClientPolicy",
"with",
"default",
"values",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_policy.go#L116-L129 |
10,049 | aerospike/aerospike-client-go | connection.go | newConnection | func newConnection(address string, timeout time.Duration) (*Connection, error) {
newConn := &Connection{dataBuffer: make([]byte, DefaultBufferSize)}
runtime.SetFinalizer(newConn, connectionFinalizer)
// don't wait indefinitely
if timeout == 0 {
timeout = 5 * time.Second
}
conn, err := net.DialTimeout("tcp", address, timeout)
if err != nil {
Logger.Error("Connection to address `" + address + "` failed to establish with error: " + err.Error())
return nil, errToTimeoutErr(nil, err)
}
newConn.conn = conn
// set timeout at the last possible moment
if err := newConn.SetTimeout(time.Now().Add(timeout), timeout); err != nil {
newConn.Close()
return nil, err
}
return newConn, nil
} | go | func newConnection(address string, timeout time.Duration) (*Connection, error) {
newConn := &Connection{dataBuffer: make([]byte, DefaultBufferSize)}
runtime.SetFinalizer(newConn, connectionFinalizer)
// don't wait indefinitely
if timeout == 0 {
timeout = 5 * time.Second
}
conn, err := net.DialTimeout("tcp", address, timeout)
if err != nil {
Logger.Error("Connection to address `" + address + "` failed to establish with error: " + err.Error())
return nil, errToTimeoutErr(nil, err)
}
newConn.conn = conn
// set timeout at the last possible moment
if err := newConn.SetTimeout(time.Now().Add(timeout), timeout); err != nil {
newConn.Close()
return nil, err
}
return newConn, nil
} | [
"func",
"newConnection",
"(",
"address",
"string",
",",
"timeout",
"time",
".",
"Duration",
")",
"(",
"*",
"Connection",
",",
"error",
")",
"{",
"newConn",
":=",
"&",
"Connection",
"{",
"dataBuffer",
":",
"make",
"(",
"[",
"]",
"byte",
",",
"DefaultBufferSize",
")",
"}",
"\n",
"runtime",
".",
"SetFinalizer",
"(",
"newConn",
",",
"connectionFinalizer",
")",
"\n\n",
"// don't wait indefinitely",
"if",
"timeout",
"==",
"0",
"{",
"timeout",
"=",
"5",
"*",
"time",
".",
"Second",
"\n",
"}",
"\n\n",
"conn",
",",
"err",
":=",
"net",
".",
"DialTimeout",
"(",
"\"",
"\"",
",",
"address",
",",
"timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"Logger",
".",
"Error",
"(",
"\"",
"\"",
"+",
"address",
"+",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"errToTimeoutErr",
"(",
"nil",
",",
"err",
")",
"\n",
"}",
"\n",
"newConn",
".",
"conn",
"=",
"conn",
"\n\n",
"// set timeout at the last possible moment",
"if",
"err",
":=",
"newConn",
".",
"SetTimeout",
"(",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"timeout",
")",
",",
"timeout",
")",
";",
"err",
"!=",
"nil",
"{",
"newConn",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"newConn",
",",
"nil",
"\n",
"}"
]
| // newConnection creates a connection on the network and returns the pointer
// A minimum timeout of 2 seconds will always be applied.
// If the connection is not established in the specified timeout,
// an error will be returned | [
"newConnection",
"creates",
"a",
"connection",
"on",
"the",
"network",
"and",
"returns",
"the",
"pointer",
"A",
"minimum",
"timeout",
"of",
"2",
"seconds",
"will",
"always",
"be",
"applied",
".",
"If",
"the",
"connection",
"is",
"not",
"established",
"in",
"the",
"specified",
"timeout",
"an",
"error",
"will",
"be",
"returned"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L85-L108 |
10,050 | aerospike/aerospike-client-go | connection.go | NewConnection | func NewConnection(policy *ClientPolicy, host *Host) (*Connection, error) {
address := net.JoinHostPort(host.Name, strconv.Itoa(host.Port))
conn, err := newConnection(address, policy.Timeout)
if err != nil {
return nil, err
}
if policy.TlsConfig == nil {
return conn, nil
}
// Use version dependent clone function to clone the config
tlsConfig := cloneTLSConfig(policy.TlsConfig)
tlsConfig.ServerName = host.TLSName
sconn := tls.Client(conn.conn, tlsConfig)
if err := sconn.Handshake(); err != nil {
sconn.Close()
return nil, err
}
if host.TLSName != "" && !tlsConfig.InsecureSkipVerify {
if err := sconn.VerifyHostname(host.TLSName); err != nil {
sconn.Close()
Logger.Error("Connection to address `" + address + "` failed to establish with error: " + err.Error())
return nil, errToTimeoutErr(nil, err)
}
}
conn.conn = sconn
return conn, nil
} | go | func NewConnection(policy *ClientPolicy, host *Host) (*Connection, error) {
address := net.JoinHostPort(host.Name, strconv.Itoa(host.Port))
conn, err := newConnection(address, policy.Timeout)
if err != nil {
return nil, err
}
if policy.TlsConfig == nil {
return conn, nil
}
// Use version dependent clone function to clone the config
tlsConfig := cloneTLSConfig(policy.TlsConfig)
tlsConfig.ServerName = host.TLSName
sconn := tls.Client(conn.conn, tlsConfig)
if err := sconn.Handshake(); err != nil {
sconn.Close()
return nil, err
}
if host.TLSName != "" && !tlsConfig.InsecureSkipVerify {
if err := sconn.VerifyHostname(host.TLSName); err != nil {
sconn.Close()
Logger.Error("Connection to address `" + address + "` failed to establish with error: " + err.Error())
return nil, errToTimeoutErr(nil, err)
}
}
conn.conn = sconn
return conn, nil
} | [
"func",
"NewConnection",
"(",
"policy",
"*",
"ClientPolicy",
",",
"host",
"*",
"Host",
")",
"(",
"*",
"Connection",
",",
"error",
")",
"{",
"address",
":=",
"net",
".",
"JoinHostPort",
"(",
"host",
".",
"Name",
",",
"strconv",
".",
"Itoa",
"(",
"host",
".",
"Port",
")",
")",
"\n",
"conn",
",",
"err",
":=",
"newConnection",
"(",
"address",
",",
"policy",
".",
"Timeout",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"policy",
".",
"TlsConfig",
"==",
"nil",
"{",
"return",
"conn",
",",
"nil",
"\n",
"}",
"\n\n",
"// Use version dependent clone function to clone the config",
"tlsConfig",
":=",
"cloneTLSConfig",
"(",
"policy",
".",
"TlsConfig",
")",
"\n",
"tlsConfig",
".",
"ServerName",
"=",
"host",
".",
"TLSName",
"\n\n",
"sconn",
":=",
"tls",
".",
"Client",
"(",
"conn",
".",
"conn",
",",
"tlsConfig",
")",
"\n",
"if",
"err",
":=",
"sconn",
".",
"Handshake",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"sconn",
".",
"Close",
"(",
")",
"\n",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"if",
"host",
".",
"TLSName",
"!=",
"\"",
"\"",
"&&",
"!",
"tlsConfig",
".",
"InsecureSkipVerify",
"{",
"if",
"err",
":=",
"sconn",
".",
"VerifyHostname",
"(",
"host",
".",
"TLSName",
")",
";",
"err",
"!=",
"nil",
"{",
"sconn",
".",
"Close",
"(",
")",
"\n",
"Logger",
".",
"Error",
"(",
"\"",
"\"",
"+",
"address",
"+",
"\"",
"\"",
"+",
"err",
".",
"Error",
"(",
")",
")",
"\n",
"return",
"nil",
",",
"errToTimeoutErr",
"(",
"nil",
",",
"err",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"conn",
".",
"conn",
"=",
"sconn",
"\n",
"return",
"conn",
",",
"nil",
"\n",
"}"
]
| // NewConnection creates a TLS connection on the network and returns the pointer.
// A minimum timeout of 2 seconds will always be applied.
// If the connection is not established in the specified timeout,
// an error will be returned | [
"NewConnection",
"creates",
"a",
"TLS",
"connection",
"on",
"the",
"network",
"and",
"returns",
"the",
"pointer",
".",
"A",
"minimum",
"timeout",
"of",
"2",
"seconds",
"will",
"always",
"be",
"applied",
".",
"If",
"the",
"connection",
"is",
"not",
"established",
"in",
"the",
"specified",
"timeout",
"an",
"error",
"will",
"be",
"returned"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L114-L145 |
10,051 | aerospike/aerospike-client-go | connection.go | Write | func (ctn *Connection) Write(buf []byte) (total int, err error) {
// make sure all bytes are written
// Don't worry about the loop, timeout has been set elsewhere
length := len(buf)
for total < length {
var r int
if err = ctn.updateDeadline(); err != nil {
break
}
r, err = ctn.conn.Write(buf[total:])
total += r
if err != nil {
break
}
}
// If all bytes are written, ignore any potential error
// The error will bubble up on the next network io if it matters.
if total == len(buf) {
return total, nil
}
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
ctn.Close()
return total, errToTimeoutErr(ctn, err)
} | go | func (ctn *Connection) Write(buf []byte) (total int, err error) {
// make sure all bytes are written
// Don't worry about the loop, timeout has been set elsewhere
length := len(buf)
for total < length {
var r int
if err = ctn.updateDeadline(); err != nil {
break
}
r, err = ctn.conn.Write(buf[total:])
total += r
if err != nil {
break
}
}
// If all bytes are written, ignore any potential error
// The error will bubble up on the next network io if it matters.
if total == len(buf) {
return total, nil
}
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
ctn.Close()
return total, errToTimeoutErr(ctn, err)
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"Write",
"(",
"buf",
"[",
"]",
"byte",
")",
"(",
"total",
"int",
",",
"err",
"error",
")",
"{",
"// make sure all bytes are written",
"// Don't worry about the loop, timeout has been set elsewhere",
"length",
":=",
"len",
"(",
"buf",
")",
"\n",
"for",
"total",
"<",
"length",
"{",
"var",
"r",
"int",
"\n",
"if",
"err",
"=",
"ctn",
".",
"updateDeadline",
"(",
")",
";",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"r",
",",
"err",
"=",
"ctn",
".",
"conn",
".",
"Write",
"(",
"buf",
"[",
"total",
":",
"]",
")",
"\n",
"total",
"+=",
"r",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"break",
"\n",
"}",
"\n",
"}",
"\n\n",
"// If all bytes are written, ignore any potential error",
"// The error will bubble up on the next network io if it matters.",
"if",
"total",
"==",
"len",
"(",
"buf",
")",
"{",
"return",
"total",
",",
"nil",
"\n",
"}",
"\n\n",
"if",
"ctn",
".",
"node",
"!=",
"nil",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"ctn",
".",
"node",
".",
"stats",
".",
"ConnectionsFailed",
",",
"1",
")",
"\n",
"}",
"\n\n",
"ctn",
".",
"Close",
"(",
")",
"\n\n",
"return",
"total",
",",
"errToTimeoutErr",
"(",
"ctn",
",",
"err",
")",
"\n",
"}"
]
| // Write writes the slice to the connection buffer. | [
"Write",
"writes",
"the",
"slice",
"to",
"the",
"connection",
"buffer",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L148-L177 |
10,052 | aerospike/aerospike-client-go | connection.go | updateDeadline | func (ctn *Connection) updateDeadline() error {
now := time.Now()
var socketDeadline time.Time
if ctn.deadline.IsZero() {
if ctn.socketTimeout > 0 {
socketDeadline = now.Add(ctn.socketTimeout)
}
} else {
if now.After(ctn.deadline) {
return NewAerospikeError(TIMEOUT)
}
if ctn.socketTimeout == 0 {
socketDeadline = ctn.deadline
} else {
tDeadline := now.Add(ctn.socketTimeout)
if tDeadline.After(ctn.deadline) {
socketDeadline = ctn.deadline
} else {
socketDeadline = tDeadline
}
}
// floor to a millisecond to avoid too short timeouts
if socketDeadline.Sub(now) < time.Millisecond {
socketDeadline = now.Add(time.Millisecond)
}
}
if err := ctn.conn.SetDeadline(socketDeadline); err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
return err
}
return nil
} | go | func (ctn *Connection) updateDeadline() error {
now := time.Now()
var socketDeadline time.Time
if ctn.deadline.IsZero() {
if ctn.socketTimeout > 0 {
socketDeadline = now.Add(ctn.socketTimeout)
}
} else {
if now.After(ctn.deadline) {
return NewAerospikeError(TIMEOUT)
}
if ctn.socketTimeout == 0 {
socketDeadline = ctn.deadline
} else {
tDeadline := now.Add(ctn.socketTimeout)
if tDeadline.After(ctn.deadline) {
socketDeadline = ctn.deadline
} else {
socketDeadline = tDeadline
}
}
// floor to a millisecond to avoid too short timeouts
if socketDeadline.Sub(now) < time.Millisecond {
socketDeadline = now.Add(time.Millisecond)
}
}
if err := ctn.conn.SetDeadline(socketDeadline); err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
return err
}
return nil
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"updateDeadline",
"(",
")",
"error",
"{",
"now",
":=",
"time",
".",
"Now",
"(",
")",
"\n",
"var",
"socketDeadline",
"time",
".",
"Time",
"\n",
"if",
"ctn",
".",
"deadline",
".",
"IsZero",
"(",
")",
"{",
"if",
"ctn",
".",
"socketTimeout",
">",
"0",
"{",
"socketDeadline",
"=",
"now",
".",
"Add",
"(",
"ctn",
".",
"socketTimeout",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"if",
"now",
".",
"After",
"(",
"ctn",
".",
"deadline",
")",
"{",
"return",
"NewAerospikeError",
"(",
"TIMEOUT",
")",
"\n",
"}",
"\n",
"if",
"ctn",
".",
"socketTimeout",
"==",
"0",
"{",
"socketDeadline",
"=",
"ctn",
".",
"deadline",
"\n",
"}",
"else",
"{",
"tDeadline",
":=",
"now",
".",
"Add",
"(",
"ctn",
".",
"socketTimeout",
")",
"\n",
"if",
"tDeadline",
".",
"After",
"(",
"ctn",
".",
"deadline",
")",
"{",
"socketDeadline",
"=",
"ctn",
".",
"deadline",
"\n",
"}",
"else",
"{",
"socketDeadline",
"=",
"tDeadline",
"\n",
"}",
"\n",
"}",
"\n\n",
"// floor to a millisecond to avoid too short timeouts",
"if",
"socketDeadline",
".",
"Sub",
"(",
"now",
")",
"<",
"time",
".",
"Millisecond",
"{",
"socketDeadline",
"=",
"now",
".",
"Add",
"(",
"time",
".",
"Millisecond",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"if",
"err",
":=",
"ctn",
".",
"conn",
".",
"SetDeadline",
"(",
"socketDeadline",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"ctn",
".",
"node",
"!=",
"nil",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"ctn",
".",
"node",
".",
"stats",
".",
"ConnectionsFailed",
",",
"1",
")",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
| // updateDeadline sets connection timeout for both read and write operations.
// this function is called before each read and write operation. If deadline has passed,
// the function will return a TIMEOUT error. | [
"updateDeadline",
"sets",
"connection",
"timeout",
"for",
"both",
"read",
"and",
"write",
"operations",
".",
"this",
"function",
"is",
"called",
"before",
"each",
"read",
"and",
"write",
"operation",
".",
"If",
"deadline",
"has",
"passed",
"the",
"function",
"will",
"return",
"a",
"TIMEOUT",
"error",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L220-L256 |
10,053 | aerospike/aerospike-client-go | connection.go | SetTimeout | func (ctn *Connection) SetTimeout(deadline time.Time, socketTimeout time.Duration) error {
ctn.deadline = deadline
ctn.socketTimeout = socketTimeout
return nil
} | go | func (ctn *Connection) SetTimeout(deadline time.Time, socketTimeout time.Duration) error {
ctn.deadline = deadline
ctn.socketTimeout = socketTimeout
return nil
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"SetTimeout",
"(",
"deadline",
"time",
".",
"Time",
",",
"socketTimeout",
"time",
".",
"Duration",
")",
"error",
"{",
"ctn",
".",
"deadline",
"=",
"deadline",
"\n",
"ctn",
".",
"socketTimeout",
"=",
"socketTimeout",
"\n\n",
"return",
"nil",
"\n",
"}"
]
| // SetTimeout sets connection timeout for both read and write operations. | [
"SetTimeout",
"sets",
"connection",
"timeout",
"for",
"both",
"read",
"and",
"write",
"operations",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L259-L264 |
10,054 | aerospike/aerospike-client-go | connection.go | authenticateFast | func (ctn *Connection) authenticateFast(user string, hashedPass []byte) error {
// need to authenticate
if len(user) > 0 {
command := newLoginCommand(ctn.dataBuffer)
if err := command.authenticateInternal(ctn, user, hashedPass); err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
// Socket not authenticated. Do not put back into pool.
ctn.Close()
return err
}
}
return nil
} | go | func (ctn *Connection) authenticateFast(user string, hashedPass []byte) error {
// need to authenticate
if len(user) > 0 {
command := newLoginCommand(ctn.dataBuffer)
if err := command.authenticateInternal(ctn, user, hashedPass); err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
// Socket not authenticated. Do not put back into pool.
ctn.Close()
return err
}
}
return nil
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"authenticateFast",
"(",
"user",
"string",
",",
"hashedPass",
"[",
"]",
"byte",
")",
"error",
"{",
"// need to authenticate",
"if",
"len",
"(",
"user",
")",
">",
"0",
"{",
"command",
":=",
"newLoginCommand",
"(",
"ctn",
".",
"dataBuffer",
")",
"\n",
"if",
"err",
":=",
"command",
".",
"authenticateInternal",
"(",
"ctn",
",",
"user",
",",
"hashedPass",
")",
";",
"err",
"!=",
"nil",
"{",
"if",
"ctn",
".",
"node",
"!=",
"nil",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"ctn",
".",
"node",
".",
"stats",
".",
"ConnectionsFailed",
",",
"1",
")",
"\n",
"}",
"\n",
"// Socket not authenticated. Do not put back into pool.",
"ctn",
".",
"Close",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n",
"}",
"\n",
"return",
"nil",
"\n",
"}"
]
| // authenticateFast will send authentication information to the server. | [
"authenticateFast",
"will",
"send",
"authentication",
"information",
"to",
"the",
"server",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L302-L316 |
10,055 | aerospike/aerospike-client-go | connection.go | login | func (ctn *Connection) login(sessionToken []byte) error {
// need to authenticate
if ctn.node.cluster.clientPolicy.RequiresAuthentication() {
policy := &ctn.node.cluster.clientPolicy
switch policy.AuthMode {
case AuthModeExternal:
var err error
command := newLoginCommand(ctn.dataBuffer)
if sessionToken == nil {
err = command.login(&ctn.node.cluster.clientPolicy, ctn, ctn.node.cluster.Password())
} else {
err = command.authenticateViaToken(&ctn.node.cluster.clientPolicy, ctn, sessionToken)
}
if err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
// Socket not authenticated. Do not put back into pool.
ctn.Close()
return err
}
if command.SessionToken != nil {
ctn.node._sessionToken.Store(command.SessionToken)
ctn.node._sessionExpiration.Store(command.SessionExpiration)
}
return nil
case AuthModeInternal:
return ctn.authenticateFast(policy.User, ctn.node.cluster.Password())
}
}
return nil
} | go | func (ctn *Connection) login(sessionToken []byte) error {
// need to authenticate
if ctn.node.cluster.clientPolicy.RequiresAuthentication() {
policy := &ctn.node.cluster.clientPolicy
switch policy.AuthMode {
case AuthModeExternal:
var err error
command := newLoginCommand(ctn.dataBuffer)
if sessionToken == nil {
err = command.login(&ctn.node.cluster.clientPolicy, ctn, ctn.node.cluster.Password())
} else {
err = command.authenticateViaToken(&ctn.node.cluster.clientPolicy, ctn, sessionToken)
}
if err != nil {
if ctn.node != nil {
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1)
}
// Socket not authenticated. Do not put back into pool.
ctn.Close()
return err
}
if command.SessionToken != nil {
ctn.node._sessionToken.Store(command.SessionToken)
ctn.node._sessionExpiration.Store(command.SessionExpiration)
}
return nil
case AuthModeInternal:
return ctn.authenticateFast(policy.User, ctn.node.cluster.Password())
}
}
return nil
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"login",
"(",
"sessionToken",
"[",
"]",
"byte",
")",
"error",
"{",
"// need to authenticate",
"if",
"ctn",
".",
"node",
".",
"cluster",
".",
"clientPolicy",
".",
"RequiresAuthentication",
"(",
")",
"{",
"policy",
":=",
"&",
"ctn",
".",
"node",
".",
"cluster",
".",
"clientPolicy",
"\n\n",
"switch",
"policy",
".",
"AuthMode",
"{",
"case",
"AuthModeExternal",
":",
"var",
"err",
"error",
"\n",
"command",
":=",
"newLoginCommand",
"(",
"ctn",
".",
"dataBuffer",
")",
"\n",
"if",
"sessionToken",
"==",
"nil",
"{",
"err",
"=",
"command",
".",
"login",
"(",
"&",
"ctn",
".",
"node",
".",
"cluster",
".",
"clientPolicy",
",",
"ctn",
",",
"ctn",
".",
"node",
".",
"cluster",
".",
"Password",
"(",
")",
")",
"\n",
"}",
"else",
"{",
"err",
"=",
"command",
".",
"authenticateViaToken",
"(",
"&",
"ctn",
".",
"node",
".",
"cluster",
".",
"clientPolicy",
",",
"ctn",
",",
"sessionToken",
")",
"\n",
"}",
"\n\n",
"if",
"err",
"!=",
"nil",
"{",
"if",
"ctn",
".",
"node",
"!=",
"nil",
"{",
"atomic",
".",
"AddInt64",
"(",
"&",
"ctn",
".",
"node",
".",
"stats",
".",
"ConnectionsFailed",
",",
"1",
")",
"\n",
"}",
"\n",
"// Socket not authenticated. Do not put back into pool.",
"ctn",
".",
"Close",
"(",
")",
"\n",
"return",
"err",
"\n",
"}",
"\n\n",
"if",
"command",
".",
"SessionToken",
"!=",
"nil",
"{",
"ctn",
".",
"node",
".",
"_sessionToken",
".",
"Store",
"(",
"command",
".",
"SessionToken",
")",
"\n",
"ctn",
".",
"node",
".",
"_sessionExpiration",
".",
"Store",
"(",
"command",
".",
"SessionExpiration",
")",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n\n",
"case",
"AuthModeInternal",
":",
"return",
"ctn",
".",
"authenticateFast",
"(",
"policy",
".",
"User",
",",
"ctn",
".",
"node",
".",
"cluster",
".",
"Password",
"(",
")",
")",
"\n",
"}",
"\n",
"}",
"\n\n",
"return",
"nil",
"\n",
"}"
]
| // Login will send authentication information to the server. | [
"Login",
"will",
"send",
"authentication",
"information",
"to",
"the",
"server",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L319-L356 |
10,056 | aerospike/aerospike-client-go | connection.go | isIdle | func (ctn *Connection) isIdle() bool {
return ctn.idleTimeout > 0 && !time.Now().Before(ctn.idleDeadline)
} | go | func (ctn *Connection) isIdle() bool {
return ctn.idleTimeout > 0 && !time.Now().Before(ctn.idleDeadline)
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"isIdle",
"(",
")",
"bool",
"{",
"return",
"ctn",
".",
"idleTimeout",
">",
"0",
"&&",
"!",
"time",
".",
"Now",
"(",
")",
".",
"Before",
"(",
"ctn",
".",
"idleDeadline",
")",
"\n",
"}"
]
| // isIdle returns true if the connection has reached the idle deadline. | [
"isIdle",
"returns",
"true",
"if",
"the",
"connection",
"has",
"reached",
"the",
"idle",
"deadline",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L364-L366 |
10,057 | aerospike/aerospike-client-go | connection.go | refresh | func (ctn *Connection) refresh() {
ctn.idleDeadline = time.Now().Add(ctn.idleTimeout)
} | go | func (ctn *Connection) refresh() {
ctn.idleDeadline = time.Now().Add(ctn.idleTimeout)
} | [
"func",
"(",
"ctn",
"*",
"Connection",
")",
"refresh",
"(",
")",
"{",
"ctn",
".",
"idleDeadline",
"=",
"time",
".",
"Now",
"(",
")",
".",
"Add",
"(",
"ctn",
".",
"idleTimeout",
")",
"\n",
"}"
]
| // refresh extends the idle deadline of the connection. | [
"refresh",
"extends",
"the",
"idle",
"deadline",
"of",
"the",
"connection",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/connection.go#L369-L371 |
10,058 | aerospike/aerospike-client-go | client_reflect.go | GetObject | func (clnt *Client) GetObject(policy *BasePolicy, key *Key, obj interface{}) error {
policy = clnt.getUsablePolicy(policy)
rval := reflect.ValueOf(obj)
binNames := objectMappings.getFields(rval.Type())
command := newReadCommand(clnt.cluster, policy, key, binNames)
command.object = &rval
return command.Execute()
} | go | func (clnt *Client) GetObject(policy *BasePolicy, key *Key, obj interface{}) error {
policy = clnt.getUsablePolicy(policy)
rval := reflect.ValueOf(obj)
binNames := objectMappings.getFields(rval.Type())
command := newReadCommand(clnt.cluster, policy, key, binNames)
command.object = &rval
return command.Execute()
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"GetObject",
"(",
"policy",
"*",
"BasePolicy",
",",
"key",
"*",
"Key",
",",
"obj",
"interface",
"{",
"}",
")",
"error",
"{",
"policy",
"=",
"clnt",
".",
"getUsablePolicy",
"(",
"policy",
")",
"\n\n",
"rval",
":=",
"reflect",
".",
"ValueOf",
"(",
"obj",
")",
"\n",
"binNames",
":=",
"objectMappings",
".",
"getFields",
"(",
"rval",
".",
"Type",
"(",
")",
")",
"\n\n",
"command",
":=",
"newReadCommand",
"(",
"clnt",
".",
"cluster",
",",
"policy",
",",
"key",
",",
"binNames",
")",
"\n",
"command",
".",
"object",
"=",
"&",
"rval",
"\n",
"return",
"command",
".",
"Execute",
"(",
")",
"\n",
"}"
]
| // GetObject reads a record for specified key and puts the result into the provided object.
// The policy can be used to specify timeouts.
// If the policy is nil, the default relevant policy will be used. | [
"GetObject",
"reads",
"a",
"record",
"for",
"specified",
"key",
"and",
"puts",
"the",
"result",
"into",
"the",
"provided",
"object",
".",
"The",
"policy",
"can",
"be",
"used",
"to",
"specify",
"timeouts",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L43-L52 |
10,059 | aerospike/aerospike-client-go | client_reflect.go | BatchGetObjects | func (clnt *Client) BatchGetObjects(policy *BatchPolicy, keys []*Key, objects []interface{}) (found []bool, err error) {
policy = clnt.getUsableBatchPolicy(policy)
// check the size of key and objects
if (len(keys) != len(objects)) || (len(keys) == 0) {
return nil, errors.New("Wrong Number of arguments to BatchGetObject. Number of keys and objects do not match.")
}
binSet := map[string]struct{}{}
objectsVal := make([]*reflect.Value, len(objects))
for i := range objects {
rval := reflect.ValueOf(objects[i])
objectsVal[i] = &rval
for _, bn := range objectMappings.getFields(rval.Type()) {
binSet[bn] = struct{}{}
}
}
binNames := make([]string, 0, len(binSet))
for binName := range binSet {
binNames = append(binNames, binName)
}
objectsFound := make([]bool, len(keys))
cmd := newBatchCommandGet(nil, nil, nil, policy, keys, binNames, nil, _INFO1_READ)
cmd.objects = objectsVal
cmd.objectsFound = objectsFound
if err = clnt.batchExecute(policy, keys, cmd); err != nil {
return nil, err
}
return objectsFound, nil
} | go | func (clnt *Client) BatchGetObjects(policy *BatchPolicy, keys []*Key, objects []interface{}) (found []bool, err error) {
policy = clnt.getUsableBatchPolicy(policy)
// check the size of key and objects
if (len(keys) != len(objects)) || (len(keys) == 0) {
return nil, errors.New("Wrong Number of arguments to BatchGetObject. Number of keys and objects do not match.")
}
binSet := map[string]struct{}{}
objectsVal := make([]*reflect.Value, len(objects))
for i := range objects {
rval := reflect.ValueOf(objects[i])
objectsVal[i] = &rval
for _, bn := range objectMappings.getFields(rval.Type()) {
binSet[bn] = struct{}{}
}
}
binNames := make([]string, 0, len(binSet))
for binName := range binSet {
binNames = append(binNames, binName)
}
objectsFound := make([]bool, len(keys))
cmd := newBatchCommandGet(nil, nil, nil, policy, keys, binNames, nil, _INFO1_READ)
cmd.objects = objectsVal
cmd.objectsFound = objectsFound
if err = clnt.batchExecute(policy, keys, cmd); err != nil {
return nil, err
}
return objectsFound, nil
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"BatchGetObjects",
"(",
"policy",
"*",
"BatchPolicy",
",",
"keys",
"[",
"]",
"*",
"Key",
",",
"objects",
"[",
"]",
"interface",
"{",
"}",
")",
"(",
"found",
"[",
"]",
"bool",
",",
"err",
"error",
")",
"{",
"policy",
"=",
"clnt",
".",
"getUsableBatchPolicy",
"(",
"policy",
")",
"\n\n",
"// check the size of key and objects",
"if",
"(",
"len",
"(",
"keys",
")",
"!=",
"len",
"(",
"objects",
")",
")",
"||",
"(",
"len",
"(",
"keys",
")",
"==",
"0",
")",
"{",
"return",
"nil",
",",
"errors",
".",
"New",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"binSet",
":=",
"map",
"[",
"string",
"]",
"struct",
"{",
"}",
"{",
"}",
"\n",
"objectsVal",
":=",
"make",
"(",
"[",
"]",
"*",
"reflect",
".",
"Value",
",",
"len",
"(",
"objects",
")",
")",
"\n",
"for",
"i",
":=",
"range",
"objects",
"{",
"rval",
":=",
"reflect",
".",
"ValueOf",
"(",
"objects",
"[",
"i",
"]",
")",
"\n",
"objectsVal",
"[",
"i",
"]",
"=",
"&",
"rval",
"\n",
"for",
"_",
",",
"bn",
":=",
"range",
"objectMappings",
".",
"getFields",
"(",
"rval",
".",
"Type",
"(",
")",
")",
"{",
"binSet",
"[",
"bn",
"]",
"=",
"struct",
"{",
"}",
"{",
"}",
"\n",
"}",
"\n",
"}",
"\n",
"binNames",
":=",
"make",
"(",
"[",
"]",
"string",
",",
"0",
",",
"len",
"(",
"binSet",
")",
")",
"\n",
"for",
"binName",
":=",
"range",
"binSet",
"{",
"binNames",
"=",
"append",
"(",
"binNames",
",",
"binName",
")",
"\n",
"}",
"\n\n",
"objectsFound",
":=",
"make",
"(",
"[",
"]",
"bool",
",",
"len",
"(",
"keys",
")",
")",
"\n",
"cmd",
":=",
"newBatchCommandGet",
"(",
"nil",
",",
"nil",
",",
"nil",
",",
"policy",
",",
"keys",
",",
"binNames",
",",
"nil",
",",
"_INFO1_READ",
")",
"\n",
"cmd",
".",
"objects",
"=",
"objectsVal",
"\n",
"cmd",
".",
"objectsFound",
"=",
"objectsFound",
"\n\n",
"if",
"err",
"=",
"clnt",
".",
"batchExecute",
"(",
"policy",
",",
"keys",
",",
"cmd",
")",
";",
"err",
"!=",
"nil",
"{",
"return",
"nil",
",",
"err",
"\n",
"}",
"\n\n",
"return",
"objectsFound",
",",
"nil",
"\n",
"}"
]
| // BatchGetObject reads multiple record headers and bins for specified keys in one batch request.
// The returned objects are in positional order with the original key array order.
// If a key is not found, the positional object will not change, and the positional found boolean will be false.
// The policy can be used to specify timeouts.
// If the policy is nil, the default relevant policy will be used. | [
"BatchGetObject",
"reads",
"multiple",
"record",
"headers",
"and",
"bins",
"for",
"specified",
"keys",
"in",
"one",
"batch",
"request",
".",
"The",
"returned",
"objects",
"are",
"in",
"positional",
"order",
"with",
"the",
"original",
"key",
"array",
"order",
".",
"If",
"a",
"key",
"is",
"not",
"found",
"the",
"positional",
"object",
"will",
"not",
"change",
"and",
"the",
"positional",
"found",
"boolean",
"will",
"be",
"false",
".",
"The",
"policy",
"can",
"be",
"used",
"to",
"specify",
"timeouts",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L59-L91 |
10,060 | aerospike/aerospike-client-go | client_reflect.go | ScanAllObjects | func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error) {
policy := *clnt.getUsableScanPolicy(apolicy)
nodes := clnt.cluster.GetNodes()
if len(nodes) == 0 {
return nil, NewAerospikeError(SERVER_NOT_AVAILABLE, "Scan failed because cluster is empty.")
}
// result recordset
taskID := uint64(xornd.Int64())
res := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), len(nodes), taskID),
}
// the whole call should be wrapped in a goroutine
if policy.ConcurrentNodes {
for _, node := range nodes {
go func(node *Node) {
// Errors are handled inside the command itself
clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
}(node)
}
} else {
// scan nodes one by one
go func() {
for _, node := range nodes {
// Errors are handled inside the command itself
clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
}
}()
}
return res, nil
} | go | func (clnt *Client) ScanAllObjects(apolicy *ScanPolicy, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error) {
policy := *clnt.getUsableScanPolicy(apolicy)
nodes := clnt.cluster.GetNodes()
if len(nodes) == 0 {
return nil, NewAerospikeError(SERVER_NOT_AVAILABLE, "Scan failed because cluster is empty.")
}
// result recordset
taskID := uint64(xornd.Int64())
res := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), len(nodes), taskID),
}
// the whole call should be wrapped in a goroutine
if policy.ConcurrentNodes {
for _, node := range nodes {
go func(node *Node) {
// Errors are handled inside the command itself
clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
}(node)
}
} else {
// scan nodes one by one
go func() {
for _, node := range nodes {
// Errors are handled inside the command itself
clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
}
}()
}
return res, nil
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"ScanAllObjects",
"(",
"apolicy",
"*",
"ScanPolicy",
",",
"objChan",
"interface",
"{",
"}",
",",
"namespace",
"string",
",",
"setName",
"string",
",",
"binNames",
"...",
"string",
")",
"(",
"*",
"Recordset",
",",
"error",
")",
"{",
"policy",
":=",
"*",
"clnt",
".",
"getUsableScanPolicy",
"(",
"apolicy",
")",
"\n\n",
"nodes",
":=",
"clnt",
".",
"cluster",
".",
"GetNodes",
"(",
")",
"\n",
"if",
"len",
"(",
"nodes",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"NewAerospikeError",
"(",
"SERVER_NOT_AVAILABLE",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// result recordset",
"taskID",
":=",
"uint64",
"(",
"xornd",
".",
"Int64",
"(",
")",
")",
"\n",
"res",
":=",
"&",
"Recordset",
"{",
"objectset",
":",
"*",
"newObjectset",
"(",
"reflect",
".",
"ValueOf",
"(",
"objChan",
")",
",",
"len",
"(",
"nodes",
")",
",",
"taskID",
")",
",",
"}",
"\n\n",
"// the whole call should be wrapped in a goroutine",
"if",
"policy",
".",
"ConcurrentNodes",
"{",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"go",
"func",
"(",
"node",
"*",
"Node",
")",
"{",
"// Errors are handled inside the command itself",
"clnt",
".",
"scanNodeObjects",
"(",
"&",
"policy",
",",
"node",
",",
"res",
",",
"namespace",
",",
"setName",
",",
"taskID",
",",
"binNames",
"...",
")",
"\n",
"}",
"(",
"node",
")",
"\n",
"}",
"\n",
"}",
"else",
"{",
"// scan nodes one by one",
"go",
"func",
"(",
")",
"{",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"// Errors are handled inside the command itself",
"clnt",
".",
"scanNodeObjects",
"(",
"&",
"policy",
",",
"node",
",",
"res",
",",
"namespace",
",",
"setName",
",",
"taskID",
",",
"binNames",
"...",
")",
"\n",
"}",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"res",
",",
"nil",
"\n",
"}"
]
| // ScanAllObjects reads all records in specified namespace and set from all nodes.
// If the policy's concurrentNodes is specified, each server node will be read in
// parallel. Otherwise, server nodes are read sequentially.
// If the policy is nil, the default relevant policy will be used. | [
"ScanAllObjects",
"reads",
"all",
"records",
"in",
"specified",
"namespace",
"and",
"set",
"from",
"all",
"nodes",
".",
"If",
"the",
"policy",
"s",
"concurrentNodes",
"is",
"specified",
"each",
"server",
"node",
"will",
"be",
"read",
"in",
"parallel",
".",
"Otherwise",
"server",
"nodes",
"are",
"read",
"sequentially",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L97-L130 |
10,061 | aerospike/aerospike-client-go | client_reflect.go | ScanNodeObjects | func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error) {
policy := *clnt.getUsableScanPolicy(apolicy)
// results channel must be async for performance
taskID := uint64(xornd.Int64())
res := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), 1, taskID),
}
go clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
return res, nil
} | go | func (clnt *Client) ScanNodeObjects(apolicy *ScanPolicy, node *Node, objChan interface{}, namespace string, setName string, binNames ...string) (*Recordset, error) {
policy := *clnt.getUsableScanPolicy(apolicy)
// results channel must be async for performance
taskID := uint64(xornd.Int64())
res := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), 1, taskID),
}
go clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...)
return res, nil
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"ScanNodeObjects",
"(",
"apolicy",
"*",
"ScanPolicy",
",",
"node",
"*",
"Node",
",",
"objChan",
"interface",
"{",
"}",
",",
"namespace",
"string",
",",
"setName",
"string",
",",
"binNames",
"...",
"string",
")",
"(",
"*",
"Recordset",
",",
"error",
")",
"{",
"policy",
":=",
"*",
"clnt",
".",
"getUsableScanPolicy",
"(",
"apolicy",
")",
"\n\n",
"// results channel must be async for performance",
"taskID",
":=",
"uint64",
"(",
"xornd",
".",
"Int64",
"(",
")",
")",
"\n",
"res",
":=",
"&",
"Recordset",
"{",
"objectset",
":",
"*",
"newObjectset",
"(",
"reflect",
".",
"ValueOf",
"(",
"objChan",
")",
",",
"1",
",",
"taskID",
")",
",",
"}",
"\n\n",
"go",
"clnt",
".",
"scanNodeObjects",
"(",
"&",
"policy",
",",
"node",
",",
"res",
",",
"namespace",
",",
"setName",
",",
"taskID",
",",
"binNames",
"...",
")",
"\n",
"return",
"res",
",",
"nil",
"\n",
"}"
]
| // scanNodeObjects reads all records in specified namespace and set for one node only,
// and marshalls the results into the objects of the provided channel in Recordset.
// If the policy is nil, the default relevant policy will be used.
// The resulting records will be marshalled into the objChan.
// objChan will be closed after all the records are read. | [
"scanNodeObjects",
"reads",
"all",
"records",
"in",
"specified",
"namespace",
"and",
"set",
"for",
"one",
"node",
"only",
"and",
"marshalls",
"the",
"results",
"into",
"the",
"objects",
"of",
"the",
"provided",
"channel",
"in",
"Recordset",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
".",
"The",
"resulting",
"records",
"will",
"be",
"marshalled",
"into",
"the",
"objChan",
".",
"objChan",
"will",
"be",
"closed",
"after",
"all",
"the",
"records",
"are",
"read",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L137-L148 |
10,062 | aerospike/aerospike-client-go | client_reflect.go | scanNodeObjects | func (clnt *Client) scanNodeObjects(policy *ScanPolicy, node *Node, recordset *Recordset, namespace string, setName string, taskID uint64, binNames ...string) error {
command := newScanObjectsCommand(node, policy, namespace, setName, binNames, recordset, taskID)
return command.Execute()
} | go | func (clnt *Client) scanNodeObjects(policy *ScanPolicy, node *Node, recordset *Recordset, namespace string, setName string, taskID uint64, binNames ...string) error {
command := newScanObjectsCommand(node, policy, namespace, setName, binNames, recordset, taskID)
return command.Execute()
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"scanNodeObjects",
"(",
"policy",
"*",
"ScanPolicy",
",",
"node",
"*",
"Node",
",",
"recordset",
"*",
"Recordset",
",",
"namespace",
"string",
",",
"setName",
"string",
",",
"taskID",
"uint64",
",",
"binNames",
"...",
"string",
")",
"error",
"{",
"command",
":=",
"newScanObjectsCommand",
"(",
"node",
",",
"policy",
",",
"namespace",
",",
"setName",
",",
"binNames",
",",
"recordset",
",",
"taskID",
")",
"\n",
"return",
"command",
".",
"Execute",
"(",
")",
"\n",
"}"
]
| // scanNodeObjects reads all records in specified namespace and set for one node only,
// and marshalls the results into the objects of the provided channel in Recordset.
// If the policy is nil, the default relevant policy will be used. | [
"scanNodeObjects",
"reads",
"all",
"records",
"in",
"specified",
"namespace",
"and",
"set",
"for",
"one",
"node",
"only",
"and",
"marshalls",
"the",
"results",
"into",
"the",
"objects",
"of",
"the",
"provided",
"channel",
"in",
"Recordset",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L153-L156 |
10,063 | aerospike/aerospike-client-go | client_reflect.go | QueryObjects | func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan interface{}) (*Recordset, error) {
policy = clnt.getUsableQueryPolicy(policy)
nodes := clnt.cluster.GetNodes()
if len(nodes) == 0 {
return nil, NewAerospikeError(SERVER_NOT_AVAILABLE, "Query failed because cluster is empty.")
}
// results channel must be async for performance
recSet := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), len(nodes), statement.TaskId),
}
// the whole call sho
// results channel must be async for performance
for _, node := range nodes {
// copy policies to avoid race conditions
newPolicy := *policy
command := newQueryObjectsCommand(node, &newPolicy, statement, recSet)
go func() {
// Do not send the error to the channel; it is already handled in the Execute method
command.Execute()
}()
}
return recSet, nil
} | go | func (clnt *Client) QueryObjects(policy *QueryPolicy, statement *Statement, objChan interface{}) (*Recordset, error) {
policy = clnt.getUsableQueryPolicy(policy)
nodes := clnt.cluster.GetNodes()
if len(nodes) == 0 {
return nil, NewAerospikeError(SERVER_NOT_AVAILABLE, "Query failed because cluster is empty.")
}
// results channel must be async for performance
recSet := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), len(nodes), statement.TaskId),
}
// the whole call sho
// results channel must be async for performance
for _, node := range nodes {
// copy policies to avoid race conditions
newPolicy := *policy
command := newQueryObjectsCommand(node, &newPolicy, statement, recSet)
go func() {
// Do not send the error to the channel; it is already handled in the Execute method
command.Execute()
}()
}
return recSet, nil
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"QueryObjects",
"(",
"policy",
"*",
"QueryPolicy",
",",
"statement",
"*",
"Statement",
",",
"objChan",
"interface",
"{",
"}",
")",
"(",
"*",
"Recordset",
",",
"error",
")",
"{",
"policy",
"=",
"clnt",
".",
"getUsableQueryPolicy",
"(",
"policy",
")",
"\n\n",
"nodes",
":=",
"clnt",
".",
"cluster",
".",
"GetNodes",
"(",
")",
"\n",
"if",
"len",
"(",
"nodes",
")",
"==",
"0",
"{",
"return",
"nil",
",",
"NewAerospikeError",
"(",
"SERVER_NOT_AVAILABLE",
",",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"// results channel must be async for performance",
"recSet",
":=",
"&",
"Recordset",
"{",
"objectset",
":",
"*",
"newObjectset",
"(",
"reflect",
".",
"ValueOf",
"(",
"objChan",
")",
",",
"len",
"(",
"nodes",
")",
",",
"statement",
".",
"TaskId",
")",
",",
"}",
"\n\n",
"// the whole call sho",
"// results channel must be async for performance",
"for",
"_",
",",
"node",
":=",
"range",
"nodes",
"{",
"// copy policies to avoid race conditions",
"newPolicy",
":=",
"*",
"policy",
"\n",
"command",
":=",
"newQueryObjectsCommand",
"(",
"node",
",",
"&",
"newPolicy",
",",
"statement",
",",
"recSet",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"// Do not send the error to the channel; it is already handled in the Execute method",
"command",
".",
"Execute",
"(",
")",
"\n",
"}",
"(",
")",
"\n",
"}",
"\n\n",
"return",
"recSet",
",",
"nil",
"\n",
"}"
]
| // QueryNodeObjects executes a query on all nodes in the cluster and marshals the records into the given channel.
// The query executor puts records on the channel from separate goroutines.
// The caller can concurrently pop objects.
//
// This method is only supported by Aerospike 3 servers.
// If the policy is nil, the default relevant policy will be used. | [
"QueryNodeObjects",
"executes",
"a",
"query",
"on",
"all",
"nodes",
"in",
"the",
"cluster",
"and",
"marshals",
"the",
"records",
"into",
"the",
"given",
"channel",
".",
"The",
"query",
"executor",
"puts",
"records",
"on",
"the",
"channel",
"from",
"separate",
"goroutines",
".",
"The",
"caller",
"can",
"concurrently",
"pop",
"objects",
".",
"This",
"method",
"is",
"only",
"supported",
"by",
"Aerospike",
"3",
"servers",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L164-L190 |
10,064 | aerospike/aerospike-client-go | client_reflect.go | QueryNodeObjects | func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan interface{}) (*Recordset, error) {
policy = clnt.getUsableQueryPolicy(policy)
// results channel must be async for performance
recSet := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), 1, statement.TaskId),
}
// copy policies to avoid race conditions
newPolicy := *policy
command := newQueryRecordCommand(node, &newPolicy, statement, recSet)
go func() {
command.Execute()
}()
return recSet, nil
} | go | func (clnt *Client) QueryNodeObjects(policy *QueryPolicy, node *Node, statement *Statement, objChan interface{}) (*Recordset, error) {
policy = clnt.getUsableQueryPolicy(policy)
// results channel must be async for performance
recSet := &Recordset{
objectset: *newObjectset(reflect.ValueOf(objChan), 1, statement.TaskId),
}
// copy policies to avoid race conditions
newPolicy := *policy
command := newQueryRecordCommand(node, &newPolicy, statement, recSet)
go func() {
command.Execute()
}()
return recSet, nil
} | [
"func",
"(",
"clnt",
"*",
"Client",
")",
"QueryNodeObjects",
"(",
"policy",
"*",
"QueryPolicy",
",",
"node",
"*",
"Node",
",",
"statement",
"*",
"Statement",
",",
"objChan",
"interface",
"{",
"}",
")",
"(",
"*",
"Recordset",
",",
"error",
")",
"{",
"policy",
"=",
"clnt",
".",
"getUsableQueryPolicy",
"(",
"policy",
")",
"\n\n",
"// results channel must be async for performance",
"recSet",
":=",
"&",
"Recordset",
"{",
"objectset",
":",
"*",
"newObjectset",
"(",
"reflect",
".",
"ValueOf",
"(",
"objChan",
")",
",",
"1",
",",
"statement",
".",
"TaskId",
")",
",",
"}",
"\n\n",
"// copy policies to avoid race conditions",
"newPolicy",
":=",
"*",
"policy",
"\n",
"command",
":=",
"newQueryRecordCommand",
"(",
"node",
",",
"&",
"newPolicy",
",",
"statement",
",",
"recSet",
")",
"\n",
"go",
"func",
"(",
")",
"{",
"command",
".",
"Execute",
"(",
")",
"\n",
"}",
"(",
")",
"\n\n",
"return",
"recSet",
",",
"nil",
"\n",
"}"
]
| // QueryNodeObjects executes a query on a specific node and marshals the records into the given channel.
// The caller can concurrently pop records off the channel.
//
// This method is only supported by Aerospike 3 servers.
// If the policy is nil, the default relevant policy will be used. | [
"QueryNodeObjects",
"executes",
"a",
"query",
"on",
"a",
"specific",
"node",
"and",
"marshals",
"the",
"records",
"into",
"the",
"given",
"channel",
".",
"The",
"caller",
"can",
"concurrently",
"pop",
"records",
"off",
"the",
"channel",
".",
"This",
"method",
"is",
"only",
"supported",
"by",
"Aerospike",
"3",
"servers",
".",
"If",
"the",
"policy",
"is",
"nil",
"the",
"default",
"relevant",
"policy",
"will",
"be",
"used",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/client_reflect.go#L197-L213 |
10,065 | aerospike/aerospike-client-go | cdt_map.go | NewMapPolicy | func NewMapPolicy(order mapOrderType, writeMode *mapWriteMode) *MapPolicy {
return &MapPolicy{
attributes: order,
flags: MapWriteFlagsDefault,
itemCommand: writeMode.itemCommand,
itemsCommand: writeMode.itemsCommand,
}
} | go | func NewMapPolicy(order mapOrderType, writeMode *mapWriteMode) *MapPolicy {
return &MapPolicy{
attributes: order,
flags: MapWriteFlagsDefault,
itemCommand: writeMode.itemCommand,
itemsCommand: writeMode.itemsCommand,
}
} | [
"func",
"NewMapPolicy",
"(",
"order",
"mapOrderType",
",",
"writeMode",
"*",
"mapWriteMode",
")",
"*",
"MapPolicy",
"{",
"return",
"&",
"MapPolicy",
"{",
"attributes",
":",
"order",
",",
"flags",
":",
"MapWriteFlagsDefault",
",",
"itemCommand",
":",
"writeMode",
".",
"itemCommand",
",",
"itemsCommand",
":",
"writeMode",
".",
"itemsCommand",
",",
"}",
"\n",
"}"
]
| // NewMapPolicy creates a MapPolicy with WriteMode. Use with servers before v4.3 | [
"NewMapPolicy",
"creates",
"a",
"MapPolicy",
"with",
"WriteMode",
".",
"Use",
"with",
"servers",
"before",
"v4",
".",
"3"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L186-L193 |
10,066 | aerospike/aerospike-client-go | cdt_map.go | NewMapPolicyWithFlags | func NewMapPolicyWithFlags(order mapOrderType, flags int) *MapPolicy {
return &MapPolicy{
attributes: order,
flags: flags,
itemCommand: MapWriteMode.UPDATE.itemCommand,
itemsCommand: MapWriteMode.UPDATE.itemsCommand,
}
} | go | func NewMapPolicyWithFlags(order mapOrderType, flags int) *MapPolicy {
return &MapPolicy{
attributes: order,
flags: flags,
itemCommand: MapWriteMode.UPDATE.itemCommand,
itemsCommand: MapWriteMode.UPDATE.itemsCommand,
}
} | [
"func",
"NewMapPolicyWithFlags",
"(",
"order",
"mapOrderType",
",",
"flags",
"int",
")",
"*",
"MapPolicy",
"{",
"return",
"&",
"MapPolicy",
"{",
"attributes",
":",
"order",
",",
"flags",
":",
"flags",
",",
"itemCommand",
":",
"MapWriteMode",
".",
"UPDATE",
".",
"itemCommand",
",",
"itemsCommand",
":",
"MapWriteMode",
".",
"UPDATE",
".",
"itemsCommand",
",",
"}",
"\n",
"}"
]
| // NewMapPolicyWithFlags creates a MapPolicy with WriteFlags. Use with servers v4.3+ | [
"NewMapPolicyWithFlags",
"creates",
"a",
"MapPolicy",
"with",
"WriteFlags",
".",
"Use",
"with",
"servers",
"v4",
".",
"3",
"+"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L196-L203 |
10,067 | aerospike/aerospike-client-go | cdt_map.go | MapPutItemsOp | func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}) *Operation {
if policy.flags != 0 {
ops := _CDT_MAP_PUT_ITEMS
// Replace doesn't allow map attributes because it does not create on non-existing key.
return &Operation{
opType: _MAP_MODIFY,
opSubType: &ops,
binName: binName,
binValue: ListValue([]interface{}{amap, IntegerValue(policy.attributes), IntegerValue(policy.flags)}),
encoder: newCDTCreateOperationEncoder,
}
}
if policy.itemsCommand == int(_CDT_MAP_REPLACE_ITEMS) {
// Replace doesn't allow map attributes because it does not create on non-existing key.
return &Operation{
opType: _MAP_MODIFY,
opSubType: &policy.itemsCommand,
binName: binName,
binValue: ListValue([]interface{}{MapValue(amap)}),
encoder: newCDTCreateOperationEncoder,
}
}
return &Operation{
opType: _MAP_MODIFY,
opSubType: &policy.itemsCommand,
binName: binName,
binValue: ListValue([]interface{}{MapValue(amap), IntegerValue(policy.attributes)}),
encoder: newCDTCreateOperationEncoder,
}
} | go | func MapPutItemsOp(policy *MapPolicy, binName string, amap map[interface{}]interface{}) *Operation {
if policy.flags != 0 {
ops := _CDT_MAP_PUT_ITEMS
// Replace doesn't allow map attributes because it does not create on non-existing key.
return &Operation{
opType: _MAP_MODIFY,
opSubType: &ops,
binName: binName,
binValue: ListValue([]interface{}{amap, IntegerValue(policy.attributes), IntegerValue(policy.flags)}),
encoder: newCDTCreateOperationEncoder,
}
}
if policy.itemsCommand == int(_CDT_MAP_REPLACE_ITEMS) {
// Replace doesn't allow map attributes because it does not create on non-existing key.
return &Operation{
opType: _MAP_MODIFY,
opSubType: &policy.itemsCommand,
binName: binName,
binValue: ListValue([]interface{}{MapValue(amap)}),
encoder: newCDTCreateOperationEncoder,
}
}
return &Operation{
opType: _MAP_MODIFY,
opSubType: &policy.itemsCommand,
binName: binName,
binValue: ListValue([]interface{}{MapValue(amap), IntegerValue(policy.attributes)}),
encoder: newCDTCreateOperationEncoder,
}
} | [
"func",
"MapPutItemsOp",
"(",
"policy",
"*",
"MapPolicy",
",",
"binName",
"string",
",",
"amap",
"map",
"[",
"interface",
"{",
"}",
"]",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"if",
"policy",
".",
"flags",
"!=",
"0",
"{",
"ops",
":=",
"_CDT_MAP_PUT_ITEMS",
"\n\n",
"// Replace doesn't allow map attributes because it does not create on non-existing key.",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_MAP_MODIFY",
",",
"opSubType",
":",
"&",
"ops",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"amap",
",",
"IntegerValue",
"(",
"policy",
".",
"attributes",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"flags",
")",
"}",
")",
",",
"encoder",
":",
"newCDTCreateOperationEncoder",
",",
"}",
"\n",
"}",
"\n\n",
"if",
"policy",
".",
"itemsCommand",
"==",
"int",
"(",
"_CDT_MAP_REPLACE_ITEMS",
")",
"{",
"// Replace doesn't allow map attributes because it does not create on non-existing key.",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_MAP_MODIFY",
",",
"opSubType",
":",
"&",
"policy",
".",
"itemsCommand",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"MapValue",
"(",
"amap",
")",
"}",
")",
",",
"encoder",
":",
"newCDTCreateOperationEncoder",
",",
"}",
"\n",
"}",
"\n\n",
"return",
"&",
"Operation",
"{",
"opType",
":",
"_MAP_MODIFY",
",",
"opSubType",
":",
"&",
"policy",
".",
"itemsCommand",
",",
"binName",
":",
"binName",
",",
"binValue",
":",
"ListValue",
"(",
"[",
"]",
"interface",
"{",
"}",
"{",
"MapValue",
"(",
"amap",
")",
",",
"IntegerValue",
"(",
"policy",
".",
"attributes",
")",
"}",
")",
",",
"encoder",
":",
"newCDTCreateOperationEncoder",
",",
"}",
"\n",
"}"
]
| // MapPutItemsOp creates map put items operation
// Server writes each map item to map bin and returns map size.
//
// The required map policy dictates the type of map to create when it does not exist.
// The map policy also specifies the mode used when writing items to the map. | [
"MapPutItemsOp",
"creates",
"map",
"put",
"items",
"operation",
"Server",
"writes",
"each",
"map",
"item",
"to",
"map",
"bin",
"and",
"returns",
"map",
"size",
".",
"The",
"required",
"map",
"policy",
"dictates",
"the",
"type",
"of",
"map",
"to",
"create",
"when",
"it",
"does",
"not",
"exist",
".",
"The",
"map",
"policy",
"also",
"specifies",
"the",
"mode",
"used",
"when",
"writing",
"items",
"to",
"the",
"map",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L307-L339 |
10,068 | aerospike/aerospike-client-go | cdt_map.go | MapIncrementOp | func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}) *Operation {
return newCDTCreateOperationValues2(_CDT_MAP_INCREMENT, policy.attributes, binName, key, incr)
} | go | func MapIncrementOp(policy *MapPolicy, binName string, key interface{}, incr interface{}) *Operation {
return newCDTCreateOperationValues2(_CDT_MAP_INCREMENT, policy.attributes, binName, key, incr)
} | [
"func",
"MapIncrementOp",
"(",
"policy",
"*",
"MapPolicy",
",",
"binName",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"incr",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValues2",
"(",
"_CDT_MAP_INCREMENT",
",",
"policy",
".",
"attributes",
",",
"binName",
",",
"key",
",",
"incr",
")",
"\n",
"}"
]
| // MapIncrementOp creates map increment operation.
// Server increments values by incr for all items identified by key and returns final result.
// Valid only for numbers.
//
// The required map policy dictates the type of map to create when it does not exist.
// The map policy also specifies the mode used when writing items to the map. | [
"MapIncrementOp",
"creates",
"map",
"increment",
"operation",
".",
"Server",
"increments",
"values",
"by",
"incr",
"for",
"all",
"items",
"identified",
"by",
"key",
"and",
"returns",
"final",
"result",
".",
"Valid",
"only",
"for",
"numbers",
".",
"The",
"required",
"map",
"policy",
"dictates",
"the",
"type",
"of",
"map",
"to",
"create",
"when",
"it",
"does",
"not",
"exist",
".",
"The",
"map",
"policy",
"also",
"specifies",
"the",
"mode",
"used",
"when",
"writing",
"items",
"to",
"the",
"map",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L347-L349 |
10,069 | aerospike/aerospike-client-go | cdt_map.go | MapDecrementOp | func MapDecrementOp(policy *MapPolicy, binName string, key interface{}, decr interface{}) *Operation {
return newCDTCreateOperationValues2(_CDT_MAP_DECREMENT, policy.attributes, binName, key, decr)
} | go | func MapDecrementOp(policy *MapPolicy, binName string, key interface{}, decr interface{}) *Operation {
return newCDTCreateOperationValues2(_CDT_MAP_DECREMENT, policy.attributes, binName, key, decr)
} | [
"func",
"MapDecrementOp",
"(",
"policy",
"*",
"MapPolicy",
",",
"binName",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"decr",
"interface",
"{",
"}",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValues2",
"(",
"_CDT_MAP_DECREMENT",
",",
"policy",
".",
"attributes",
",",
"binName",
",",
"key",
",",
"decr",
")",
"\n",
"}"
]
| // MapDecrementOp creates map decrement operation.
// Server decrements values by decr for all items identified by key and returns final result.
// Valid only for numbers.
//
// The required map policy dictates the type of map to create when it does not exist.
// The map policy also specifies the mode used when writing items to the map. | [
"MapDecrementOp",
"creates",
"map",
"decrement",
"operation",
".",
"Server",
"decrements",
"values",
"by",
"decr",
"for",
"all",
"items",
"identified",
"by",
"key",
"and",
"returns",
"final",
"result",
".",
"Valid",
"only",
"for",
"numbers",
".",
"The",
"required",
"map",
"policy",
"dictates",
"the",
"type",
"of",
"map",
"to",
"create",
"when",
"it",
"does",
"not",
"exist",
".",
"The",
"map",
"policy",
"also",
"specifies",
"the",
"mode",
"used",
"when",
"writing",
"items",
"to",
"the",
"map",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L357-L359 |
10,070 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByKeyOp | func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_KEY, _MAP_MODIFY, binName, key, returnType)
} | go | func MapRemoveByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_KEY, _MAP_MODIFY, binName, key, returnType)
} | [
"func",
"MapRemoveByKeyOp",
"(",
"binName",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_BY_KEY",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"key",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByKeyOp creates map remove operation.
// Server removes map item identified by key and returns removed data specified by returnType. | [
"MapRemoveByKeyOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"item",
"identified",
"by",
"key",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L369-L371 |
10,071 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByKeyListOp | func MapRemoveByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_KEY_LIST, _MAP_MODIFY, binName, keys, returnType)
} | go | func MapRemoveByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_KEY_LIST, _MAP_MODIFY, binName, keys, returnType)
} | [
"func",
"MapRemoveByKeyListOp",
"(",
"binName",
"string",
",",
"keys",
"[",
"]",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_KEY_LIST",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"keys",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByKeyListOp creates map remove operation.
// Server removes map items identified by keys and returns removed data specified by returnType. | [
"MapRemoveByKeyListOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"items",
"identified",
"by",
"keys",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L375-L377 |
10,072 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByValueOp | func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_VALUE, _MAP_MODIFY, binName, value, returnType)
} | go | func MapRemoveByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_VALUE, _MAP_MODIFY, binName, value, returnType)
} | [
"func",
"MapRemoveByValueOp",
"(",
"binName",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_BY_VALUE",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"value",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByValueOp creates map remove operation.
// Server removes map items identified by value and returns removed data specified by returnType. | [
"MapRemoveByValueOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"items",
"identified",
"by",
"value",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L391-L393 |
10,073 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByValueListOp | func MapRemoveByValueListOp(binName string, values []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValuesN(_CDT_MAP_REMOVE_VALUE_LIST, _MAP_MODIFY, binName, values, returnType)
} | go | func MapRemoveByValueListOp(binName string, values []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValuesN(_CDT_MAP_REMOVE_VALUE_LIST, _MAP_MODIFY, binName, values, returnType)
} | [
"func",
"MapRemoveByValueListOp",
"(",
"binName",
"string",
",",
"values",
"[",
"]",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValuesN",
"(",
"_CDT_MAP_REMOVE_VALUE_LIST",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"values",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByValueListOp creates map remove operation.
// Server removes map items identified by values and returns removed data specified by returnType. | [
"MapRemoveByValueListOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"items",
"identified",
"by",
"values",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L397-L399 |
10,074 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByIndexOp | func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX, _MAP_MODIFY, binName, index, returnType)
} | go | func MapRemoveByIndexOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX, _MAP_MODIFY, binName, index, returnType)
} | [
"func",
"MapRemoveByIndexOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_BY_INDEX",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"index",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByIndexOp creates map remove operation.
// Server removes map item identified by index and returns removed data specified by returnType. | [
"MapRemoveByIndexOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"item",
"identified",
"by",
"index",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L439-L441 |
10,075 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByIndexRangeOp | func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, returnType)
} | go | func MapRemoveByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, returnType)
} | [
"func",
"MapRemoveByIndexRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_BY_INDEX_RANGE",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"index",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByIndexRangeOp creates map remove operation.
// Server removes map items starting at specified index to the end of map and returns removed
// data specified by returnType. | [
"MapRemoveByIndexRangeOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"map",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L446-L448 |
10,076 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByIndexRangeCountOp | func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, count, returnType)
} | go | func MapRemoveByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, count, returnType)
} | [
"func",
"MapRemoveByIndexRangeCountOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationIndexCount",
"(",
"_CDT_MAP_REMOVE_BY_INDEX_RANGE",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"index",
",",
"count",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByIndexRangeCountOp creates map remove operation.
// Server removes "count" map items starting at specified index and returns removed data specified by returnType. | [
"MapRemoveByIndexRangeCountOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"count",
"map",
"items",
"starting",
"at",
"specified",
"index",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L452-L454 |
10,077 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByRankOp | func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_RANK, _MAP_MODIFY, binName, rank, returnType)
} | go | func MapRemoveByRankOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_RANK, _MAP_MODIFY, binName, rank, returnType)
} | [
"func",
"MapRemoveByRankOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_REMOVE_BY_RANK",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"rank",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByRankOp creates map remove operation.
// Server removes map item identified by rank and returns removed data specified by returnType. | [
"MapRemoveByRankOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"item",
"identified",
"by",
"rank",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L458-L460 |
10,078 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByRankRangeOp | func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndex(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, returnType)
} | go | func MapRemoveByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndex(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, returnType)
} | [
"func",
"MapRemoveByRankRangeOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationIndex",
"(",
"_CDT_MAP_REMOVE_BY_RANK_RANGE",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"rank",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByRankRangeOp creates map remove operation.
// Server removes map items starting at specified rank to the last ranked item and returns removed
// data specified by returnType. | [
"MapRemoveByRankRangeOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"map",
"items",
"starting",
"at",
"specified",
"rank",
"to",
"the",
"last",
"ranked",
"item",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L465-L467 |
10,079 | aerospike/aerospike-client-go | cdt_map.go | MapRemoveByRankRangeCountOp | func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, count, returnType)
} | go | func MapRemoveByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, count, returnType)
} | [
"func",
"MapRemoveByRankRangeCountOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"count",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationIndexCount",
"(",
"_CDT_MAP_REMOVE_BY_RANK_RANGE",
",",
"_MAP_MODIFY",
",",
"binName",
",",
"rank",
",",
"count",
",",
"returnType",
")",
"\n",
"}"
]
| // MapRemoveByRankRangeCountOp creates map remove operation.
// Server removes "count" map items starting at specified rank and returns removed data specified by returnType. | [
"MapRemoveByRankRangeCountOp",
"creates",
"map",
"remove",
"operation",
".",
"Server",
"removes",
"count",
"map",
"items",
"starting",
"at",
"specified",
"rank",
"and",
"returns",
"removed",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L471-L473 |
10,080 | aerospike/aerospike-client-go | cdt_map.go | MapGetByKeyOp | func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY, _MAP_READ, binName, key, returnType)
} | go | func MapGetByKeyOp(binName string, key interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY, _MAP_READ, binName, key, returnType)
} | [
"func",
"MapGetByKeyOp",
"(",
"binName",
"string",
",",
"key",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_KEY",
",",
"_MAP_READ",
",",
"binName",
",",
"key",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByKeyOp creates map get by key operation.
// Server selects map item identified by key and returns selected data specified by returnType. | [
"MapGetByKeyOp",
"creates",
"map",
"get",
"by",
"key",
"operation",
".",
"Server",
"selects",
"map",
"item",
"identified",
"by",
"key",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L515-L517 |
10,081 | aerospike/aerospike-client-go | cdt_map.go | MapGetByKeyListOp | func MapGetByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY_LIST, _MAP_READ, binName, keys, returnType)
} | go | func MapGetByKeyListOp(binName string, keys []interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY_LIST, _MAP_READ, binName, keys, returnType)
} | [
"func",
"MapGetByKeyListOp",
"(",
"binName",
"string",
",",
"keys",
"[",
"]",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_KEY_LIST",
",",
"_MAP_READ",
",",
"binName",
",",
"keys",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByKeyListOp creates a map get by key list operation.
// Server selects map items identified by keys and returns selected data specified by returnType. | [
"MapGetByKeyListOp",
"creates",
"a",
"map",
"get",
"by",
"key",
"list",
"operation",
".",
"Server",
"selects",
"map",
"items",
"identified",
"by",
"keys",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L563-L565 |
10,082 | aerospike/aerospike-client-go | cdt_map.go | MapGetByValueOp | func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_VALUE, _MAP_READ, binName, value, returnType)
} | go | func MapGetByValueOp(binName string, value interface{}, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_VALUE, _MAP_READ, binName, value, returnType)
} | [
"func",
"MapGetByValueOp",
"(",
"binName",
"string",
",",
"value",
"interface",
"{",
"}",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_VALUE",
",",
"_MAP_READ",
",",
"binName",
",",
"value",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByValueOp creates map get by value operation.
// Server selects map items identified by value and returns selected data specified by returnType. | [
"MapGetByValueOp",
"creates",
"map",
"get",
"by",
"value",
"operation",
".",
"Server",
"selects",
"map",
"items",
"identified",
"by",
"value",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L569-L571 |
10,083 | aerospike/aerospike-client-go | cdt_map.go | MapGetByIndexOp | func MapGetByIndexOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX, _MAP_READ, binName, index, returnType)
} | go | func MapGetByIndexOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX, _MAP_READ, binName, index, returnType)
} | [
"func",
"MapGetByIndexOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_INDEX",
",",
"_MAP_READ",
",",
"binName",
",",
"index",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByIndexOp creates map get by index operation.
// Server selects map item identified by index and returns selected data specified by returnType. | [
"MapGetByIndexOp",
"creates",
"map",
"get",
"by",
"index",
"operation",
".",
"Server",
"selects",
"map",
"item",
"identified",
"by",
"index",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L615-L617 |
10,084 | aerospike/aerospike-client-go | cdt_map.go | MapGetByIndexRangeOp | func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, returnType)
} | go | func MapGetByIndexRangeOp(binName string, index int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, returnType)
} | [
"func",
"MapGetByIndexRangeOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_INDEX_RANGE",
",",
"_MAP_READ",
",",
"binName",
",",
"index",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByIndexRangeOp creates map get by index range operation.
// Server selects map items starting at specified index to the end of map and returns selected
// data specified by returnType. | [
"MapGetByIndexRangeOp",
"creates",
"map",
"get",
"by",
"index",
"range",
"operation",
".",
"Server",
"selects",
"map",
"items",
"starting",
"at",
"specified",
"index",
"to",
"the",
"end",
"of",
"map",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L622-L624 |
10,085 | aerospike/aerospike-client-go | cdt_map.go | MapGetByIndexRangeCountOp | func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, count, returnType)
} | go | func MapGetByIndexRangeCountOp(binName string, index int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, count, returnType)
} | [
"func",
"MapGetByIndexRangeCountOp",
"(",
"binName",
"string",
",",
"index",
"int",
",",
"count",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationIndexCount",
"(",
"_CDT_MAP_GET_BY_INDEX_RANGE",
",",
"_MAP_READ",
",",
"binName",
",",
"index",
",",
"count",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByIndexRangeCountOp creates map get by index range operation.
// Server selects "count" map items starting at specified index and returns selected data specified by returnType. | [
"MapGetByIndexRangeCountOp",
"creates",
"map",
"get",
"by",
"index",
"range",
"operation",
".",
"Server",
"selects",
"count",
"map",
"items",
"starting",
"at",
"specified",
"index",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L628-L630 |
10,086 | aerospike/aerospike-client-go | cdt_map.go | MapGetByRankOp | func MapGetByRankOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK, _MAP_READ, binName, rank, returnType)
} | go | func MapGetByRankOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK, _MAP_READ, binName, rank, returnType)
} | [
"func",
"MapGetByRankOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_RANK",
",",
"_MAP_READ",
",",
"binName",
",",
"rank",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByRankOp creates map get by rank operation.
// Server selects map item identified by rank and returns selected data specified by returnType. | [
"MapGetByRankOp",
"creates",
"map",
"get",
"by",
"rank",
"operation",
".",
"Server",
"selects",
"map",
"item",
"identified",
"by",
"rank",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L634-L636 |
10,087 | aerospike/aerospike-client-go | cdt_map.go | MapGetByRankRangeOp | func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, returnType)
} | go | func MapGetByRankRangeOp(binName string, rank int, returnType mapReturnType) *Operation {
return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, returnType)
} | [
"func",
"MapGetByRankRangeOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationValue1",
"(",
"_CDT_MAP_GET_BY_RANK_RANGE",
",",
"_MAP_READ",
",",
"binName",
",",
"rank",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByRankRangeOp creates map get by rank range operation.
// Server selects map items starting at specified rank to the last ranked item and returns selected
// data specified by returnType. | [
"MapGetByRankRangeOp",
"creates",
"map",
"get",
"by",
"rank",
"range",
"operation",
".",
"Server",
"selects",
"map",
"items",
"starting",
"at",
"specified",
"rank",
"to",
"the",
"last",
"ranked",
"item",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L641-L643 |
10,088 | aerospike/aerospike-client-go | cdt_map.go | MapGetByRankRangeCountOp | func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, count, returnType)
} | go | func MapGetByRankRangeCountOp(binName string, rank int, count int, returnType mapReturnType) *Operation {
return newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, count, returnType)
} | [
"func",
"MapGetByRankRangeCountOp",
"(",
"binName",
"string",
",",
"rank",
"int",
",",
"count",
"int",
",",
"returnType",
"mapReturnType",
")",
"*",
"Operation",
"{",
"return",
"newCDTCreateOperationIndexCount",
"(",
"_CDT_MAP_GET_BY_RANK_RANGE",
",",
"_MAP_READ",
",",
"binName",
",",
"rank",
",",
"count",
",",
"returnType",
")",
"\n",
"}"
]
| // MapGetByRankRangeCountOp creates map get by rank range operation.
// Server selects "count" map items starting at specified rank and returns selected data specified by returnType. | [
"MapGetByRankRangeCountOp",
"creates",
"map",
"get",
"by",
"rank",
"range",
"operation",
".",
"Server",
"selects",
"count",
"map",
"items",
"starting",
"at",
"specified",
"rank",
"and",
"returns",
"selected",
"data",
"specified",
"by",
"returnType",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/cdt_map.go#L647-L649 |
10,089 | aerospike/aerospike-client-go | internal/atomic/queue.go | NewAtomicQueue | func NewAtomicQueue(size int) *AtomicQueue {
if size <= 0 {
panic("Queue size cannot be less than 1")
}
return &AtomicQueue{
wrapped: false,
data: make([]interface{}, uint32(size)),
size: uint32(size),
}
} | go | func NewAtomicQueue(size int) *AtomicQueue {
if size <= 0 {
panic("Queue size cannot be less than 1")
}
return &AtomicQueue{
wrapped: false,
data: make([]interface{}, uint32(size)),
size: uint32(size),
}
} | [
"func",
"NewAtomicQueue",
"(",
"size",
"int",
")",
"*",
"AtomicQueue",
"{",
"if",
"size",
"<=",
"0",
"{",
"panic",
"(",
"\"",
"\"",
")",
"\n",
"}",
"\n\n",
"return",
"&",
"AtomicQueue",
"{",
"wrapped",
":",
"false",
",",
"data",
":",
"make",
"(",
"[",
"]",
"interface",
"{",
"}",
",",
"uint32",
"(",
"size",
")",
")",
",",
"size",
":",
"uint32",
"(",
"size",
")",
",",
"}",
"\n",
"}"
]
| // NewQueue creates a new queue with initial size. | [
"NewQueue",
"creates",
"a",
"new",
"queue",
"with",
"initial",
"size",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/queue.go#L31-L41 |
10,090 | aerospike/aerospike-client-go | internal/atomic/queue.go | Offer | func (q *AtomicQueue) Offer(obj interface{}) bool {
q.mutex.Lock()
// make sure queue is not full
if q.tail == q.head && q.wrapped {
q.mutex.Unlock()
return false
}
if q.head+1 == q.size {
q.wrapped = true
}
q.head = (q.head + 1) % q.size
q.data[q.head] = obj
q.mutex.Unlock()
return true
} | go | func (q *AtomicQueue) Offer(obj interface{}) bool {
q.mutex.Lock()
// make sure queue is not full
if q.tail == q.head && q.wrapped {
q.mutex.Unlock()
return false
}
if q.head+1 == q.size {
q.wrapped = true
}
q.head = (q.head + 1) % q.size
q.data[q.head] = obj
q.mutex.Unlock()
return true
} | [
"func",
"(",
"q",
"*",
"AtomicQueue",
")",
"Offer",
"(",
"obj",
"interface",
"{",
"}",
")",
"bool",
"{",
"q",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n\n",
"// make sure queue is not full",
"if",
"q",
".",
"tail",
"==",
"q",
".",
"head",
"&&",
"q",
".",
"wrapped",
"{",
"q",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"false",
"\n",
"}",
"\n\n",
"if",
"q",
".",
"head",
"+",
"1",
"==",
"q",
".",
"size",
"{",
"q",
".",
"wrapped",
"=",
"true",
"\n",
"}",
"\n\n",
"q",
".",
"head",
"=",
"(",
"q",
".",
"head",
"+",
"1",
")",
"%",
"q",
".",
"size",
"\n",
"q",
".",
"data",
"[",
"q",
".",
"head",
"]",
"=",
"obj",
"\n",
"q",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"true",
"\n",
"}"
]
| // Offer adds an item to the queue unless the queue is full.
// In case the queue is full, the item will not be added to the queue
// and false will be returned | [
"Offer",
"adds",
"an",
"item",
"to",
"the",
"queue",
"unless",
"the",
"queue",
"is",
"full",
".",
"In",
"case",
"the",
"queue",
"is",
"full",
"the",
"item",
"will",
"not",
"be",
"added",
"to",
"the",
"queue",
"and",
"false",
"will",
"be",
"returned"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/queue.go#L46-L63 |
10,091 | aerospike/aerospike-client-go | internal/atomic/queue.go | Poll | func (q *AtomicQueue) Poll() (res interface{}) {
q.mutex.Lock()
// if queue is not empty
if q.wrapped || (q.tail != q.head) {
if q.tail+1 == q.size {
q.wrapped = false
}
q.tail = (q.tail + 1) % q.size
res = q.data[q.tail]
}
q.mutex.Unlock()
return res
} | go | func (q *AtomicQueue) Poll() (res interface{}) {
q.mutex.Lock()
// if queue is not empty
if q.wrapped || (q.tail != q.head) {
if q.tail+1 == q.size {
q.wrapped = false
}
q.tail = (q.tail + 1) % q.size
res = q.data[q.tail]
}
q.mutex.Unlock()
return res
} | [
"func",
"(",
"q",
"*",
"AtomicQueue",
")",
"Poll",
"(",
")",
"(",
"res",
"interface",
"{",
"}",
")",
"{",
"q",
".",
"mutex",
".",
"Lock",
"(",
")",
"\n\n",
"// if queue is not empty",
"if",
"q",
".",
"wrapped",
"||",
"(",
"q",
".",
"tail",
"!=",
"q",
".",
"head",
")",
"{",
"if",
"q",
".",
"tail",
"+",
"1",
"==",
"q",
".",
"size",
"{",
"q",
".",
"wrapped",
"=",
"false",
"\n",
"}",
"\n",
"q",
".",
"tail",
"=",
"(",
"q",
".",
"tail",
"+",
"1",
")",
"%",
"q",
".",
"size",
"\n",
"res",
"=",
"q",
".",
"data",
"[",
"q",
".",
"tail",
"]",
"\n",
"}",
"\n\n",
"q",
".",
"mutex",
".",
"Unlock",
"(",
")",
"\n",
"return",
"res",
"\n",
"}"
]
| // Poll removes and returns an item from the queue.
// If the queue is empty, nil will be returned. | [
"Poll",
"removes",
"and",
"returns",
"an",
"item",
"from",
"the",
"queue",
".",
"If",
"the",
"queue",
"is",
"empty",
"nil",
"will",
"be",
"returned",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/queue.go#L67-L81 |
10,092 | aerospike/aerospike-client-go | task_drop_index.go | NewDropIndexTask | func NewDropIndexTask(cluster *Cluster, namespace string, indexName string) *DropIndexTask {
return &DropIndexTask{
baseTask: newTask(cluster),
namespace: namespace,
indexName: indexName,
}
} | go | func NewDropIndexTask(cluster *Cluster, namespace string, indexName string) *DropIndexTask {
return &DropIndexTask{
baseTask: newTask(cluster),
namespace: namespace,
indexName: indexName,
}
} | [
"func",
"NewDropIndexTask",
"(",
"cluster",
"*",
"Cluster",
",",
"namespace",
"string",
",",
"indexName",
"string",
")",
"*",
"DropIndexTask",
"{",
"return",
"&",
"DropIndexTask",
"{",
"baseTask",
":",
"newTask",
"(",
"cluster",
")",
",",
"namespace",
":",
"namespace",
",",
"indexName",
":",
"indexName",
",",
"}",
"\n",
"}"
]
| // NewDropIndexTask initializes a task with fields needed to query server nodes. | [
"NewDropIndexTask",
"initializes",
"a",
"task",
"with",
"fields",
"needed",
"to",
"query",
"server",
"nodes",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/task_drop_index.go#L28-L34 |
10,093 | aerospike/aerospike-client-go | value.go | NewBlobValue | func NewBlobValue(object AerospikeBlob) BytesValue {
buf, err := object.EncodeBlob()
if err != nil {
panic(err)
}
return NewBytesValue(buf)
} | go | func NewBlobValue(object AerospikeBlob) BytesValue {
buf, err := object.EncodeBlob()
if err != nil {
panic(err)
}
return NewBytesValue(buf)
} | [
"func",
"NewBlobValue",
"(",
"object",
"AerospikeBlob",
")",
"BytesValue",
"{",
"buf",
",",
"err",
":=",
"object",
".",
"EncodeBlob",
"(",
")",
"\n",
"if",
"err",
"!=",
"nil",
"{",
"panic",
"(",
"err",
")",
"\n",
"}",
"\n\n",
"return",
"NewBytesValue",
"(",
"buf",
")",
"\n",
"}"
]
| // NewBlobValue accepts an AerospikeBlob interface, and automatically
// converts it to a BytesValue.
// If Encode returns an err, it will panic. | [
"NewBlobValue",
"accepts",
"an",
"AerospikeBlob",
"interface",
"and",
"automatically",
"converts",
"it",
"to",
"a",
"BytesValue",
".",
"If",
"Encode",
"returns",
"an",
"err",
"it",
"will",
"panic",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/value.go#L566-L573 |
10,094 | aerospike/aerospike-client-go | internal/atomic/sync_val.go | Set | func (sv *SyncVal) Set(val interface{}) {
sv.lock.Lock()
sv.val = val
sv.lock.Unlock()
} | go | func (sv *SyncVal) Set(val interface{}) {
sv.lock.Lock()
sv.val = val
sv.lock.Unlock()
} | [
"func",
"(",
"sv",
"*",
"SyncVal",
")",
"Set",
"(",
"val",
"interface",
"{",
"}",
")",
"{",
"sv",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"sv",
".",
"val",
"=",
"val",
"\n",
"sv",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n",
"}"
]
| // Set updates the value of SyncVal with the passed argument | [
"Set",
"updates",
"the",
"value",
"of",
"SyncVal",
"with",
"the",
"passed",
"argument"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/sync_val.go#L16-L20 |
10,095 | aerospike/aerospike-client-go | internal/atomic/sync_val.go | Get | func (sv *SyncVal) Get() interface{} {
sv.lock.RLock()
val := sv.val
sv.lock.RUnlock()
return val
} | go | func (sv *SyncVal) Get() interface{} {
sv.lock.RLock()
val := sv.val
sv.lock.RUnlock()
return val
} | [
"func",
"(",
"sv",
"*",
"SyncVal",
")",
"Get",
"(",
")",
"interface",
"{",
"}",
"{",
"sv",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"val",
":=",
"sv",
".",
"val",
"\n",
"sv",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n",
"return",
"val",
"\n",
"}"
]
| // Get returns the value inside the SyncVal | [
"Get",
"returns",
"the",
"value",
"inside",
"the",
"SyncVal"
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/sync_val.go#L23-L28 |
10,096 | aerospike/aerospike-client-go | internal/atomic/sync_val.go | GetSyncedVia | func (sv *SyncVal) GetSyncedVia(f func(interface{}) (interface{}, error)) (interface{}, error) {
sv.lock.RLock()
defer sv.lock.RUnlock()
val, err := f(sv.val)
return val, err
} | go | func (sv *SyncVal) GetSyncedVia(f func(interface{}) (interface{}, error)) (interface{}, error) {
sv.lock.RLock()
defer sv.lock.RUnlock()
val, err := f(sv.val)
return val, err
} | [
"func",
"(",
"sv",
"*",
"SyncVal",
")",
"GetSyncedVia",
"(",
"f",
"func",
"(",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
"{",
"sv",
".",
"lock",
".",
"RLock",
"(",
")",
"\n",
"defer",
"sv",
".",
"lock",
".",
"RUnlock",
"(",
")",
"\n\n",
"val",
",",
"err",
":=",
"f",
"(",
"sv",
".",
"val",
")",
"\n",
"return",
"val",
",",
"err",
"\n",
"}"
]
| // GetSyncedVia returns the value returned by the function f. | [
"GetSyncedVia",
"returns",
"the",
"value",
"returned",
"by",
"the",
"function",
"f",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/sync_val.go#L31-L37 |
10,097 | aerospike/aerospike-client-go | internal/atomic/sync_val.go | Update | func (sv *SyncVal) Update(f func(interface{}) (interface{}, error)) error {
sv.lock.Lock()
defer sv.lock.Unlock()
val, err := f(sv.val)
if err == nil {
sv.val = val
}
return err
} | go | func (sv *SyncVal) Update(f func(interface{}) (interface{}, error)) error {
sv.lock.Lock()
defer sv.lock.Unlock()
val, err := f(sv.val)
if err == nil {
sv.val = val
}
return err
} | [
"func",
"(",
"sv",
"*",
"SyncVal",
")",
"Update",
"(",
"f",
"func",
"(",
"interface",
"{",
"}",
")",
"(",
"interface",
"{",
"}",
",",
"error",
")",
")",
"error",
"{",
"sv",
".",
"lock",
".",
"Lock",
"(",
")",
"\n",
"defer",
"sv",
".",
"lock",
".",
"Unlock",
"(",
")",
"\n\n",
"val",
",",
"err",
":=",
"f",
"(",
"sv",
".",
"val",
")",
"\n",
"if",
"err",
"==",
"nil",
"{",
"sv",
".",
"val",
"=",
"val",
"\n",
"}",
"\n",
"return",
"err",
"\n",
"}"
]
| // Update gets a function and passes the value of SyncVal to it.
// If the resulting err is nil, it will update the value of SyncVal.
// It will return the resulting error to the caller. | [
"Update",
"gets",
"a",
"function",
"and",
"passes",
"the",
"value",
"of",
"SyncVal",
"to",
"it",
".",
"If",
"the",
"resulting",
"err",
"is",
"nil",
"it",
"will",
"update",
"the",
"value",
"of",
"SyncVal",
".",
"It",
"will",
"return",
"the",
"resulting",
"error",
"to",
"the",
"caller",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/sync_val.go#L42-L51 |
10,098 | aerospike/aerospike-client-go | internal/atomic/int.go | NewAtomicInt | func NewAtomicInt(value int) *AtomicInt {
v := int64(value)
return &AtomicInt{
val: v,
}
} | go | func NewAtomicInt(value int) *AtomicInt {
v := int64(value)
return &AtomicInt{
val: v,
}
} | [
"func",
"NewAtomicInt",
"(",
"value",
"int",
")",
"*",
"AtomicInt",
"{",
"v",
":=",
"int64",
"(",
"value",
")",
"\n",
"return",
"&",
"AtomicInt",
"{",
"val",
":",
"v",
",",
"}",
"\n",
"}"
]
| // NewAtomicInt generates a newVal AtomicInt instance. | [
"NewAtomicInt",
"generates",
"a",
"newVal",
"AtomicInt",
"instance",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/int.go#L25-L30 |
10,099 | aerospike/aerospike-client-go | internal/atomic/int.go | AddAndGet | func (ai *AtomicInt) AddAndGet(delta int) int {
res := int(atomic.AddInt64(&ai.val, int64(delta)))
return res
} | go | func (ai *AtomicInt) AddAndGet(delta int) int {
res := int(atomic.AddInt64(&ai.val, int64(delta)))
return res
} | [
"func",
"(",
"ai",
"*",
"AtomicInt",
")",
"AddAndGet",
"(",
"delta",
"int",
")",
"int",
"{",
"res",
":=",
"int",
"(",
"atomic",
".",
"AddInt64",
"(",
"&",
"ai",
".",
"val",
",",
"int64",
"(",
"delta",
")",
")",
")",
"\n",
"return",
"res",
"\n",
"}"
]
| // AddAndGet atomically adds the given value to the current value. | [
"AddAndGet",
"atomically",
"adds",
"the",
"given",
"value",
"to",
"the",
"current",
"value",
"."
]
| f257953b1650505cf4c357fcc4f032d160ebb07e | https://github.com/aerospike/aerospike-client-go/blob/f257953b1650505cf4c357fcc4f032d160ebb07e/internal/atomic/int.go#L33-L36 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.