id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c10000
binary.Write(buf, binary.BigEndian, msg.MessageHeader) binary.Write(buf, binary.BigEndian, msg.Data[:]) return buf.Bytes() }
c10001
/ (float64(duration) / float64(time.Second))) }
c10002
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) }
c10003
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.Expirati...
c10004
&ExecuteTask{ baseTask: newTask(cluster), taskID: statement.TaskId, scan: statement.IsScan(), } }
c10005
{ return &Bin{ Name: name, Value: NewValue(value), } }
c10006
cb() } log.Fatalln(err.Error()) } return }
c10007
= 1 } return &AtomicBool{ val: i, } }
c10008
1 } atomic.StoreInt32(&(ab.val), int32(i)) }
c10009
{ return ab.Get() } atomic.StoreInt32(&(ab.val), int32(1)) return true }
c10010
res := atomic.CompareAndSwapInt32(&ab.val, int32(1-updated), int32(updated)) return res }
c10011
L.SetField(mt, "writeable", L.NewFunction(luaStreamWriteable)) // methods L.SetFuncs(mt, map[string]lua.LGFunction{ "__tostring": luaStreamToString, }) L.SetMetatable(mt, mt) }
c10012
L.SetMetatable(ud, L.GetTypeMetatable(luaLuaStreamTypeName)) return ud }
c10013
attributes: order, flags: flags, } }
c10014
ListValue{_CDT_LIST_SET_TYPE, IntegerValue(listOrder)}, encoder: listGenericOpEncoder} }
c10015
_CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values)}, encoder: listGenericOpEncoder} }
c10016
&Operation{opType: _CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_APPEND_ITEMS, ListValue(values), IntegerValue(policy.attributes), IntegerValue(policy.flags)}, encoder: listGenericOpEncoder} } }
c10017
_CDT_MODIFY, binName: binName, binValue: ListValue{_CDT_LIST_INSERT_ITEMS, IntegerValue(index), ListValue(values)}, encoder: listGenericOpEncoder} }
c10018
ListValue{_CDT_LIST_POP, IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10019
binValue: ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder} }
c10020
ListValue{_CDT_LIST_POP_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10021
ListValue{_CDT_LIST_REMOVE, IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10022
ListValue{_CDT_LIST_REMOVE_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder} }
c10023
ListValue{_CDT_LIST_REMOVE_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder} }
c10024
binValue: ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder} }
c10025
ListValue{_CDT_LIST_REMOVE_RANGE, IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10026
ListValue{_CDT_LIST_SET, IntegerValue(index), NewValue(value)}, encoder: listGenericOpEncoder} }
c10027
IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder} }
c10028
ListValue{_CDT_LIST_CLEAR}, encoder: listGenericOpEncoder} }
c10029
ListValue{_CDT_LIST_SIZE}, encoder: listGenericOpEncoder} }
c10030
ListValue{_CDT_LIST_GET, IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10031
ListValue{_CDT_LIST_GET_RANGE, IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder} }
c10032
ListValue{_CDT_LIST_SORT, IntegerValue(sortFlags)}, encoder: listGenericOpEncoder} }
c10033
ListValue{_CDT_LIST_REMOVE_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10034
ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10035
ListValue{_CDT_LIST_REMOVE_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index), IntegerValue(count)}, encoder: listGenericOpEncoder} }
c10036
ListValue{_CDT_LIST_REMOVE_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder} }
c10037
ListValue{_CDT_LIST_REMOVE_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder} }
c10038
ListValue{_CDT_LIST_GET_BY_VALUE, IntegerValue(returnType), NewValue(value)}, encoder: listGenericOpEncoder} }
c10039
ListValue{_CDT_LIST_GET_BY_VALUE_LIST, IntegerValue(returnType), ListValue(values)}, encoder: listGenericOpEncoder} }
c10040
ListValue{_CDT_LIST_GET_BY_INDEX, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10041
ListValue{_CDT_LIST_GET_BY_INDEX_RANGE, IntegerValue(returnType), IntegerValue(index)}, encoder: listGenericOpEncoder} }
c10042
ListValue{_CDT_LIST_GET_BY_RANK, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder} }
c10043
ListValue{_CDT_LIST_GET_BY_RANK_RANGE, IntegerValue(returnType), IntegerValue(rank)}, encoder: listGenericOpEncoder} }
c10044
mp, ScanPercent: 100, ConcurrentNodes: true, } }
c10045
newTask(cluster), packageName: packageName, } }
c10046
nil { bp.Finalize(res) } if bp.New != nil { res = bp.New(params...) } } return res }
c10047
} if finalize && bp.Finalize != nil { bp.Finalize(obj) } }
c10048
0, FailIfNotConnected: true, TendInterval: time.Second, LimitConnectionsToQueueSize: true, IgnoreOtherSubnetAliases: false, } }
c10049
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(ti...
c10050
"" && !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 }
c10051
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) }
c10052
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, ...
c10053
time.Duration) error { ctn.deadline = deadline ctn.socketTimeout = socketTimeout return nil }
c10054
atomic.AddInt64(&ctn.node.stats.ConnectionsFailed, 1) } // Socket not authenticated. Do not put back into pool. ctn.Close() return err } } return nil }
c10055
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 comm...
c10056
!time.Now().Before(ctn.idleDeadline) }
c10057
time.Now().Add(ctn.idleTimeout) }
c10058
:= newReadCommand(clnt.cluster, policy, key, binNames) command.object = &rval return command.Execute() }
c10059
} } 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 = c...
c10060
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....
c10061
objectset: *newObjectset(reflect.ValueOf(objChan), 1, taskID), } go clnt.scanNodeObjects(&policy, node, res, namespace, setName, taskID, binNames...) return res, nil }
c10062
newScanObjectsCommand(node, policy, namespace, setName, binNames, recordset, taskID) return command.Execute() }
c10063
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 }
c10064
policies to avoid race conditions newPolicy := *policy command := newQueryRecordCommand(node, &newPolicy, statement, recSet) go func() { command.Execute() }() return recSet, nil }
c10065
itemCommand: writeMode.itemCommand, itemsCommand: writeMode.itemsCommand, } }
c10066
MapWriteMode.UPDATE.itemCommand, itemsCommand: MapWriteMode.UPDATE.itemsCommand, } }
c10067
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([...
c10068
newCDTCreateOperationValues2(_CDT_MAP_INCREMENT, policy.attributes, binName, key, incr) }
c10069
newCDTCreateOperationValues2(_CDT_MAP_DECREMENT, policy.attributes, binName, key, decr) }
c10070
newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_KEY, _MAP_MODIFY, binName, key, returnType) }
c10071
newCDTCreateOperationValue1(_CDT_MAP_REMOVE_KEY_LIST, _MAP_MODIFY, binName, keys, returnType) }
c10072
newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_VALUE, _MAP_MODIFY, binName, value, returnType) }
c10073
newCDTCreateOperationValuesN(_CDT_MAP_REMOVE_VALUE_LIST, _MAP_MODIFY, binName, values, returnType) }
c10074
{ return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX, _MAP_MODIFY, binName, index, returnType) }
c10075
{ return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, returnType) }
c10076
newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_INDEX_RANGE, _MAP_MODIFY, binName, index, count, returnType) }
c10077
{ return newCDTCreateOperationValue1(_CDT_MAP_REMOVE_BY_RANK, _MAP_MODIFY, binName, rank, returnType) }
c10078
{ return newCDTCreateOperationIndex(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, returnType) }
c10079
newCDTCreateOperationIndexCount(_CDT_MAP_REMOVE_BY_RANK_RANGE, _MAP_MODIFY, binName, rank, count, returnType) }
c10080
newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY, _MAP_READ, binName, key, returnType) }
c10081
newCDTCreateOperationValue1(_CDT_MAP_GET_BY_KEY_LIST, _MAP_READ, binName, keys, returnType) }
c10082
newCDTCreateOperationValue1(_CDT_MAP_GET_BY_VALUE, _MAP_READ, binName, value, returnType) }
c10083
{ return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX, _MAP_READ, binName, index, returnType) }
c10084
newCDTCreateOperationValue1(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, returnType) }
c10085
newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_INDEX_RANGE, _MAP_READ, binName, index, count, returnType) }
c10086
{ return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK, _MAP_READ, binName, rank, returnType) }
c10087
{ return newCDTCreateOperationValue1(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, returnType) }
c10088
newCDTCreateOperationIndexCount(_CDT_MAP_GET_BY_RANK_RANGE, _MAP_READ, binName, rank, count, returnType) }
c10089
than 1") } return &AtomicQueue{ wrapped: false, data: make([]interface{}, uint32(size)), size: uint32(size), } }
c10090
q.wrapped = true } q.head = (q.head + 1) % q.size q.data[q.head] = obj q.mutex.Unlock() return true }
c10091
} q.tail = (q.tail + 1) % q.size res = q.data[q.tail] } q.mutex.Unlock() return res }
c10092
{ return &DropIndexTask{ baseTask: newTask(cluster), namespace: namespace, indexName: indexName, } }
c10093
panic(err) } return NewBytesValue(buf) }
c10094
sv.val = val sv.lock.Unlock() }
c10095
sv.lock.RUnlock() return val }
c10096
(interface{}, error) { sv.lock.RLock() defer sv.lock.RUnlock() val, err := f(sv.val) return val, err }
c10097
:= f(sv.val) if err == nil { sv.val = val } return err }
c10098
int64(value) return &AtomicInt{ val: v, } }
c10099
int(atomic.AddInt64(&ai.val, int64(delta))) return res }