MCPcopy Create free account
hub / github.com/dgraph-io/dgraph / SetUid

Method SetUid

xidmap/xidmap.go:224–239  ·  view source on GitHub ↗
(xid string, uid uint64)

Source from the content-addressed store, hash-verified

222}
223
224func (m *XidMap) SetUid(xid string, uid uint64) {
225 sh := m.shardFor(xid)
226 sh.Lock()
227 defer sh.Unlock()
228 sh.tree.Set(farm.Fingerprint64([]byte(xid)), uid)
229 if m.writer != nil {
230 var uidBuf [8]byte
231 binary.BigEndian.PutUint64(uidBuf[:], uid)
232 m.kvBuf = append(m.kvBuf, kv{key: []byte(xid), value: uidBuf[:]})
233
234 if len(m.kvBuf) == 64 {
235 m.kvChan <- m.kvBuf
236 m.kvBuf = make([]kv, 0, 64)
237 }
238 }
239}
240
241func (m *XidMap) dbWriter() {
242 defer m.wg.Done()

Callers 1

upsertUidsMethod · 0.80

Calls 4

shardForMethod · 0.95
SetMethod · 0.65
LockMethod · 0.45
UnlockMethod · 0.45

Tested by

no test coverage detected