kv

package
v0.0.0-...-02502d4 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2019 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SourceRootNotInPrefix = iota
	PathFormatterOK
	PathFormatterError
)

Status codes for path formatting

Variables

This section is empty.

Functions

This section is empty.

Types

type API

API minimal Consul KV api implementation

type File

type File interface {
	Update(kv Handler, repo repository.Repo) error
	Create(kv Handler, repo repository.Repo) error
	Delete(kv Handler, repo repository.Repo) error
	GetPath() string
}

File interface to manipulate data from various types of files in the KV store.

func Init

func Init(path string, repo repository.Repo) File

Init initializes new instance of File interface based on it's extension.

type Handler

type Handler interface {
	PutKV(repository.Repo, string, []byte) error
	DeleteKV(repository.Repo, string) error
	DeleteTreeKV(repository.Repo, string) error
	HandleUpdate(repository.Repo) error
}

Handler interface for Key-Value store.

type KVHandler

type KVHandler struct {
	API
	api.KVTxnOps
	// contains filtered or unexported fields
}

KVHandler is used to manipulate the KV

func New

func New(config *config.ConsulConfig) (*KVHandler, error)

New creates new KV handler to manipulate the Consul VK

func (*KVHandler) Commit

func (h *KVHandler) Commit() error

Commit function executes set of operations from KVTxnOps as single transaction.

func (*KVHandler) Delete

func (h *KVHandler) Delete(key string, wOptions *api.WriteOptions) (*api.WriteMeta, error)

Delete overrides Consul API Delete function to add entry to KVTxnOps.

func (*KVHandler) DeleteKV

func (h *KVHandler) DeleteKV(repo repository.Repo, prefix string) error

DeleteKV deletes provided item from the KV store.

func (*KVHandler) DeleteTree

func (h *KVHandler) DeleteTree(key string, wOptions *api.WriteOptions) (*api.WriteMeta, error)

DeleteTree overrides Consul API DeleteTree function to add entry to KVTxnOps.

func (*KVHandler) DeleteTreeKV

func (h *KVHandler) DeleteTreeKV(repo repository.Repo, prefix string) error

DeleteTreeKV deletes recursively all the keys with given prefix.

func (*KVHandler) HandleInit

func (h *KVHandler) HandleInit(repos []repository.Repo) error

HandleInit handles initial fetching of the KV on start

func (*KVHandler) HandleUpdate

func (h *KVHandler) HandleUpdate(repo repository.Repo) error

HandleUpdate handles the update of a particular repository.

func (*KVHandler) Put

func (h *KVHandler) Put(kvPair *api.KVPair, wOptions *api.WriteOptions) (*api.WriteMeta, error)

Put overrides Consul API Put function to add entry to KVTxnOps.

func (*KVHandler) PutKV

func (h *KVHandler) PutKV(repo repository.Repo, prefix string, value []byte) error

PutKV triggers an KV api request to put data to the Consul.

func (*KVHandler) UpdateToHead

func (h *KVHandler) UpdateToHead(repo repository.Repo) error

UpdateToHead handles update to current HEAD comparing diffs against the KV.

type TextFile

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

TextFile structure

func (*TextFile) Create

func (f *TextFile) Create(kv Handler, repo repository.Repo) error

Create function creates the KV store entries based on the file content.

func (*TextFile) Delete

func (f *TextFile) Delete(kv Handler, repo repository.Repo) error

Delete removes the key-value pair from the KV store.

func (*TextFile) GetPath

func (f *TextFile) GetPath() string

GetPath returns the path to the file.

func (*TextFile) Update

func (f *TextFile) Update(kv Handler, repo repository.Repo) error

Update functions updates the KV store based on the file content.

type TransactionIntegrityError

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

TransactionIntegrityError implements error to handle any violation of transaction atomicity.

func (*TransactionIntegrityError) Error

func (e *TransactionIntegrityError) Error() string

type YAMLFile

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

YAMLFile structure

func (*YAMLFile) Create

func (f *YAMLFile) Create(kv Handler, repo repository.Repo) error

Create function creates the KV store entries based on the file content.

func (*YAMLFile) Delete

func (f *YAMLFile) Delete(kv Handler, repo repository.Repo) error

Delete removes the key-value pairs from the KV store under given prefix.

func (*YAMLFile) GetPath

func (f *YAMLFile) GetPath() string

GetPath returns the path to the file.

func (*YAMLFile) Update

func (f *YAMLFile) Update(kv Handler, repo repository.Repo) error

Update functions updates the KV store based on the file content.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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