mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
stroage: adopt KV interface
This commit is contained in:
parent
cbb8b9bb08
commit
69d02410cf
@ -24,11 +24,11 @@ type KV interface {
|
||||
|
||||
// TnxBegin begins a tnx. Only Tnx prefixed operation can be executed, others will be blocked
|
||||
// until tnx ends. Only one on-going tnx is allowed.
|
||||
TnxBegin()
|
||||
TnxBegin() int64
|
||||
// TnxEnd ends the on-going tnx.
|
||||
// TODO: generate and verify tnx id for safty.
|
||||
TnxEnd()
|
||||
TnxRange(key, end []byte, limit, rangeIndex int64) (kvs []storagepb.KeyValue, index int64)
|
||||
TnxPut(key, value []byte) (index int64)
|
||||
TnxDeleteRange(key, end []byte) (n, index int64)
|
||||
TnxEnd(tnxID int64) error
|
||||
TnxRange(tnxID int64, key, end []byte, limit, rangeIndex int64) (kvs []storagepb.KeyValue, index int64, err error)
|
||||
TnxPut(tnxID int64, key, value []byte) (index int64, err error)
|
||||
TnxDeleteRange(tnxID int64, key, end []byte) (n, index int64, err error)
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ type store struct {
|
||||
tnxID int64 // tracks the current tnxID to verify tnx operations
|
||||
}
|
||||
|
||||
func newStore(path string) *store {
|
||||
func newStore(path string) KV {
|
||||
s := &store{
|
||||
b: backend.New(path, batchInterval, batchLimit),
|
||||
kvindex: newTreeIndex(),
|
||||
|
Loading…
x
Reference in New Issue
Block a user