MCPcopy
hub / github.com/hashicorp/go-memdb / NewMemDB

Function NewMemDB

memdb.go:39–56  ·  view source on GitHub ↗

NewMemDB creates a new MemDB with the given schema.

(schema *DBSchema)

Source from the content-addressed store, hash-verified

37
38// NewMemDB creates a new MemDB with the given schema.
39func NewMemDB(schema *DBSchema) (*MemDB, error) {
40 // Validate the schema
41 if err := schema.Validate(); err != nil {
42 return nil, err
43 }
44
45 // Create the MemDB
46 db := &MemDB{
47 schema: schema,
48 root: unsafe.Pointer(iradix.New()),
49 primary: true,
50 }
51 if err := db.initialize(); err != nil {
52 return nil, err
53 }
54
55 return db, nil
56}
57
58// DBSchema returns schema in use for introspection.
59//

Callers 9

TestMemDB_IsolationFunction · 0.85
testDBFunction · 0.85
TestTxn_ChangesFunction · 0.85
TestTxn_GetIterAndDeleteFunction · 0.85
TestMemDB_SnapshotFunction · 0.85
testComplexDBFunction · 0.85

Calls 2

initializeMethod · 0.95
ValidateMethod · 0.45

Tested by 9

TestMemDB_IsolationFunction · 0.68
testDBFunction · 0.68
TestTxn_ChangesFunction · 0.68
TestTxn_GetIterAndDeleteFunction · 0.68
TestMemDB_SnapshotFunction · 0.68
testComplexDBFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…