NewLogRocksDbStorage is a function that creates a new RocksDB store It takes a configuration map as input and returns a raft.LogStore and an error
(conf config.Config)
| 19 | // NewLogRocksDbStorage is a function that creates a new RocksDB store |
| 20 | // It takes a configuration map as input and returns a raft.LogStore and an error |
| 21 | func NewLogRocksDbStorage(conf config.Config) (DataStore, error) { |
| 22 | filename := conf.LogDataStoragePath |
| 23 | options := gorocksdb.NewDefaultOptions() |
| 24 | options.SetCreateIfMissing(true) |
| 25 | db, err := gorocksdb.OpenDb(options, filename) |
| 26 | if err != nil { |
| 27 | return nil, err |
| 28 | } |
| 29 | b := &RocksDbStore{ |
| 30 | conn: db, |
| 31 | } |
| 32 | |
| 33 | return b, nil |
| 34 | } |
| 35 | |
| 36 | // FirstIndex is a method on RocksDbStore that returns the first index in the log |
| 37 | func (rds *RocksDbStore) FirstIndex() (uint64, error) { |
no outgoing calls