mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update libkv godeps
Signed-off-by: Jana Radhakrishnan <mrjana@docker.com>
This commit is contained in:
parent
9d64e07700
commit
93bc5ed4c7
2 changed files with 27 additions and 1 deletions
2
libnetwork/Godeps/Godeps.json
generated
2
libnetwork/Godeps/Godeps.json
generated
|
@ -146,7 +146,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/docker/libkv",
|
"ImportPath": "github.com/docker/libkv",
|
||||||
"Rev": "9d9710dcf6419a58455d0a80e0a8a21ca5f21a94"
|
"Rev": "4ca160cf21d4e097725d93a72d7b3937c537cdc2"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"ImportPath": "github.com/godbus/dbus",
|
"ImportPath": "github.com/godbus/dbus",
|
||||||
|
|
26
libnetwork/Godeps/_workspace/src/github.com/docker/libkv/store/boltdb/boltdb.go
generated
vendored
26
libnetwork/Godeps/_workspace/src/github.com/docker/libkv/store/boltdb/boltdb.go
generated
vendored
|
@ -6,6 +6,7 @@ import (
|
||||||
"errors"
|
"errors"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ type BoltDB struct {
|
||||||
// PersistConnection flag provides an option to override ths behavior.
|
// PersistConnection flag provides an option to override ths behavior.
|
||||||
// ie: open the connection in New and use it till Close is called.
|
// ie: open the connection in New and use it till Close is called.
|
||||||
PersistConnection bool
|
PersistConnection bool
|
||||||
|
sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -130,6 +132,8 @@ func (b *BoltDB) Get(key string) (*store.KVPair, error) {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
@ -169,6 +173,9 @@ func (b *BoltDB) Put(key string, value []byte, opts *store.WriteOptions) error {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
dbval := make([]byte, libkvmetadatalen)
|
dbval := make([]byte, libkvmetadatalen)
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
|
@ -201,6 +208,9 @@ func (b *BoltDB) Delete(key string) error {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -224,6 +234,8 @@ func (b *BoltDB) Exists(key string) (bool, error) {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
|
@ -253,6 +265,9 @@ func (b *BoltDB) List(keyPrefix string) ([]*store.KVPair, error) {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
kv := []*store.KVPair{}
|
kv := []*store.KVPair{}
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
|
@ -299,6 +314,8 @@ func (b *BoltDB) AtomicDelete(key string, previous *store.KVPair) (bool, error)
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if previous == nil {
|
if previous == nil {
|
||||||
return false, store.ErrPreviousNotSpecified
|
return false, store.ErrPreviousNotSpecified
|
||||||
|
@ -337,6 +354,9 @@ func (b *BoltDB) AtomicPut(key string, value []byte, previous *store.KVPair, opt
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
dbval := make([]byte, libkvmetadatalen)
|
dbval := make([]byte, libkvmetadatalen)
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
|
@ -391,6 +411,9 @@ func (b *BoltDB) AtomicPut(key string, value []byte, previous *store.KVPair, opt
|
||||||
|
|
||||||
// Close the db connection to the BoltDB
|
// Close the db connection to the BoltDB
|
||||||
func (b *BoltDB) Close() {
|
func (b *BoltDB) Close() {
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if !b.PersistConnection {
|
if !b.PersistConnection {
|
||||||
b.reset()
|
b.reset()
|
||||||
} else {
|
} else {
|
||||||
|
@ -405,6 +428,9 @@ func (b *BoltDB) DeleteTree(keyPrefix string) error {
|
||||||
db *bolt.DB
|
db *bolt.DB
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
b.Lock()
|
||||||
|
defer b.Unlock()
|
||||||
|
|
||||||
if db, err = b.getDBhandle(); err != nil {
|
if db, err = b.getDBhandle(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue