forked from etcd-io/etcd
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce Kubernetes KV interface to etcd client
Signed-off-by: Marek Siarkowicz <[email protected]>
- Loading branch information
Showing
11 changed files
with
314 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
package kubernetes | ||
|
||
import ( | ||
"context" | ||
|
||
"go.etcd.io/etcd/api/v3/mvccpb" | ||
clientv3 "go.etcd.io/etcd/client/v3" | ||
) | ||
|
||
type Interface interface { | ||
Get(ctx context.Context, key string, opts GetOptions) (GetResponse, error) | ||
List(ctx context.Context, prefix string, opts ListOptions) (ListResponse, error) | ||
Count(ctx context.Context, prefix string) (int64, error) | ||
OptimisticPut(ctx context.Context, key string, value []byte, opts PutOptions) (PutResponse, error) | ||
OptimisticDelete(ctx context.Context, key string, opts DeleteOptions) (DeleteResponse, error) | ||
} | ||
|
||
type GetOptions struct { | ||
Revision int64 | ||
} | ||
|
||
type ListOptions struct { | ||
Revision int64 | ||
Limit int64 | ||
Continue string | ||
} | ||
|
||
type PutOptions struct { | ||
ExpectedRevision int64 | ||
GetOnFailure bool | ||
// LeaseID | ||
// Deprecated: Should be replaced with TTL when Interface starts using one lease per object. | ||
LeaseID clientv3.LeaseID | ||
} | ||
|
||
type DeleteOptions struct { | ||
ExpectedRevision int64 | ||
GetOnFailure bool | ||
} | ||
|
||
type GetResponse struct { | ||
KV *mvccpb.KeyValue | ||
Revision int64 | ||
} | ||
|
||
type ListResponse struct { | ||
KVs []*mvccpb.KeyValue | ||
Count int64 | ||
Revision int64 | ||
} | ||
|
||
type PutResponse struct { | ||
KV *mvccpb.KeyValue | ||
Succeeded bool | ||
Revision int64 | ||
} | ||
|
||
type DeleteResponse struct { | ||
KV *mvccpb.KeyValue | ||
Succeeded bool | ||
Revision int64 | ||
} |
Oops, something went wrong.