mirror of
https://github.com/talent-plan/tinykv.git
synced 2024-12-27 13:20:24 +08:00
8aa0fa7768
Signed-off-by: Connor1996 <zbk602423539@gmail.com>
23 lines
717 B
Go
23 lines
717 B
Go
package storage
|
|
|
|
import (
|
|
"github.com/pingcap-incubator/tinykv/kv/util/engine_util"
|
|
"github.com/pingcap-incubator/tinykv/proto/pkg/kvrpcpb"
|
|
)
|
|
|
|
// Storage represents the internal-facing server part of TinyKV, it handles sending and receiving from other
|
|
// TinyKV nodes. As part of that responsibility, it also reads and writes data to disk (or semi-permanent memory).
|
|
type Storage interface {
|
|
Start() error
|
|
Stop() error
|
|
Write(ctx *kvrpcpb.Context, batch []Modify) error
|
|
Reader(ctx *kvrpcpb.Context) (StorageReader, error)
|
|
}
|
|
|
|
type StorageReader interface {
|
|
// When the key doesn't exist, return nil for the value
|
|
GetCF(cf string, key []byte) ([]byte, error)
|
|
IterCF(cf string) engine_util.DBIterator
|
|
Close()
|
|
}
|