MCPcopy Index your code
hub / github.com/dgraph-io/dgraph / openDgraph

Function openDgraph

testutil/backup.go:33–53  ·  view source on GitHub ↗
(pdir string)

Source from the content-addressed store, hash-verified

31var KeyFile string
32
33func openDgraph(pdir string) (*badger.DB, error) {
34 // Get key.
35 config := viper.New()
36 flags := &pflag.FlagSet{}
37 x.RegisterEncFlag(flags)
38 if err := config.BindPFlags(flags); err != nil {
39 return nil, err
40 }
41 config.Set("encryption", x.BuildEncFlag(KeyFile))
42 keys, err := x.GetEncAclKeys(config)
43 if err != nil {
44 return nil, err
45 }
46
47 opt := badger.DefaultOptions(pdir).
48 WithBlockCacheSize(10 * (1 << 20)).
49 WithIndexCacheSize(10 * (1 << 20)).
50 WithEncryptionKey(keys.EncKey).
51 WithNamespaceOffset(x.NamespaceOffset)
52 return badger.OpenManaged(opt)
53}
54
55func WaitForRestore(t *testing.T, dg *dgo.Dgraph, HttpSocket string) {
56 // Use a 10-minute overall deadline so the test fails quickly if the

Callers 2

GetPredicateValuesFunction · 0.85
readSchemaFunction · 0.85

Calls 4

RegisterEncFlagFunction · 0.92
BuildEncFlagFunction · 0.92
GetEncAclKeysFunction · 0.92
SetMethod · 0.65

Tested by

no test coverage detected