etcdbk

package
v4.0.0-rc.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package etcdbk implements Etcd powered backend

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetName

func GetName() string

GetName returns the name of etcd backend as it appears in 'storage/type' section in Teleport YAML file. This function is a part of backend API

Types

type Config added in v1.0.0

type Config struct {
	Nodes       []string `json:"peers,omitempty"`
	Key         string   `json:"prefix,omitempty"`
	TLSKeyFile  string   `json:"tls_key_file,omitempty"`
	TLSCertFile string   `json:"tls_cert_file,omitempty"`
	TLSCAFile   string   `json:"tls_ca_file,omitempty"`
	Insecure    bool     `json:"insecure,omitempty"`
	// BufferSize is a default buffer size
	// used to pull events
	BufferSize int `json:"buffer_size,omitempty"`
	// DialTimeout specifies dial timeout
	DialTimeout time.Duration `json:"dial_timeout,omitempty"`
}

Config represents JSON config for etcd backend

func (*Config) Validate

func (cfg *Config) Validate() error

Validate checks if all the parameters are present/valid

type EtcdBackend

type EtcdBackend struct {
	*log.Entry
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, params backend.Params) (*EtcdBackend, error)

New returns new instance of Etcd-powered backend

func (*EtcdBackend) Clock

func (b *EtcdBackend) Clock() clockwork.Clock

func (*EtcdBackend) Close

func (b *EtcdBackend) Close() error

func (*EtcdBackend) CloseWatchers

func (b *EtcdBackend) CloseWatchers()

CloseWatchers closes all the watchers without closing the backend

func (*EtcdBackend) CompareAndSwap

func (b *EtcdBackend) CompareAndSwap(ctx context.Context, expected backend.Item, replaceWith backend.Item) (*backend.Lease, error)

CompareAndSwap compares item with existing item and replaces is with replaceWith item

func (*EtcdBackend) Create

func (b *EtcdBackend) Create(ctx context.Context, item backend.Item) (*backend.Lease, error)

Create creates item if it does not exist

func (*EtcdBackend) Delete

func (b *EtcdBackend) Delete(ctx context.Context, key []byte) error

Delete deletes item by key

func (*EtcdBackend) DeleteRange

func (b *EtcdBackend) DeleteRange(ctx context.Context, startKey, endKey []byte) error

DeleteRange deletes range of items with keys between startKey and endKey

func (*EtcdBackend) Get

func (b *EtcdBackend) Get(ctx context.Context, key []byte) (*backend.Item, error)

Get returns a single item or not found error

func (*EtcdBackend) GetRange

func (b *EtcdBackend) GetRange(ctx context.Context, startKey, endKey []byte, limit int) (*backend.GetResult, error)

GetRange returns query range

func (*EtcdBackend) KeepAlive

func (b *EtcdBackend) KeepAlive(ctx context.Context, lease backend.Lease, expires time.Time) error

KeepAlive updates TTL on the lease ID

func (*EtcdBackend) NewWatcher

func (b *EtcdBackend) NewWatcher(ctx context.Context, watch backend.Watch) (backend.Watcher, error)

NewWatcher returns a new event watcher

func (*EtcdBackend) Put

func (b *EtcdBackend) Put(ctx context.Context, item backend.Item) (*backend.Lease, error)

Put puts value into backend (creates if it does not exists, updates it otherwise)

func (*EtcdBackend) Update

func (b *EtcdBackend) Update(ctx context.Context, item backend.Item) (*backend.Lease, error)

Update updates value in the backend

Jump to

Keyboard shortcuts

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