init is a method on BoltDbStore that initializes the BoltDB store It creates the necessary buckets if they don't exist
()
| 50 | // init is a method on BoltDbStore that initializes the BoltDB store |
| 51 | // It creates the necessary buckets if they don't exist |
| 52 | func (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 |
| 72 | func (ds *BoltDbStore) FirstIndex() (uint64, error) { |
no test coverage detected