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

Method ToBackupKey

x/keys.go:418–446  ·  view source on GitHub ↗

ToBackupKey returns the key in the format used for writing backups.

()

Source from the content-addressed store, hash-verified

416
417// ToBackupKey returns the key in the format used for writing backups.
418func (p ParsedKey) ToBackupKey() *pb.BackupKey {
419 ns, attr := ParseNamespaceAttr(p.Attr)
420 key := pb.BackupKey{}
421 key.Namespace = ns
422 key.Attr = attr
423 key.Uid = p.Uid
424 key.StartUid = p.StartUid
425 key.Term = []byte(p.Term)
426 key.Count = p.Count
427
428 switch {
429 case p.IsData():
430 key.Type = pb.BackupKey_DATA
431 case p.IsIndex():
432 key.Type = pb.BackupKey_INDEX
433 case p.IsReverse():
434 key.Type = pb.BackupKey_REVERSE
435 case p.IsCount():
436 key.Type = pb.BackupKey_COUNT
437 case p.IsCountRev():
438 key.Type = pb.BackupKey_COUNT_REV
439 case p.IsSchema():
440 key.Type = pb.BackupKey_SCHEMA
441 case p.IsType():
442 key.Type = pb.BackupKey_TYPE
443 }
444
445 return &key
446}
447
448// FromBackupKey takes a key in the format used for backups and converts it to a key.
449func FromBackupKey(backupKey *pb.BackupKey) []byte {

Callers 2

toBackupKeyMethod · 0.80
processReqChMethod · 0.80

Calls 8

IsDataMethod · 0.95
IsIndexMethod · 0.95
IsReverseMethod · 0.95
IsCountMethod · 0.95
IsCountRevMethod · 0.95
IsSchemaMethod · 0.95
IsTypeMethod · 0.95
ParseNamespaceAttrFunction · 0.85

Tested by

no test coverage detected