id
stringlengths
2
7
text
stringlengths
17
51.2k
title
stringclasses
1 value
c9900
val return ky.computeDigest() }
c9901
{ return bytes.Equal(ky.digest[:], other.digest[:]) }
c9902
} return fmt.Sprintf("%s:%s::%v", ky.namespace, ky.setName, Buffer.BytesToHexString(ky.digest[:])) }
c9903
err := newKey.computeDigest(); err != nil { return nil, err } return newKey, nil }
c9904
if err := newKey.SetDigest(digest); err != nil { return nil, err } return newKey, nil }
c9905
required to be exactly 20 bytes.") } copy(ky.digest[:], digest) return nil }
c9906
len(binNames) == 0 { res.ReadAllBins = true } return res }
c9907
return v } case lua.LTTable: t := val.(*lua.LTable) m := make(map[interface{}]interface{}, t.Len()) t.ForEach(func(k, v lua.LValue) { m[k] = v }) return m default: panic(fmt.Sprintf("unrecognized data type %#v", val)) } }
c9908
return "MAPKEYS" case ICT_MAPVALUES: return "MAPVALUES" default: panic(fmt.Sprintf("Unknown IndexCollectionType value %v", ict)) } }
c9909
expiration, } // Writes may not be idempotent. // do not allow retries on writes by default. res.MaxRetries = 0 return res }
c9910
SocketTimeout: 30 * time.Second, MaxRetries: 2, SleepBetweenRetries: 1 * time.Millisecond, SleepMultiplier: 1.0, ReplicaPolicy: SEQUENCE, SendKey: false, LinearizeRead: false, } }
c9911
p.SocketTimeout } else if p.TotalTimeout > 0 && p.SocketTimeout > 0 { if p.SocketTimeout < p.TotalTimeout { return p.SocketTimeout } } return p.TotalTimeout }
c9912
append([]byte(p.name)), nil }
c9913
= string(buf) return nil }
c9914
Namespace: ns, SetName: set, BinNames: binNames, returnData: true, TaskId: uint64(xornd.Int64()), } }
c9915
= functionName stmt.functionArgs = functionArgs stmt.returnData = returnData }
c9916
stmt.TaskId = uint64(xornd.Int64()) } }
c9917
defer lgr.mutex.Unlock() lgr.level = level }
c9918
lgr.Info(format, v...) case WARNING: lgr.Warn(format, v...) case ERR: lgr.Error(format, v...) } }
c9919
<= DEBUG { if l, ok := lgr.Logger.(*log.Logger); ok { l.Output(2, fmt.Sprintf(format, v...)) } else { lgr.Logger.Printf(format, v...) } } }
c9920
SERIALIZE_ERROR, SERVER_NOT_AVAILABLE, SCAN_ABORT, QUERY_ABORTED, INVALID_NODE_ERROR, SERVER_MEM_ERROR, TIMEOUT, INDEX_OOM, QUERY_TIMEOUT: return false default: return true } }
c9921
true, AllowPartialResults: false, SendSetName: false, } }
c9922
return &singleConnectionHeap{ full: false, data: make([]*Connection, uint32(size)), size: uint32(size), } }
c9923
false } h.tail = (h.tail + 1) % h.size h.data[h.tail] = nil h.full = false conn.Close() return true } return false }
c9924
(int(h.tail) - int(h.head)) } } else { cnt = int(h.size) } h.mutex.Unlock() return cnt }
c9925
h.heaps[i].DropIdleTail() { } } }
c9926
cnt = h.heaps[hint].Len() } else { for i := range h.heaps { cnt += h.heaps[i].Len() } } return cnt }
c9927
copy(regimes, p.regimes) return &Partitions{ Replicas: replicas, CPMode: p.CPMode, regimes: regimes, } }
c9928
masterNodePartitionNotDefined { errList = append(errList, fmt.Errorf("Master partition nodes not defined for namespace `%s`: %d out of %d", nsName, len(partitionList), _PARTITIONS)) } for nsName, partitionList := range replicaNodePartitionNotDefined { errList = append(errList, fmt.Errorf("Replica partition ...
c9929
log.Printf("Put: ns=%s set=%s key=%s bin=%s value=%s", key.Namespace(), key.SetName(), key.Value(), bin.Name, bin.Value) client.PutBins(shared.WritePolicy, key, bin) } }
c9930
i < len(existsArray); i++ { key := keys[i] exists := existsArray[i] log.Printf("Record: ns=%s set=%s key=%s exists=%t", key.Namespace(), key.SetName(), key.Value(), exists) } }
c9931
!= nil { level = asl.INFO value = record.Bins[binName] } asl.Logger.LogAtLevel(level, "Record: ns=%s set=%s key=%s bin=%s value=%s", key.Namespace(), key.SetName(), key.Value(), binName, value) } if len(records) != size { log.Fatalf("Record size mismatch. Expected %d. Received %d.", size, len(records...
c9932
record := records[i] level := asl.ERR generation := uint32(0) expiration := uint32(0) if record != nil && (record.Generation > 0 || record.Expiration > 0) { level = asl.INFO generation = record.Generation expiration = record.Expiration } asl.Logger.LogAtLevel(level, "Record: ns=%s set=%s key=%s...
c9933
newTask(cluster), packageName: packageName, } }
c9934
if err != nil { return false, err } for _, response := range responseMap { find := "filename=" + tskr.packageName index := strings.Index(response, find) if index < 0 { return false, nil } done = true } } return done, nil }
c9935
"drop", L.NewFunction(luaListDrop)) L.SetField(mt, "trim", L.NewFunction(luaListTrim)) L.SetField(mt, "clone", L.NewFunction(luaListClone)) L.SetField(mt, "concat", L.NewFunction(luaListConcat)) L.SetField(mt, "merge", L.NewFunction(luaListMerge)) L.SetField(mt, "iterator", L.NewFunction(luaListIterator)) // me...
c9936
&AtomicArray{ length: length, items: make([]interface{}, length), } }
c9937
< 0 || idx >= aa.length { return nil } aa.mutex.RLock() res := aa.items[idx] aa.mutex.RUnlock() return res }
c9938
than array size (%d)", idx, aa.length) } aa.mutex.Lock() aa.items[idx] = node aa.mutex.Unlock() return nil }
c9939
aa.mutex.RUnlock() return res }
c9940
if err != nil { return size, err } } return size, nil }
c9941
{ n, err := PackInt64(buf, int64(elem)) size += n if err != nil { return size, err } } return size, nil }
c9942
if err != nil { return size, err } } return size, nil }
c9943
if err != nil { return size, err } } return size, nil }
c9944
if err != nil { return size, err } } return size, nil }
c9945
return packList(cmd, list) }
c9946
return packJsonMap(cmd, theMap) }
c9947
return packMap(cmd, theMap) }
c9948
return packBytes(cmd, b) }
c9949
return packAInt64(cmd, val) }
c9950
return packString(cmd, val) }
c9951
return packUInt64(cmd, val) }
c9952
return packBool(cmd, val) }
c9953
return packFloat32(cmd, val) }
c9954
return packFloat64(cmd, val) }
c9955
} op.binValue = BytesValue(packer.Bytes()) op.encoder = nil // do not encode anymore; just use the cache op.used = false // do not encode anymore; just use the cache return nil }
c9956
binName: binName, binValue: NewNullValue()} }
c9957
bin.Name, binValue: bin.Value} }
c9958
_APPEND, binName: bin.Name, binValue: bin.Value} }
c9959
_PREPEND, binName: bin.Name, binValue: bin.Value} }
c9960
bin.Name, binValue: bin.Value} }
c9961
RecordQueueSize: 50, IncludeBinData: true, FailOnClusterChange: true, } }
c9962
res = make([]byte, bp.initBufSize, bp.initBufSize) } bp.mutex.Unlock() return res }
c9963
*NewAtomicBool(nv.supportsGeo), supportsPeers: *NewAtomicBool(nv.supportsPeers), supportsLUTNow: *NewAtomicBool(nv.supportsLUTNow), supportsTruncateNamespace: *NewAtomicBool(nv.supportsTruncateNamespace), } newNode.aliases.Store(nv.aliases) newNode._sessionToken.Store(nv.sessi...
c9964
err := command.login(&nd.cluster.clientPolicy, nd.tendConn, nd.cluster.Password()); err != nil { // Socket not authenticated. Do not put back into pool. nd.tendConn.Close() return err } nd._sessionToken.Store(command.SessionToken) nd._sessionExpiration.Store(command.SessionExpiration) return nil }
c9965
} deadline := time.Now().Add(timeout) return nd.getConnection(deadline, timeout) }
c9966
(conn *Connection, err error) { return nd.getConnectionWithHint(deadline, timeout, 0) }
c9967
:= nd.connectionCount.IncrementAndGet() if cc > nd.cluster.clientPolicy.ConnectionQueueSize { res = true } nd.connectionCount.DecrementAndGet() } return res }
c9968
atomic.AddInt64(&nd.stats.ConnectionsAttempts, 1) conn, err := NewConnection(&nd.cluster.clientPolicy, nd.host) if err != nil { nd.connectionCount.DecrementAndGet() atomic.AddInt64(&nd.stats.ConnectionsFailed, 1) return nil, err } conn.node = nd // need to authenticate if err = conn.login(nd.sessionToke...
c9969
// quite a lot of latency. if err == ErrTooManyConnectionsForNode { // The connection pool is already full. No need for more connections. return } Logger.Error("Error trying to making a connection to the node %s: %s", nd.String(), err.Error()) time.Sleep(time.Millisecond) goto L } nd.putConnection...
c9970
// most call to this function will find a connection in the queue. if timeout > 0 { socketDeadline = time.Now().Add(timeout) } else { socketDeadline = time.Now().Add(_DEFAULT_TIMEOUT) } } time.Sleep(time.Millisecond) goto L } if err = conn.SetTimeout(deadline, timeout); err != nil { atomic...
c9971
!nd.connections.Offer(conn, hint) { conn.Close() return false } return true }
c9972
&& nd.partitionGeneration.Get() >= -1 }
c9973
not necessary. aliases := nd.GetAliases() if aliases == nil { aliases = []*Host{} } aliases = append(aliases, aliasToAdd) nd.setAliases(aliases) }
c9974
atomic.AddInt64(&nd.stats.NodeRemoved, 1) nd.closeConnections() }
c9975
== other || nd.name == other.name) }
c9976
and is not `0`, then migration is in progress if migration, exists := values["migrate_partitions_remaining"]; exists && migration != "0" { return true, nil } // migration not in progress return false, nil }
c9977
if err != nil { return err } nd.tendConn = tendConn } // Set timeout for tend conn return nd.tendConn.SetTimeout(deadline, timeout) }
c9978
occurred while fetching info from the server node %s: %s", nd.host.String(), err.Error()) time.Sleep(100 * time.Millisecond) } // return the last error return nil, err }
c9979
response, err := newInfo(nd.tendConn, name...) if err != nil { nd.tendConn.Close() return nil, err } return response, nil }
c9980
} values := strings.Split(v, ";") for i := range values { kv := strings.Split(values[i], "=") if len(kv) > 1 { res[kv[0]] = kv[1] } } return res, nil }
c9981
deadline = deadlineIfc.(time.Time) } if deadline.IsZero() || time.Now().After(deadline) { return nil } st := nd._sessionToken.Load() if st != nil { return st.([]byte) } return nil }
c9982
{ return v, nil } return -1, newAerospikeNodeError(nd, RACK_NOT_DEFINED) }
c9983
% 2^y = x & (2^y - 1); the second method is twice as fast PartitionId: int(Buffer.LittleBytesToInt32(key.digest[:], 0)&0xFFFF) & (_PARTITIONS - 1), } }
c9984
namespace, PartitionId: partitionID, } }
c9985
return ptn.PartitionId == other.PartitionId && ptn.Namespace == other.Namespace }
c9986
{ return err } } } if err := cmd.sizeBuffer(); err != nil { return err } if binMap == nil { cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, fieldCount, len(bins)) } else { cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, fieldCount, len(binMap)) } cmd.writeKey(key, policy.SendKey) if bi...
c9987
return err } cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE|_INFO2_DELETE, fieldCount, 0) cmd.writeKey(key, false) cmd.end() return nil }
c9988
} cmd.writeHeaderWithPolicy(policy, 0, _INFO2_WRITE, fieldCount, 1) cmd.writeKey(key, policy.SendKey) cmd.writeOperationForOperationType(_TOUCH) cmd.end() return nil }
c9989
{ return err } cmd.writeHeader(policy, _INFO1_READ|_INFO1_NOBINDATA, 0, fieldCount, 0) cmd.writeKey(key, false) cmd.end() return nil }
c9990
_INFO1_READ|_INFO1_NOBINDATA, 0, fieldCount, 1) cmd.writeKey(key, false) cmd.writeOperationForBinName("", _READ) cmd.end() return nil }
c9991
readBin = true } else { readAttr |= _INFO1_READ readHeader = true } case _MAP_MODIFY: // Map operations require RespondPerEachOp to be true. RespondPerEachOp = true // Fall through to default. fallthrough default: writeAttr = _INFO2_WRITE hasWrite = true } cmd.estimateOperati...
c9992
length. cmd.dataBuffer[9] = byte(readAttr) cmd.dataBuffer[10] = byte(writeAttr) cmd.dataBuffer[11] = byte(infoAttr) for i := 12; i < 26; i++ { cmd.dataBuffer[i] = 0 } cmd.dataOffset = 26 cmd.WriteInt16(int16(fieldCount)) cmd.WriteInt16(int16(operationCount)) cmd.dataOffset = int(_MSG_TOTAL_HEADER_SIZE) }
c9993
= byte(readAttr) cmd.dataBuffer[10] = byte(writeAttr) cmd.dataBuffer[11] = byte(infoAttr) cmd.dataBuffer[12] = 0 // unused cmd.dataBuffer[13] = 0 // clear the result code cmd.dataOffset = 14 cmd.WriteUint32(generation) cmd.dataOffset = 18 cmd.WriteUint32(policy.Expiration) // Initialize timeout. It will be w...
c9994
{ return fmt.Sprintf("%s %v", rc.Key, rc.Bins) }
c9995
= (word << 8) | uint(data[off]&0xff) off = (off + 1) % len(data) } return word, off }
c9996
c.P[i] = c.P[i] ^ word } for i := 0; i < plen; i += 2 { c.encipher(lr, 0) c.P[i] = lr[0] c.P[i+1] = lr[1] } for i := 0; i < slen; i += 2 { c.encipher(lr, 0) c.S[i] = lr[0] c.S[i+1] = lr[1] } }
c9997
ret := make([]byte, 24) for i := 0; i < 6; i++ { k := i << 2 ret[k] = (byte)((c.data[i] >> 24) & 0xff) ret[k+1] = (byte)((c.data[i] >> 16) & 0xff) ret[k+2] = (byte)((c.data[i] >> 8) & 0xff) ret[k+3] = (byte)(c.data[i] & 0xff) } return ret }
c9998
Version: uint8(2), Type: uint8(mtype), DataLen: msgLenToBytes(int64(len(data))), }, Data: data, } }
c9999
newSize, maxAllowedBufferSize) } if int64(len(msg.Data)) == newSize { return nil } msg.Data = make([]byte, newSize) return nil }