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

Function NewLogRocksDbStorage

lib/datastore/rocksdb.go:21–34  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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
21func 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
37func (rds *RocksDbStore) FirstIndex() (uint64, error) {

Callers 1

testRocksDbDatastoreFunction · 0.85

Calls

no outgoing calls

Tested by 1

testRocksDbDatastoreFunction · 0.68