MCPcopy Create free account
hub / github.com/ByteStorage/FlyDB / init

Method init

lib/datastore/boltdb.go:52–69  ·  view source on GitHub ↗

init is a method on BoltDbStore that initializes the BoltDB store It creates the necessary buckets if they don't exist

()

Source from the content-addressed store, hash-verified

50// init is a method on BoltDbStore that initializes the BoltDB store
51// It creates the necessary buckets if they don't exist
52func (ds *BoltDbStore) init() error {
53 ds.mux.RLock()
54 defer ds.mux.RUnlock()
55 tx, err := ds.conn.Begin(true)
56 if err != nil {
57 return err
58 }
59 defer check(tx.Rollback)
60
61 // Create necessary buckets if they don't exist
62 if _, err := tx.CreateBucketIfNotExists(bucketLogs); err != nil {
63 return err
64 }
65 if _, err := tx.CreateBucketIfNotExists(bucketStable); err != nil {
66 return err
67 }
68 return tx.Commit()
69}
70
71// FirstIndex is a method on BoltDbStore that returns the first index in the log
72func (ds *BoltDbStore) FirstIndex() (uint64, error) {

Callers 1

NewLogBoltDbStorageFunction · 0.95

Calls 2

checkFunction · 0.85
CommitMethod · 0.80

Tested by

no test coverage detected