handlers

package
v0.0.0-...-445c7d5 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EtcdEventStateToHandlerState

func EtcdEventStateToHandlerState(eventType mvccpb.Event_EventType, isCreate bool, isModify bool) string

EtcdEventStateToHandlerState convert Etcd client v3 event type to our own states.

func Get

func Get(handlerName string) (datastore.Store, error)

Get return a newly created datastore handler.

func NewETCD

func NewETCD() (datastore.Store, error)

NewETCD create new ETCD

func RegisterFlags

func RegisterFlags(cmd *cobra.Command)

RegisterFlags register flags using the function provided in flagRegisters var.

Types

type ETCD

type ETCD struct {
	datastore.Store
	// contains filtered or unexported fields
}

ETCD implementation of datastore.Store interface for ETCD.

func (*ETCD) Delete

func (st *ETCD) Delete(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.DeleteResponse, error)

Delete delete a key value pair.

func (*ETCD) Get

func (st *ETCD) Get(ctx context.Context, key string, opts ...clientv3.OpOption) (*clientv3.GetResponse, error)

Get return a specific key.

func (*ETCD) Put

func (st *ETCD) Put(ctx context.Context, key string, value string, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

Put set a key to a specific value.

func (*ETCD) PutTTL

func (st *ETCD) PutTTL(ctx context.Context, key string, value string, ttl int64, opts ...clientv3.OpOption) (*clientv3.PutResponse, error)

PutTTL set a key to a specific value with a TTL.

func (*ETCD) SetKeyPrefix

func (st *ETCD) SetKeyPrefix(prefix string)

SetKeyPrefix set the prefix to prefix all given keys with.

func (*ETCD) Watch

func (st *ETCD) Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan

Watch watch a key or directory for creation, changes and deletion.

type ETCDOptions

type ETCDOptions struct {
	CACert                string
	Cert                  string
	CommandTimeout        time.Duration
	Debug                 bool
	DialTimeout           time.Duration
	DiscoverySRV          string
	Endpoints             []string
	InsecureDiscovery     bool
	InsecureSkipTLSVerify bool
	InsecureTransport     bool
	KeepaliveTime         time.Duration
	KeepaliveTimeout      time.Duration
	Key                   string
	User                  string
}

ETCDOptions options for ETCD connection. Just the flags of `ETCDCTL_API=3 etcdctl` (etcdtctl version `3.3.8`, API version `3.3`) copied.

Jump to

Keyboard shortcuts

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