MCPcopy
hub / github.com/dgraph-io/badger / dataKey

Method dataKey

key_registry.go:298–310  ·  view source on GitHub ↗

dataKey returns datakey of the given key id.

(id uint64)

Source from the content-addressed store, hash-verified

296
297// dataKey returns datakey of the given key id.
298func (kr *KeyRegistry) dataKey(id uint64) (*pb.DataKey, error) {
299 kr.RLock()
300 defer kr.RUnlock()
301 if id == 0 {
302 // nil represent plain text.
303 return nil, nil
304 }
305 dk, ok := kr.dataKeys[id]
306 if !ok {
307 return nil, y.Wrapf(ErrInvalidDataKeyID, "Error for the KEY ID %d", id)
308 }
309 return dk, nil
310}
311
312// latestDataKey will give you the latest generated datakey based on the rotation
313// period. If the last generated datakey lifetime exceeds the rotation period.

Callers 3

openMethod · 0.80
newLevelsControllerFunction · 0.80

Calls 1

WrapfFunction · 0.92

Tested by 1