etcd

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2020 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Addon

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

Addon implements etcd storage for Addon entities.

func NewAddon

func NewAddon(cli clientv3.KV) (*Addon, error)

NewAddon creates new storage for Addons

func (*Addon) FindAll

func (s *Addon) FindAll(namespace internal.Namespace) ([]*internal.Addon, error)

FindAll returns all objects from storage.

func (*Addon) Get

func (s *Addon) Get(namespace internal.Namespace, name internal.AddonName, ver semver.Version) (*internal.Addon, error)

Get returns object from storage.

func (*Addon) GetByID

func (s *Addon) GetByID(namespace internal.Namespace, id internal.AddonID) (*internal.Addon, error)

GetByID returns object by primary ID from storage.

func (*Addon) Remove

func (s *Addon) Remove(namespace internal.Namespace, name internal.AddonName, ver semver.Version) error

Remove removes object from storage.

func (*Addon) RemoveAll

func (s *Addon) RemoveAll(namespace internal.Namespace) error

RemoveAll removes all addons from storage for a given namespace.

func (*Addon) RemoveByID

func (s *Addon) RemoveByID(namespace internal.Namespace, id internal.AddonID) error

RemoveByID is removing object by primary ID from storage.

func (*Addon) Upsert

func (s *Addon) Upsert(namespace internal.Namespace, b *internal.Addon) (bool, error)

Upsert persists object in storage.

If addon already exists in storage than full replace is performed.

True is returned if object already existed in storage and was replaced.

type BindOperation added in v1.1.0

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

BindOperation implements in-memory storage InstanceOperation.

func NewBindOperation added in v1.1.0

func NewBindOperation(cli clientv3.KV) (*BindOperation, error)

NewBindOperation returns new instance of BindOperation storage.

func (*BindOperation) Get added in v1.1.0

Get returns object from storage.

func (*BindOperation) GetAll added in v1.1.0

GetAll returns all objects from storage for a given Instance ID

func (*BindOperation) Insert added in v1.1.0

func (s *BindOperation) Insert(bo *internal.BindOperation) error

Insert inserts object into storage.

func (*BindOperation) Remove added in v1.1.0

Remove removes object from storage.

func (*BindOperation) UpdateState added in v1.1.0

UpdateState modifies state on object in storage.

func (*BindOperation) UpdateStateDesc added in v1.1.0

func (s *BindOperation) UpdateStateDesc(iID internal.InstanceID, bID internal.BindingID, opID internal.OperationID, state internal.OperationState, desc *string) error

UpdateStateDesc updates both state and description for single operation. If desc is nil than description will be removed.

func (*BindOperation) WithTimeProvider added in v1.1.0

func (s *BindOperation) WithTimeProvider(nowProvider func() time.Time) *BindOperation

WithTimeProvider allows for passing custom time provider. Used mostly in testing.

type Chart

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

Chart provides storage operations on Chart entity

func NewChart

func NewChart(cli clientv3.KV) (*Chart, error)

NewChart creates new storage for Charts

func (*Chart) Get

func (s *Chart) Get(namespace internal.Namespace, name internal.ChartName, ver semver.Version) (*chart.Chart, error)

Get returns chart with given name and version from storage

func (*Chart) Remove

func (s *Chart) Remove(namespace internal.Namespace, name internal.ChartName, ver semver.Version) error

Remove is removing chart with given name and version from storage

func (*Chart) Upsert

func (s *Chart) Upsert(namespace internal.Namespace, c *chart.Chart) (replaced bool, err error)

Upsert persists Chart in memory.

If chart already exists in storage then full replace is performed.

Replace is set to true if chart already existed in storage and was replaced.

type Client

type Client interface {
	clientv3.KV
}

Client wraps etcd client for testing purposes.

func NewClient

func NewClient(cfg Config) (Client, error)

NewClient produces new, configured etcd client.

type Config

type Config struct {
	Endpoints            []string `json:"endpoints"`
	Username             string   `json:"username"`
	Password             string   `json:"password"`
	DialTimeout          string   `json:"dialTimeout" default:"5s"`
	DialKeepAliveTime    string   `json:"dialKeepAliveTime" default:"2s"`
	DialKeepAliveTimeout string   `json:"dialKeepAliveTimeout" default:"5s"`

	ForceClient *clientv3.Client
}

Config holds configuration for etcd access in storage.

type Instance

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

Instance implements etcd based storage for Instance entities.

func NewInstance

func NewInstance(cli clientv3.KV) (*Instance, error)

NewInstance creates new Instances storage

func (*Instance) Get

Get returns object from storage.

func (*Instance) GetAll

func (s *Instance) GetAll() ([]*internal.Instance, error)

GetAll returns collection of Instance objects from storage

func (*Instance) Insert

func (s *Instance) Insert(i *internal.Instance) error

Insert inserts object to storage.

func (*Instance) Remove

func (s *Instance) Remove(id internal.InstanceID) error

Remove removing object from storage.

func (*Instance) Upsert added in v1.1.0

func (s *Instance) Upsert(i *internal.Instance) (replaced bool, err error)

Upsert persists Instance in memory.

If instance already exists in storage then full replace is performed.

Replace is set to true if instance already existed in storage and was replaced.

type InstanceOperation

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

InstanceOperation implements etcd based storage InstanceOperation.

func NewInstanceOperation

func NewInstanceOperation(cli clientv3.KV) (*InstanceOperation, error)

NewInstanceOperation returns new instance of InstanceOperation storage.

func (*InstanceOperation) Get

Get returns object from storage.

func (*InstanceOperation) GetAll

GetAll returns all objects from storage.

func (*InstanceOperation) Insert

Insert inserts object into storage.

func (*InstanceOperation) Remove

Remove removes object from storage.

func (*InstanceOperation) UpdateState

UpdateState modifies state on object in storage.

func (*InstanceOperation) UpdateStateDesc

func (s *InstanceOperation) UpdateStateDesc(iID internal.InstanceID, opID internal.OperationID, state internal.OperationState, desc *string) error

UpdateStateDesc modifies state and description on object in storage. If desc is nil than description will be removed.

func (*InstanceOperation) WithTimeProvider

func (s *InstanceOperation) WithTimeProvider(nowProvider func() time.Time) *InstanceOperation

WithTimeProvider allows for passing custom time provider. Used mostly in testing.

Jump to

Keyboard shortcuts

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