kv

package
v0.0.0-...-5c345c6 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2016 License: MIT Imports: 17 Imported by: 0

README

kv

kv

Usage

type Config
type Config struct {
	*provider.Config
}

Config holds all configuration for the provider.

func NewConfig
func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) Address
func (c *Config) Address() (string, error)

Address returns the configured address of the consul kv server.

func (*Config) LoadConfig
func (c *Config) LoadConfig() error

LoadConfig loads and validates the KV provider config.

func (*Config) Validate
func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type Cookie struct {
	Cookie uint64 `json:"cookie"`
}

Cookie holds a unique value that is used as a reference to server side storage.

type DeleteArgs
type DeleteArgs struct {
	Key       string `json:"key"`
	Recursive bool   `json:"recursive"`
}

DeleteArgs specify the arguments to the "kv-delete" endpoint.

type EphemeralDestroyArgs
type EphemeralDestroyArgs struct {
	Key string `json:"key"`
}

EphemeralDestroyArgs specifies the arguments to the "kv-ephemeral-destroy" endpoint.

type EphemeralSetArgs
type EphemeralSetArgs struct {
	Key   string        `json:"key"`
	Value string        `json:"value"`
	TTL   time.Duration `json:"ttl"`
}

EphemeralSetArgs specifies the arguments to the "kv-ephemeral-set" endpoint.

type Event
type Event struct {
	kv.Event
	Error error
}

Event specifies structure describing events that took place on watched prefixes.

type GetArgs
type GetArgs struct {
	Key string `json:"key"`
}

GetArgs specify the arguments to the "kv-get" endpoint.

type KV
type KV struct {
}

KV is a provider of kv functionality.

func New
func New(config *Config, tracker *acomm.Tracker) (*KV, error)

New creates a new instance of KV.

func (*KV) RegisterTasks
func (k *KV) RegisterTasks(server *provider.Server)

RegisterTasks registers all of KV's task handlers with the server.

type LockArgs
type LockArgs struct {
	Key string        `json:"key"`
	TTL time.Duration `json:"ttl"`
}

LockArgs specifies the arguments to the "kv-lock" endpoint.

type Mock
type Mock struct {
	*KV
}

Mock is a mock KV provider

func NewMock
func NewMock(config *provider.Config, tracker *acomm.Tracker) (*Mock, error)

NewMock starts up a kv backend server and instantiates a new kv.KV provider. The kv backend is started on the port provided as part of config.Address(). Mock.Stop() should be called when testing is done in order to clean up.

func (*Mock) Clean
func (m *Mock) Clean(prefix string) error

Clean will perform a recursive Delete operation directly on the kv store.

func (*Mock) Get
func (m *Mock) Get(key string) (Value, error)

Get will perform a Get operation directly on the kv store.

func (*Mock) Set
func (m *Mock) Set(key, value string) error

Set will perform a Set operation directly on the kv store.

func (*Mock) Stop
func (m *Mock) Stop()

Stop will stop the kv and remove the temporary directory used for it's data

type RemoveArgs
type RemoveArgs struct {
	Key   string `json:"key"`
	Index uint64 `json:"index"`
}

RemoveArgs specifies the arguments to the "kv-remove" endpoint.

type SetArgs
type SetArgs struct {
	Key  string `json:"key"`
	Data string `json:"string"`
}

SetArgs specify the arguments to the "kv-set" endpoint.

type UpdateArgs
type UpdateArgs struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Index uint64 `json:"index"`
}

UpdateArgs specifies the arguments to the "kv-update" endpoint.

type UpdateReturn
type UpdateReturn struct {
	Index uint64 `json:"index"`
}

UpdateReturn specifies the return value from the "kv-update" endpoint.

type Value
type Value kv.Value

Value represents the value stored in a key, including the last modification index of the key

type WatchArgs
type WatchArgs struct {
	Prefix string `json:"prefix"`
	Index  uint64 `json:"index"`
}

WatchArgs specify the arguments to the "kv-watch" endpoint.

-- Generated with godocdown

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*provider.Config
}

