Documentation ¶
Index ¶
- Constants
- type API
- type File
- type Handler
- type KVHandler
- func (h *KVHandler) Commit() error
- func (h *KVHandler) Delete(key string, wOptions *api.WriteOptions) (*api.WriteMeta, error)
- func (h *KVHandler) DeleteKV(repo repository.Repo, prefix string) error
- func (h *KVHandler) DeleteTree(key string, wOptions *api.WriteOptions) (*api.WriteMeta, error)
- func (h *KVHandler) DeleteTreeKV(repo repository.Repo, prefix string) error
- func (h *KVHandler) HandleInit(repos []repository.Repo) error
- func (h *KVHandler) HandleUpdate(repo repository.Repo) error
- func (h *KVHandler) Put(kvPair *api.KVPair, wOptions *api.WriteOptions) (*api.WriteMeta, error)
- func (h *KVHandler) PutKV(repo repository.Repo, prefix string, value []byte) error
- func (h *KVHandler) UpdateToHead(repo repository.Repo) error
- type TextFile
- type TransactionIntegrityError
- type YAMLFile
Constants ¶
const ( SourceRootNotInPrefix = iota PathFormatterOK PathFormatterError )
Status codes for path formatting
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API interface { Get(string, *api.QueryOptions) (*api.KVPair, *api.QueryMeta, error) Put(*api.KVPair, *api.WriteOptions) (*api.WriteMeta, error) Txn(api.KVTxnOps, *api.QueryOptions) (bool, *api.KVTxnResponse, *api.QueryMeta, error) }
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.
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 ¶
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 ¶
Commit function executes set of operations from KVTxnOps as single transaction.
func (*KVHandler) DeleteKV ¶
func (h *KVHandler) DeleteKV(repo repository.Repo, prefix string) error
DeleteKV deletes provided item from the KV store.
func (*KVHandler) DeleteTree ¶
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) 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.
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.