etcd

package
v0.2.8 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package etcd provides an implementation of state.State in etcd.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrAlreadyExists

func ErrAlreadyExists(r resource.Reference) error

ErrAlreadyExists generates error compatible with state.ErrConflict.

func ErrNotFound

func ErrNotFound(r resource.Pointer) error

ErrNotFound generates error compatible with state.ErrNotFound.

func ErrOwnerConflict

func ErrOwnerConflict(r resource.Reference, owner string) error

ErrOwnerConflict generates error compatible with state.ErrConflict.

func ErrPendingFinalizers

func ErrPendingFinalizers(r resource.Metadata) error

ErrPendingFinalizers generates error compatible with state.ErrConflict.

func ErrPhaseConflict

func ErrPhaseConflict(r resource.Reference, expectedPhase resource.Phase) error

ErrPhaseConflict generates error compatible with ErrConflict.

func ErrUnsupported

func ErrUnsupported(operation string) error

ErrUnsupported generates error compatible with state.ErrUnsupported.

func ErrVersionConflict

func ErrVersionConflict(r resource.Pointer, expected, found int64) error

ErrVersionConflict generates error compatible with state.ErrConflict.

Types

type Client

type Client interface {
	clientv3.KV
	clientv3.Watcher
}

Client is the etcd client interface required by this state implementation.

type State

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

State implements state.CoreState.

func NewState

func NewState(cli Client, marshaler store.Marshaler, opts ...StateOption) *State

NewState creates new State with default options.

func (*State) Create

func (st *State) Create(ctx context.Context, res resource.Resource, opts ...state.CreateOption) error

Create a resource.

func (*State) Destroy

func (st *State) Destroy(ctx context.Context, resourcePointer resource.Pointer, opts ...state.DestroyOption) error

Destroy a resource.

func (*State) Get

func (st *State) Get(ctx context.Context, resourcePointer resource.Pointer, opts ...state.GetOption) (resource.Resource, error)

Get a resource.

func (*State) List

func (st *State) List(ctx context.Context, resourceKind resource.Kind, opts ...state.ListOption) (resource.List, error)

List resources.

func (*State) Update

func (st *State) Update(ctx context.Context, res resource.Resource, opts ...state.UpdateOption) error

Update a resource.

func (*State) Watch

func (st *State) Watch(ctx context.Context, resourcePointer resource.Pointer, ch chan<- state.Event, opts ...state.WatchOption) error

Watch a resource.

func (*State) WatchKind

func (st *State) WatchKind(ctx context.Context, resourceKind resource.Kind, ch chan<- state.Event, opts ...state.WatchKindOption) error

WatchKind all resources by type.

func (*State) WatchKindAggregated added in v0.2.2

func (st *State) WatchKindAggregated(ctx context.Context, resourceKind resource.Kind, ch chan<- []state.Event, opts ...state.WatchKindOption) error

WatchKindAggregated all resources by type.

type StateOption

type StateOption func(options *StateOptions)

StateOption applies settings to StateOptions.

func WithKeyPrefix

func WithKeyPrefix(keyPrefix string) StateOption

WithKeyPrefix sets the global prefix to be used in the etcd keys for StateOptions. Defaults to "/cosi" if not specified.

func WithSalt

func WithSalt(salt []byte) StateOption

WithSalt sets the salt to be used in the etcd keys for StateOptions.

type StateOptions

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

StateOptions configure inmem.State.

func DefaultStateOptions

func DefaultStateOptions() StateOptions

DefaultStateOptions returns default value of StateOptions.

Jump to

Keyboard shortcuts

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