mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
Merge pull request #3081 from xiang90/storage_fix
storage: fix small issues
This commit is contained in:
commit
eff67afc60
@ -44,6 +44,10 @@ type store struct {
|
||||
stopc chan struct{}
|
||||
}
|
||||
|
||||
func New(path string) KV {
|
||||
return newStore(path)
|
||||
}
|
||||
|
||||
func newStore(path string) *store {
|
||||
s := &store{
|
||||
b: backend.New(path, batchInterval, batchLimit),
|
||||
@ -285,7 +289,7 @@ func (s *store) rangeKeys(key, end []byte, limit, rangeRev int64) (kvs []storage
|
||||
log.Fatalf("storage: cannot unmarshal event: %v", err)
|
||||
}
|
||||
if e.Type == storagepb.PUT {
|
||||
kvs = append(kvs, e.Kv)
|
||||
kvs = append(kvs, *e.Kv)
|
||||
}
|
||||
if limit > 0 && len(kvs) >= int(limit) {
|
||||
break
|
||||
@ -309,7 +313,7 @@ func (s *store) put(key, value []byte, rev int64) {
|
||||
ver = ver + 1
|
||||
event := storagepb.Event{
|
||||
Type: storagepb.PUT,
|
||||
Kv: storagepb.KeyValue{
|
||||
Kv: &storagepb.KeyValue{
|
||||
Key: key,
|
||||
Value: value,
|
||||
CreateIndex: c,
|
||||
@ -388,7 +392,7 @@ func (s *store) delete(key []byte, mainrev int64) bool {
|
||||
|
||||
event := storagepb.Event{
|
||||
Type: storagepb.DELETE,
|
||||
Kv: storagepb.KeyValue{
|
||||
Kv: &storagepb.KeyValue{
|
||||
Key: key,
|
||||
},
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user