Config holds all configuration for the provider.

func NewConfig

func NewConfig(flagSet *pflag.FlagSet, v *viper.Viper) *Config

NewConfig creates a new instance of Config.

func (*Config) Address

func (c *Config) Address() (string, error)

Address returns the configured address of the consul kv server.

func (*Config) LoadConfig

func (c *Config) LoadConfig() error

LoadConfig loads and validates the KV provider config.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns whether the config is valid, containing necessary values.

type Cookie struct {
	Cookie uint64 `json:"cookie"`
}

Cookie holds a unique value that is used as a reference to server side storage.

type DeleteArgs

type DeleteArgs struct {
	Key       string `json:"key"`
	Recursive bool   `json:"recursive"`
}

DeleteArgs specify the arguments to the "kv-delete" endpoint.

type EphemeralDestroyArgs

type EphemeralDestroyArgs struct {
	Key string `json:"key"`
}

EphemeralDestroyArgs specifies the arguments to the "kv-ephemeral-destroy" endpoint.

type EphemeralSetArgs

type EphemeralSetArgs struct {
	Key   string        `json:"key"`
	Value string        `json:"value"`
	TTL   time.Duration `json:"ttl"`
}

EphemeralSetArgs specifies the arguments to the "kv-ephemeral-set" endpoint.

type Event

type Event struct {
	kv.Event
	Error error
}

Event specifies structure describing events that took place on watched prefixes.

type GetArgs

type GetArgs struct {
	Key string `json:"key"`
}

GetArgs specify the arguments to the "kv-get" endpoint.

type KV

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

KV is a provider of kv functionality.

func New

func New(config *Config, tracker *acomm.Tracker) (*KV, error)

New creates a new instance of KV.

func (*KV) RegisterTasks

func (k *KV) RegisterTasks(server *provider.Server)

RegisterTasks registers all of KV's task handlers with the server.

type LockArgs

type LockArgs struct {
	Key string        `json:"key"`
	TTL time.Duration `json:"ttl"`
}

LockArgs specifies the arguments to the "kv-lock" endpoint.

type Mock

type Mock struct {
	*KV
	// contains filtered or unexported fields
}

Mock is a mock KV provider

func NewMock

func NewMock(config *provider.Config, tracker *acomm.Tracker) (*Mock, error)

NewMock starts up a kv backend server and instantiates a new kv.KV provider. The kv backend is started on the port provided as part of config.Address(). Mock.Stop() should be called when testing is done in order to clean up.

func (*Mock) Clean

func (m *Mock) Clean(prefix string) error

Clean will perform a recursive Delete operation directly on the kv store.

func (*Mock) Get

func (m *Mock) Get(key string) (Value, error)

Get will perform a Get operation directly on the kv store.

func (*Mock) Set

func (m *Mock) Set(key, value string) error

Set will perform a Set operation directly on the kv store.

func (*Mock) Stop

func (m *Mock) Stop()

Stop will stop the kv and remove the temporary directory used for it's data

type RemoveArgs

type RemoveArgs struct {
	Key   string `json:"key"`
	Index uint64 `json:"index"`
}

RemoveArgs specifies the arguments to the "kv-remove" endpoint.

type SetArgs

type SetArgs struct {
	Key  string `json:"key"`
	Data string `json:"string"`
}

SetArgs specify the arguments to the "kv-set" endpoint.

type UpdateArgs

type UpdateArgs struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Index uint64 `json:"index"`
}

UpdateArgs specifies the arguments to the "kv-update" endpoint.

type UpdateReturn

type UpdateReturn struct {
	Index uint64 `json:"index"`
}

UpdateReturn specifies the return value from the "kv-update" endpoint.

type Value

type Value kv.Value

Value represents the value stored in a key, including the last modification index of the key

type WatchArgs

type WatchArgs struct {
	Prefix string `json:"prefix"`
	Index  uint64 `json:"index"`
}

WatchArgs specify the arguments to the "kv-watch" endpoint.

Jump to

Keyboard shortcuts

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