Documentation ¶
Index ¶
- type Client
- func (k Client) Count(ctx context.Context, prefix string, _ CountOptions) (int64, error)
- func (k Client) Get(ctx context.Context, key string, opts GetOptions) (resp GetResponse, err error)
- func (k Client) List(ctx context.Context, prefix string, opts ListOptions) (resp ListResponse, err error)
- func (k Client) OptimisticDelete(ctx context.Context, key string, expectedRevision int64, opts DeleteOptions) (resp DeleteResponse, err error)
- func (k Client) OptimisticPut(ctx context.Context, key string, value []byte, expectedRevision int64, ...) (resp PutResponse, err error)
- type CountOptions
- type DeleteOptions
- type DeleteResponse
- type GetOptions
- type GetResponse
- type Interface
- type ListOptions
- type ListResponse
- type PutOptions
- type PutResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
func New ¶
New creates Client from config. Caller is responsible to call Close() to clean up client.
func (Client) Get ¶
func (k Client) Get(ctx context.Context, key string, opts GetOptions) (resp GetResponse, err error)
func (Client) List ¶
func (k Client) List(ctx context.Context, prefix string, opts ListOptions) (resp ListResponse, err error)
func (Client) OptimisticDelete ¶
func (k Client) OptimisticDelete(ctx context.Context, key string, expectedRevision int64, opts DeleteOptions) (resp DeleteResponse, err error)
func (Client) OptimisticPut ¶
func (k Client) OptimisticPut(ctx context.Context, key string, value []byte, expectedRevision int64, opts PutOptions) (resp PutResponse, err error)
type CountOptions ¶
type CountOptions struct{}
CountOptions is a placeholder for potential future options for the Count operation.
type DeleteOptions ¶
type DeleteOptions struct { // GetOnFailure specifies whether to return the modified key-value pair if the Delete operation fails due to a revision mismatch. GetOnFailure bool }
type DeleteResponse ¶
type DeleteResponse struct { // KV is the deleted key-value pair. If the Delete operation failed and GetOnFailure was true, this // will be the modified key-value pair that caused the failure. KV *mvccpb.KeyValue // Succeeded indicates whether the Delete operation was successful. Succeeded bool // Revision is the revision of the key-value store after the Delete operation. Revision int64 }
type GetOptions ¶
type GetOptions struct { // Revision is the point-in-time of the etcd key-value store to use for the Get operation. // If Revision is 0, it gets the latest value. Revision int64 }
type GetResponse ¶
type Interface ¶
type Interface interface { // Get retrieves a single key-value pair from etcd. // // If opts.Revision is set to a non-zero value, the key-value pair is retrieved at the specified revision. // If the required revision has been compacted, the request will fail with ErrCompacted. Get(ctx context.Context, key string, opts GetOptions) (GetResponse, error) // List retrieves key-value pairs with the specified prefix, ordered lexicographically by key. // // If opts.Revision is non-zero, the key-value pairs are retrieved at the specified revision. // If the required revision has been compacted, the request will fail with ErrCompacted. // If opts.Limit is greater than zero, the number of returned key-value pairs is bounded by the limit. // If opts.Continue is not empty, the listing will start from the key immediately after the one specified by Continue. // The Continue value should be the last key returned in a previous paginated ListResponse. List(ctx context.Context, prefix string, opts ListOptions) (ListResponse, error) // Count returns the number of keys with the specified prefix. // // Currently, there are no options for the Count operation. However, a placeholder options struct (CountOptions) // is provided for future extensibility in case options become necessary. Count(ctx context.Context, prefix string, opts CountOptions) (int64, error) // OptimisticPut creates or updates a key-value pair if the key has not been modified or created // since the revision specified in expectedRevision. // // An OptimisticPut fails if the key has been modified since expectedRevision. OptimisticPut(ctx context.Context, key string, value []byte, expectedRevision int64, opts PutOptions) (PutResponse, error) // OptimisticDelete deletes the key-value pair if it hasn't been modified since the revision // specified in expectedRevision. // // An OptimisticDelete fails if the key has been modified since expectedRevision. OptimisticDelete(ctx context.Context, key string, expectedRevision int64, opts DeleteOptions) (DeleteResponse, error) }
Interface defines the minimal client-side interface that Kubernetes requires to interact with etcd. Methods below are standard etcd operations with semantics adjusted to better suit Kubernetes' needs.
type ListOptions ¶
type ListOptions struct { // Revision is the point-in-time of the etcd key-value store to use for the List operation. // If Revision is 0, it gets the latest values. Revision int64 // Limit is the maximum number of keys to return for a List operation. // 0 means no limitation. Limit int64 // Continue is a key from which to resume the List operation, excluding the given key. // It should be set to the last key from a previous ListResponse when paginating. Continue string }
type ListResponse ¶
type ListResponse struct { // Kvs is the list of key-value pairs retrieved from etcd, ordered lexicographically by key. Kvs []*mvccpb.KeyValue // Count is the total number of keys with the specified prefix, even if not all were returned due to a limit. Count int64 // Revision is the revision of the key-value store at the time of the List operation. Revision int64 }
type PutOptions ¶
type PutOptions struct { // GetOnFailure specifies whether to return the modified key-value pair if the Put operation fails due to a revision mismatch. GetOnFailure bool // LeaseID is the ID of a lease to associate with the key allowing for automatic deletion after lease expires after it's TTL (time to live). // Deprecated: Should be replaced with TTL when Interface starts using one lease per object. LeaseID clientv3.LeaseID }
type PutResponse ¶
type PutResponse struct { // KV is the created or updated key-value pair. If the Put operation failed and GetOnFailure was true, this // will be the modified key-value pair that caused the failure. KV *mvccpb.KeyValue // Succeeded indicates whether the Put operation was successful. Succeeded bool // Revision is the revision of the key-value store after the Put operation. Revision int64 }
Click to show internal directories.
Click to hide internal directories.