consul

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: GPL-3.0 Imports: 7 Imported by: 7

Documentation

Overview

Package consul is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Consulet

type Consulet struct {
	Client    *api.Client
	Config    *api.Config
	Connected bool
}

Consulet is a wrapper for interfacing with consul

func Default

func Default() (*Consulet, error)

Default will assume consul is running at localhost:8500

func New

func New(consulHost string, consulPort int) (*Consulet, error)

New allows for configuration of consul host + port

func (*Consulet) AddKeyValue

func (consul *Consulet) AddKeyValue(key string, value []byte) (err error)

TODO: should key value operations be atomic??? Can switch to use CAS

func (*Consulet) CreateNewSemaphore

func (consul *Consulet) CreateNewSemaphore(path string, limit int) (sema *api.Semaphore, err error)

func (*Consulet) Detail

func (consul *Consulet) Detail() string

func (*Consulet) GetKeyValue

func (consul *Consulet) GetKeyValue(key string) (pair *api.KVPair, err error)

GetKeyValue gets key/value at specified key

func (*Consulet) GetKeyValues

func (consul *Consulet) GetKeyValues(prefix string) (pairs api.KVPairs, err error)

GetKeyValue gets key/value list at specified prefix

func (*Consulet) GetKeys

func (consul *Consulet) GetKeys(prefix string) (keys []string, err error)

GetKeys uses consul default of separator ("/")

func (*Consulet) IsConnected

func (consul *Consulet) IsConnected() bool

func (*Consulet) RegisterService

func (consul *Consulet) RegisterService(addr string, port int, name string) (err error)

RegisterService registers a service at specified host, port, with name

func (*Consulet) RemoveService

func (consul *Consulet) RemoveService(name string) error

RemoveService removes a service by name

func (*Consulet) RemoveValue

func (consul *Consulet) RemoveValue(key string) (err error)

RemoveValue removes value at specified key

func (*Consulet) RemoveValues

func (consul *Consulet) RemoveValues(prefix string) (err error)

Remove values at specified prefix (like `consul kv delete -recurse /prefix`)

type Consuletty

type Consuletty interface {
	AddKeyValue(key string, value []byte) error
	RemoveValue(key string) error
	RemoveValues(prefix string) error
	GetKeys(prefix string) (keys []string, err error)
	GetKeyValue(key string) (*api.KVPair, error)
	GetKeyValues(prefix string) (api.KVPairs, error)
	RegisterService(addr string, port int, name string) error
	RemoveService(name string) error
	IsConnected() bool
	Detail() string
}

type MockConsuletty

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

MockConsuletty is a mock of Consuletty interface

func NewMockConsuletty

func NewMockConsuletty(ctrl *gomock.Controller) *MockConsuletty

NewMockConsuletty creates a new mock instance

func (*MockConsuletty) AddKeyValue

func (m *MockConsuletty) AddKeyValue(key string, value []byte) error

AddKeyValue mocks base method

func (*MockConsuletty) Detail

func (m *MockConsuletty) Detail() string

Detail mocks base method

func (*MockConsuletty) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockConsuletty) GetKeyValue

func (m *MockConsuletty) GetKeyValue(key string) (*api.KVPair, error)

GetKeyValue mocks base method

func (*MockConsuletty) GetKeyValues

func (m *MockConsuletty) GetKeyValues(prefix string) (api.KVPairs, error)

GetKeyValues mocks base method

func (*MockConsuletty) GetKeys

func (m *MockConsuletty) GetKeys(prefix string) ([]string, error)

GetKeys mocks base method

func (*MockConsuletty) IsConnected

func (m *MockConsuletty) IsConnected() bool

IsConnected mocks base method

func (*MockConsuletty) RegisterService

func (m *MockConsuletty) RegisterService(addr string, port int, name string) error

RegisterService mocks base method

func (*MockConsuletty) RemoveService

func (m *MockConsuletty) RemoveService(name string) error

RemoveService mocks base method

func (*MockConsuletty) RemoveValue

func (m *MockConsuletty) RemoveValue(key string) error

RemoveValue mocks base method

func (*MockConsuletty) RemoveValues

func (m *MockConsuletty) RemoveValues(prefix string) error

RemoveValues mocks base method

type MockConsulettyMockRecorder

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

MockConsulettyMockRecorder is the mock recorder for MockConsuletty

func (*MockConsulettyMockRecorder) AddKeyValue

func (mr *MockConsulettyMockRecorder) AddKeyValue(key, value interface{}) *gomock.Call

AddKeyValue indicates an expected call of AddKeyValue

func (*MockConsulettyMockRecorder) Detail

func (mr *MockConsulettyMockRecorder) Detail() *gomock.Call

Detail indicates an expected call of Detail

func (*MockConsulettyMockRecorder) GetKeyValue

func (mr *MockConsulettyMockRecorder) GetKeyValue(key interface{}) *gomock.Call

GetKeyValue indicates an expected call of GetKeyValue

func (*MockConsulettyMockRecorder) GetKeyValues

func (mr *MockConsulettyMockRecorder) GetKeyValues(prefix interface{}) *gomock.Call

GetKeyValues indicates an expected call of GetKeyValues

func (*MockConsulettyMockRecorder) GetKeys

func (mr *MockConsulettyMockRecorder) GetKeys(prefix interface{}) *gomock.Call

GetKeys indicates an expected call of GetKeys

func (*MockConsulettyMockRecorder) IsConnected

func (mr *MockConsulettyMockRecorder) IsConnected() *gomock.Call

IsConnected indicates an expected call of IsConnected

func (*MockConsulettyMockRecorder) RegisterService

func (mr *MockConsulettyMockRecorder) RegisterService(addr, port, name interface{}) *gomock.Call

RegisterService indicates an expected call of RegisterService

func (*MockConsulettyMockRecorder) RemoveService

func (mr *MockConsulettyMockRecorder) RemoveService(name interface{}) *gomock.Call

RemoveService indicates an expected call of RemoveService

func (*MockConsulettyMockRecorder) RemoveValue

func (mr *MockConsulettyMockRecorder) RemoveValue(key interface{}) *gomock.Call

RemoveValue indicates an expected call of RemoveValue

func (*MockConsulettyMockRecorder) RemoveValues

func (mr *MockConsulettyMockRecorder) RemoveValues(prefix interface{}) *gomock.Call

RemoveValues indicates an expected call of RemoveValues

Jump to

Keyboard shortcuts

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