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

Method Open

driver/badger/store.go:27–50  ·  view source on GitHub ↗
(path string, cfg *config.Config)

Source from the content-addressed store, hash-verified

25}
26
27func (s Store) Open(path string, cfg *config.Config) (driver.IDB, error) {
28 db := new(DB)
29 db.cfg = cfg
30 db.opts = badger.DefaultOptions(path)
31 db.opts.MemTableSize = 1000 << 20
32 db.opts.NumGoroutines = 100
33 db.opts.MetricsEnabled = false
34 db.opts.Compression = options.ZSTD
35 db.opts.ZSTDCompressionLevel = 3
36 db.opts.IndexCacheSize = 1000 << 20
37 db.opts.DetectConflicts = false
38 db.opts.NumCompactors = 100
39 db.opts.NumMemtables = 100
40 db.opts.BlockCacheSize = 1000 << 20
41
42 db.iteratorOpts = badger.DefaultIteratorOptions
43 var err error
44 db.db, err = badger.Open(db.opts)
45 if err != nil {
46 return nil, err
47 }
48
49 return db, nil
50}
51
52func (s Store) Repair(path string, cfg *config.Config) error {
53 // Open database with default options

Callers 1

RepairMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected