MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / Open

Method Open

driver/hybriddb/db.go:48–70  ·  view source on GitHub ↗
(path string, cfg *config.Config)

Source from the content-addressed store, hash-verified

46}
47
48func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) {
49 if err := os.MkdirAll(path, fs.ModePerm); err != nil {
50 return nil, err
51 }
52
53 db := new(DB)
54 db.path = path
55 db.cfg = &cfg.LevelDB
56 db.config = DefaultConfig
57 db.stats = &Stats{
58 StartTime: time.Now(),
59 }
60
61 db.initOpts()
62
63 var err error
64 db.db, err = leveldb.OpenFile(db.path, db.opts)
65 if err != nil {
66 return nil, err
67 }
68
69 return db, nil
70}
71
72func (s Store) Repair(path string, cfg *config.Config) error {
73 db, err := leveldb.RecoverFile(path, newOptions(&cfg.LevelDB))

Callers 15

TestWriteBatch_RollbackFunction · 0.45
TestWriteBatch_CloseFunction · 0.45
TestWriteBatch_DataFunction · 0.45
TestIteratorFunction · 0.45
TestIterator_EmptyDBFunction · 0.45
TestIterator_CloseFunction · 0.45
TestDB_OpenFunction · 0.45
TestDB_PutGetFunction · 0.45

Calls 1

initOptsMethod · 0.45

Tested by 15

TestWriteBatch_RollbackFunction · 0.36
TestWriteBatch_CloseFunction · 0.36
TestWriteBatch_DataFunction · 0.36
TestIteratorFunction · 0.36
TestIterator_EmptyDBFunction · 0.36
TestIterator_CloseFunction · 0.36
TestDB_OpenFunction · 0.36
TestDB_PutGetFunction · 0.36