mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
proxy: implement compaction
This commit is contained in:
parent
83d9ce3d7c
commit
f28a87d835
@ -81,6 +81,20 @@ func (p *kvProxy) Txn(ctx context.Context, r *pb.TxnRequest) (*pb.TxnResponse, e
|
||||
return (*pb.TxnResponse)(resp), err
|
||||
}
|
||||
|
||||
func (p *kvProxy) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error) {
|
||||
var opts []clientv3.CompactOption
|
||||
if r.Physical {
|
||||
opts = append(opts, clientv3.WithCompactPhysical())
|
||||
}
|
||||
|
||||
resp, err := p.c.KV.Compact(ctx, r.Revision, opts...)
|
||||
if err == nil {
|
||||
p.cache.Compact(r.Revision)
|
||||
}
|
||||
|
||||
return (*pb.CompactionResponse)(resp), err
|
||||
}
|
||||
|
||||
func (p *kvProxy) Close() error {
|
||||
return p.c.Close()
|
||||
}
|
||||
@ -137,7 +151,3 @@ func DelRequestToOp(r *pb.DeleteRangeRequest) clientv3.Op {
|
||||
|
||||
return clientv3.OpDelete(string(r.Key), opts...)
|
||||
}
|
||||
|
||||
func (p *kvProxy) Compact(ctx context.Context, r *pb.CompactionRequest) (*pb.CompactionResponse, error) {
|
||||
panic("unimplemented")
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user