etcdclient.go 858 B

12345678910111213141516171819202122
  1. //go:generate mockgen -package internal -destination etcdclient_mock.go -source etcdclient.go EtcdClient
  2. package internal
  3. import (
  4. "context"
  5. "go.etcd.io/etcd/clientv3"
  6. "google.golang.org/grpc"
  7. )
  8. type EtcdClient interface {
  9. ActiveConnection() *grpc.ClientConn
  10. Close() error
  11. Ctx() context.Context
  12. Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)
  13. Grant(ctx context.Context, ttl int64) (*clientv3.LeaseGrantResponse, error)
  14. KeepAlive(ctx context.Context, id clientv3.LeaseID) (<-chan *clientv3.LeaseKeepAliveResponse, error)
  15. Put(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)
  16. Revoke(ctx context.Context, id clientv3.LeaseID) (*clientv3.LeaseRevokeResponse, error)
  17. Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan
  18. }