etcd3

package
Version: v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(c *clientv3.Client, codec runtime.Codec, prefix string, transformer ValueTransformer) storage.Interface

New returns an etcd3 implementation of storage.Interface.

func NewWithNoQuorumRead

func NewWithNoQuorumRead(c *clientv3.Client, codec runtime.Codec, prefix string, transformer ValueTransformer) storage.Interface

NewWithNoQuorumRead returns etcd3 implementation of storage.Interface where Get operations don't require quorum read.

func StartCompactor

func StartCompactor(ctx context.Context, client *clientv3.Client)

StartCompactor starts a compactor in the background to compact old version of keys that's not needed. By default, we save the most recent 10 minutes data and compact versions > 10minutes ago. It should be enough for slow watchers and to tolerate burst. TODO: We might keep a longer history (12h) in the future once storage API can take advantage of past version of keys.

Types

type ValueTransformer

type ValueTransformer interface {
	// TransformFromStorage may transform the provided data from its underlying storage representation or return an error.
	// Stale is true if the object on disk is stale and a write to etcd should be issued, even if the contents of the object
	// have not changed.
	TransformFromStorage([]byte) (data []byte, stale bool, err error)
	// TransformToStorage may transform the provided data into the appropriate form in storage or return an error.
	TransformToStorage([]byte) (data []byte, err error)
}

ValueTransformer allows a string value to be transformed before being read from or written to the underlying store. The methods must be able to undo the transformation caused by the other.

var IdentityTransformer ValueTransformer = identityTransformer{}

IdentityTransformer performs no transformation on the provided values.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto