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

Method DeleteRange

lib/datastore/rocksdb.go:102–117  ·  view source on GitHub ↗

DeleteRange is a method on RocksDbStore that deletes a range of log entries

(min, max uint64)

Source from the content-addressed store, hash-verified

100
101// DeleteRange is a method on RocksDbStore that deletes a range of log entries
102func (rds *RocksDbStore) DeleteRange(min, max uint64) error {
103 ro := gorocksdb.NewDefaultReadOptions()
104 wo := gorocksdb.NewDefaultWriteOptions()
105 wb := gorocksdb.NewWriteBatch()
106 defer func() {
107 ro.Destroy()
108 wo.Destroy()
109 wb.Destroy()
110 }()
111 wb.DeleteRange(uint64ToBytes(min), uint64ToBytes(max))
112 err := rds.conn.Write(wo, wb)
113 if err != nil {
114 return err
115 }
116 return nil
117}
118
119func (rds *RocksDbStore) Set(key []byte, val []byte) error {
120 if len(key) == 0 {

Callers

nothing calls this directly

Calls 3

uint64ToBytesFunction · 0.85
NewWriteBatchMethod · 0.80
WriteMethod · 0.65

Tested by

no test coverage detected