client

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MediaTypeFromGR

func MediaTypeFromGR(gr schema.GroupResource) (mediaType string, err error)

MediaTypeFromGR returns the media type of the given GroupResource.

func PrefixFromGR

func PrefixFromGR(gr schema.GroupResource) (prefix string, err error)

PrefixFromGR returns the prefix of the given GroupResource.

Types

type Client

type Client interface {
	// Get is a method that retrieves a key-value pair from the etcd server.
	// It returns the revision of the key-value pair
	Get(ctx context.Context, prefix string, opOpts ...OpOption) (rev int64, err error)

	// Watch is a method that watches for changes to a key-value pair on the etcd server.
	Watch(ctx context.Context, prefix string, opOpts ...OpOption) error

	// Delete is a method that deletes a key-value pair from the etcd server.
	Delete(ctx context.Context, prefix string, opOpts ...OpOption) error

	// Put is a method that sets a key-value pair on the etcd server.
	Put(ctx context.Context, prefix string, value []byte, opOpts ...OpOption) error
}

Client is an interface that defines the operations that can be performed on an etcd client.

func NewClient

func NewClient(conf Config) (Client, error)

NewClient creates a new etcd client.

type Config

type Config = clientv3.Config

type KeyValue

type KeyValue struct {
	Key       []byte
	Value     []byte
	PrevValue []byte
}

KeyValue is the key-value pair.

type Op

type Op struct {
	// contains filtered or unexported fields
}

Op is the option for the operation.

type OpOption

type OpOption func(*Op)

OpOption is the option for the operation.

func WithGR

func WithGR(gr schema.GroupResource) OpOption

WithGR sets the gr for the target.

func WithKeysOnly

func WithKeysOnly() OpOption

WithKeysOnly sets the keys only for the target.

func WithName

func WithName(name, namespace string) OpOption

WithName sets the name and namespace for the target.

func WithPageLimit

func WithPageLimit(pageLimit int64) OpOption

WithPageLimit sets the page limit for the target.

func WithResponse

func WithResponse(response func(kv *KeyValue) error) OpOption

WithResponse sets the response callback for the target.

func WithRevision

func WithRevision(revision int64) OpOption

WithRevision sets the revision for the target.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL