Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sudo: false

before_install:
# Symlink below is needed for Travis CI to work correctly on personal forks of libkv
- ln -s $HOME/gopath/src/github.com/${TRAVIS_REPO_SLUG///libkv/} $HOME/gopath/src/github.com/docker
- ln -s $HOME/gopath/src/github.com/${TRAVIS_REPO_SLUG///libkv/} $HOME/gopath/src/github.com/rpcxio
- go get golang.org/x/tools/cmd/cover
- go get github.com/mattn/goveralls
- go get github.com/golang/lint/golint
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# libkv

[![GoDoc](https://godoc.org/github.com/docker/libkv?status.png)](https://godoc.org/github.com/docker/libkv)
[![GoDoc](https://godoc.org/github.com/rpcxio/libkv?status.png)](https://godoc.org/github.com/docker/libkv)
[![Build Status](https://travis-ci.org/docker/libkv.svg?branch=master)](https://travis-ci.org/docker/libkv)
[![Coverage Status](https://coveralls.io/repos/docker/libkv/badge.svg)](https://coveralls.io/r/docker/libkv)
[![Go Report Card](https://goreportcard.com/badge/github.com/docker/libkv)](https://goreportcard.com/report/github.com/docker/libkv)
[![Go Report Card](https://goreportcard.com/badge/github.com/rpcxio/libkv)](https://goreportcard.com/report/github.com/docker/libkv)

`libkv` provides a `Go` native library to store metadata.

The goal of `libkv` is to abstract common store operations for multiple distributed and/or local Key/Value store backends.

For example, you can use it to store your metadata or for service discovery to register machines and endpoints inside your cluster.

You can also easily implement a generic *Leader Election* on top of it (see the [docker/leadership](https://github.com/docker/leadership) repository).
You can also easily implement a generic *Leader Election* on top of it (see the [docker/leadership](https://github.com/rpcxio/leadership) repository).

As of now, `libkv` offers support for `Consul`, `Etcd`, `Zookeeper` (**Distributed** store) and `BoltDB` (**Local** store).

Expand Down Expand Up @@ -100,7 +100,7 @@ Only `Consul` and `etcd` have support for TLS and you should build and provide y

## Contributing

Want to hack on libkv? [Docker's contributions guidelines](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) apply.
Want to hack on libkv? [Docker's contributions guidelines](https://github.com/rpcxio/docker/blob/master/CONTRIBUTING.md) apply.

## Copyright and license

Expand Down
6 changes: 3 additions & 3 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (
"time"
"log"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/store/consul"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
"github.com/rpcxio/libkv/store/consul"
)

func init() {
Expand Down
2 changes: 1 addition & 1 deletion libkv.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sort"
"strings"

"github.com/docker/libkv/store"
"github.com/rpcxio/libkv/store"
)

// Initialize creates a new Store object, initializing the client
Expand Down
2 changes: 1 addition & 1 deletion libkv_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"testing"
"time"

"github.com/docker/libkv/store"
"github.com/rpcxio/libkv/store"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion script/.validate
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ if [ -z "$VALIDATE_UPSTREAM" ]; then
# this is kind of an expensive check, so let's not do this twice if we
# are running more than one validate bundlescript

VALIDATE_REPO='https://github.com/docker/libkv.git'
VALIDATE_REPO='https://github.com/rpcxio/libkv.git'
VALIDATE_BRANCH='master'

if [ "$TRAVIS" = 'true' -a "$TRAVIS_PULL_REQUEST" != 'false' ]; then
Expand Down
4 changes: 2 additions & 2 deletions store/boltdb/boltdb.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"sync/atomic"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
bolt "go.etcd.io/bbolt"
)

Expand Down
6 changes: 3 additions & 3 deletions store/boltdb/boltdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/testutils"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
"github.com/rpcxio/libkv/testutils"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions store/consul/consul.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"sync"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
api "github.com/hashicorp/consul/api"
)

Expand Down
6 changes: 3 additions & 3 deletions store/consul/consul_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"testing"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/testutils"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
"github.com/rpcxio/libkv/testutils"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions store/etcd/etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import (
"time"

etcd "github.com/coreos/etcd/client"
"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions store/etcd/etcd_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"testing"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/testutils"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
"github.com/rpcxio/libkv/testutils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion store/mock/mock.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package mock

import (
"github.com/docker/libkv/store"
"github.com/rpcxio/libkv/store"
"github.com/stretchr/testify/mock"
)

Expand Down
14 changes: 9 additions & 5 deletions store/zookeeper/zookeeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"strings"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
zk "github.com/samuel/go-zookeeper/zk"
)

Expand Down Expand Up @@ -290,8 +290,12 @@ func (s *Zookeeper) DeleteTree(directory string) error {

// AtomicPut put a value at "key" if the key has not been
// modified in the meantime, throws an error if this is the case
func (s *Zookeeper) AtomicPut(key string, value []byte, previous *store.KVPair, _ *store.WriteOptions) (bool, *store.KVPair, error) {
func (s *Zookeeper) AtomicPut(key string, value []byte, previous *store.KVPair, opts *store.WriteOptions) (bool, *store.KVPair, error) {
var lastIndex uint64
var flag int32
if opts != nil && opts.TTL > 0 {
flag = zk.FlagEphemeral
}

if previous != nil {
meta, err := s.client.Set(s.normalize(key), value, int32(previous.LastIndex))
Expand All @@ -305,7 +309,7 @@ func (s *Zookeeper) AtomicPut(key string, value []byte, previous *store.KVPair,
lastIndex = uint64(meta.Version)
} else {
// Interpret previous == nil as create operation.
_, err := s.client.Create(s.normalize(key), value, 0, zk.WorldACL(zk.PermAll))
_, err := s.client.Create(s.normalize(key), value, flag, zk.WorldACL(zk.PermAll))
if err != nil {
// Directory does not exist
if err == zk.ErrNoNode {
Expand All @@ -319,7 +323,7 @@ func (s *Zookeeper) AtomicPut(key string, value []byte, previous *store.KVPair,
}

// Create the node
if _, err := s.client.Create(s.normalize(key), value, 0, zk.WorldACL(zk.PermAll)); err != nil {
if _, err := s.client.Create(s.normalize(key), value, flag, zk.WorldACL(zk.PermAll)); err != nil {
// Node exist error (when previous nil)
if err == zk.ErrNodeExists {
return false, nil, store.ErrKeyExists
Expand Down
6 changes: 3 additions & 3 deletions store/zookeeper/zookeeper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"testing"
"time"

"github.com/docker/libkv"
"github.com/docker/libkv/store"
"github.com/docker/libkv/testutils"
"github.com/rpcxio/libkv"
"github.com/rpcxio/libkv/store"
"github.com/rpcxio/libkv/testutils"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion testutils/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

"github.com/docker/libkv/store"
"github.com/rpcxio/libkv/store"
"github.com/stretchr/testify/assert"
)

Expand Down