MCPcopy
hub / github.com/dgraph-io/dgraph / FromBackupKey

Function FromBackupKey

x/keys.go:449–480  ·  view source on GitHub ↗

FromBackupKey takes a key in the format used for backups and converts it to a key.

(backupKey *pb.BackupKey)

Source from the content-addressed store, hash-verified

447
448// FromBackupKey takes a key in the format used for backups and converts it to a key.
449func FromBackupKey(backupKey *pb.BackupKey) []byte {
450 if backupKey == nil {
451 return nil
452 }
453
454 attr := NamespaceAttr(backupKey.Namespace, backupKey.Attr)
455
456 var key []byte
457 switch backupKey.Type {
458 case pb.BackupKey_DATA:
459 key = DataKey(attr, backupKey.Uid)
460 case pb.BackupKey_INDEX:
461 key = IndexKey(attr, string(backupKey.Term))
462 case pb.BackupKey_REVERSE:
463 key = ReverseKey(attr, backupKey.Uid)
464 case pb.BackupKey_COUNT:
465 key = CountKey(attr, backupKey.Count, false)
466 case pb.BackupKey_COUNT_REV:
467 key = CountKey(attr, backupKey.Count, true)
468 case pb.BackupKey_SCHEMA:
469 key = SchemaKey(attr)
470 case pb.BackupKey_TYPE:
471 key = TypeKey(attr)
472 }
473
474 if backupKey.StartUid > 0 {
475 var err error
476 key, err = SplitKey(key, backupKey.StartUid)
477 Check(err)
478 }
479 return key
480}
481
482// SchemaPrefix returns the prefix for Schema keys.
483func SchemaPrefix() []byte {

Callers 2

fromBackupKeyFunction · 0.92
processReqChMethod · 0.92

Calls 9

NamespaceAttrFunction · 0.85
IndexKeyFunction · 0.85
ReverseKeyFunction · 0.85
CountKeyFunction · 0.85
SchemaKeyFunction · 0.85
TypeKeyFunction · 0.85
SplitKeyFunction · 0.85
DataKeyFunction · 0.70
CheckFunction · 0.70

Tested by

no test coverage detected