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

Method GetLog

lib/datastore/rocksdb.go:55–68  ·  view source on GitHub ↗

GetLog is a method on RocksDbStore that retrieves a log entry by its index

(index uint64, log *raft.Log)

Source from the content-addressed store, hash-verified

53
54// GetLog is a method on RocksDbStore that retrieves a log entry by its index
55func (rds *RocksDbStore) GetLog(index uint64, log *raft.Log) error {
56 ro := gorocksdb.NewDefaultReadOptions()
57 defer ro.Destroy()
58
59 val, err := rds.conn.Get(ro, uint64ToBytes(index))
60 if err != nil {
61 return err
62 }
63 err = encoding.DecodeMessagePack(val.Data(), log)
64 if err != nil {
65 return err
66 }
67 return nil
68}
69
70// StoreLog is a method on RocksDbStore that stores a single log entry
71func (rds *RocksDbStore) StoreLog(log *raft.Log) error {

Callers

nothing calls this directly

Calls 3

DecodeMessagePackFunction · 0.92
uint64ToBytesFunction · 0.85
GetMethod · 0.65

Tested by

no test coverage detected