kvdb

package module
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

README

kvdb

GoDoc Build Status Go Report Card

kvdb provides a Go native library to store metadata using Distributed Key/Value stores (or common databases).

Its goal is to abstract common store operations (Get, Put, List, etc.) for multiple Key/Value store backends.

For example, you can easily implement a generic Leader Election algorithm on top of it (see the docker/leadership repository).

It is used by BitRainforest.

Examples of Usage

You can refer to Examples for a basic overview of the library.

Compatibility

A storage backend in kvdb implements (fully or partially) the Store interface.

Calls Consul Etcd Zookeeper Redis BoltDB DynamoDB
Put
Get
Delete
Exists
Watch
WatchTree
NewLock (Lock/Unlock)
List
DeleteTree
AtomicPut
AtomicDelete

Supported Versions

  • Consul versions >= 0.5.1 because it uses Sessions with Delete behavior for the use of TTLs (mimics zookeeper's Ephemeral node support), If you don't plan to use TTLs: you can use Consul version 0.4.0+.
  • Etcd versions >= 2.0 with APIv2 (deprecated) and >= 3.0 APIv3 (recommended).
  • Zookeeper versions >= 3.4.5.
  • Redis versions >= 3.2.6. Key space notification needs to be enabled to have access to Watch and Lock methods.
  • Boltdb and DynamoDB shouldn't be subject to any version dependencies.

Limitations

Distributed Key/Value stores often have different concepts for managing and formatting keys and their associated values. Even though kvdb tries to abstract those stores aiming for some consistency, in some cases it can't be applied easily.

Please refer to the docs/compatibility.md file to see what are the special cases for cross-backend compatibility.

Calls like WatchTree may return different events (or number of events) depending on the backend (for now, Etcd and Consul will likely return more events than Zookeeper that you should triage properly).

Security

Only Consul and etcd have support for secure communication, and you should build and provide your own config.TLS object to feed the client. Support is planned for zookeeper and redis.

Contributing

Want to contribute to kvdb? Take a look at the Contribution Guidelines.

The Maintainers.

Apache License Version 2.0

Documentation

Overview

Package kvdb Distributed Key/Value Store Abstraction Library written in Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddStore

func AddStore(backend store.Backend, init Initialize)

AddStore adds a new store backend to kvdb.

func NewStore

func NewStore(backend store.Backend, addrs []string, options *store.Config) (store.Store, error)

NewStore creates an instance of store.

Types

type Initialize

type Initialize func(addrs []string, options *store.Config) (store.Store, error)

Initialize creates a new Store object, initializing the client.

Directories

Path Synopsis
Package store contains KV store backends.
Package store contains KV store backends.
boltdb
Package boltdb contains the BoltDB store implementation.
Package boltdb contains the BoltDB store implementation.
consul
Package consul contains the Consul store implementation.
Package consul contains the Consul store implementation.
dynamodb
Package dynamodb contains the DynamoDB store implementation.
Package dynamodb contains the DynamoDB store implementation.
etcd/v2
Package etcd contains the etcd v2 store implementation.
Package etcd contains the etcd v2 store implementation.
etcd/v3
Package etcdv3 contains the etcd v3 store implementation.
Package etcdv3 contains the etcd v3 store implementation.
mock
Package mock Mocks all Store functions using testify.Mock.
Package mock Mocks all Store functions using testify.Mock.
redis
Package redis contains the Redis store implementation.
Package redis contains the Redis store implementation.
zookeeper
Package zookeeper contains the ZooKeeper store implementation.
Package zookeeper contains the ZooKeeper store implementation.
Package testutils test helpers.
Package testutils test helpers.

Jump to

Keyboard shortcuts

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