server: Extract hasher to separate interface

Signed-off-by: Marek Siarkowicz <siarkowicz@google.com>
This commit is contained in:
Marek Siarkowicz
2022-05-19 17:33:58 +02:00
parent 631107285a
commit 7358362c99
8 changed files with 64 additions and 39 deletions

View File

@@ -112,7 +112,6 @@ const (
type KV interface {
ReadView
WriteView
Hasher
// Read creates a read transaction.
Read(mode ReadTxMode, trace *traceutil.Trace) TxnRead
@@ -120,6 +119,9 @@ type KV interface {
// Write creates a write transaction.
Write(trace *traceutil.Trace) TxnWrite
// HashStorage returns HashStorage interface for KV storage.
HashStorage() HashStorage
// Compact frees all superseded keys with revisions less than rev.
Compact(trace *traceutil.Trace, rev int64) (<-chan struct{}, error)
@@ -131,14 +133,6 @@ type KV interface {
Close() error
}
type Hasher interface {
// Hash computes the hash of the KV's backend.
Hash() (hash uint32, revision int64, err error)
// HashByRev computes the hash of all MVCC revisions up to a given revision.
HashByRev(rev int64) (hash KeyValueHash, revision int64, err error)
}
// WatchableKV is a KV that can be watched.
type WatchableKV interface {
KV