conman

package module
v0.0.0-...-fe83cb9 Latest Latest
Warning

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

Go to latest
Published: May 7, 2019 License: MIT Imports: 8 Imported by: 0

README

conman

CONfiguration MANager backed by ETCD

Documentation

Index

Constants

View Source
const SettingUpdateQueueSize = 50

SettingUpdateQueueSize is the watch channel buffer size

Variables

View Source
var ErrAlreadyWatchingGivenKey = errors.New("Already watching given key")

ErrAlreadyWatchingGivenKey :- Method / Function / Functionality no implemented

View Source
var ErrNotImplemented = errors.New("Method / Function / Functionality no implemented")

ErrNotImplemented :- Method / Function / Functionality no implemented

Functions

This section is empty.

Types

type ConfigProvider

type ConfigProvider interface {
	Subscribe(ctx context.Context, prefix string, tag interface{}) (<-chan *SettingUpdate, error)
}

ConfigProvider exposes a set of functionality that are expected out of a typical configuration provider

type EtcdConnDetails

type EtcdConnDetails struct {
	Endpoint  string
	TLSConfig *transport.TLSInfo
}

EtcdConnDetails represents etcd connection details

type EtcdWrapper

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

EtcdWrapper is wrapper written over standard etcd-v3 client

func NewEtcd

func NewEtcd(e EtcdConnDetails) (*EtcdWrapper, error)

NewEtcd connects and initializes new etcd client wrapper

func (*EtcdWrapper) Subscribe

func (e *EtcdWrapper) Subscribe(ctx context.Context, prefix string, tag interface{}) (<-chan *SettingUpdate, error)

Subscribe takes a prefix and watches under that prefix for any change, if somethings changes it will push that settingUpdate in the returned channel along with the tag. Tag is for book keeping. Cancling the context will unsubscribe, it is necessary to do so otherwise it may cause memory leaks

type SettingUpdate

type SettingUpdate struct {
	Key         string
	RelativeKey string
	Value       string
	Tag         interface{}
	Kind        SettingUpdateKind
}

SettingUpdate represents a setting change that happened on etcd end

type SettingUpdateKind

type SettingUpdateKind int

SettingUpdateKind is constant representing kind of update

const (
	// SettingKindUnknown indicates that current setting update kind is not known
	SettingKindUnknown SettingUpdateKind = 0 + iota

	// SettingKindInitial indicates that setting update was part fetched as part of initial pull
	SettingKindInitial

	// SettingKindPut indicates that setting update represents a created / updated operation
	SettingKindPut

	// SettingKindDeleted indicates that current setting was part of a delete operation
	SettingKindDeleted
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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