diff --git a/libnetwork/datastore/mockstore_test.go b/libnetwork/datastore/mockstore_test.go index 22b4539ac0..3598940a6a 100644 --- a/libnetwork/datastore/mockstore_test.go +++ b/libnetwork/datastore/mockstore_test.go @@ -23,16 +23,6 @@ func NewMockStore() *MockStore { return &MockStore{db: make(map[string]*MockData)} } -// Get the value at "key", returns the last modified index -// to use in conjunction to CAS calls -func (s *MockStore) Get(key string) (*store.KVPair, error) { - mData := s.db[key] - if mData == nil { - return nil, nil - } - return &store.KVPair{Value: mData.Data, LastIndex: mData.Index}, nil -} - // Put a value at "key" func (s *MockStore) Put(key string, value []byte) error { mData := s.db[key] diff --git a/libnetwork/internal/kvstore/boltdb/boltdb.go b/libnetwork/internal/kvstore/boltdb/boltdb.go index 85793938a8..624d2f458f 100644 --- a/libnetwork/internal/kvstore/boltdb/boltdb.go +++ b/libnetwork/internal/kvstore/boltdb/boltdb.go @@ -109,44 +109,6 @@ func (b *BoltDB) releaseDBhandle() { } } -// Get the value at "key". BoltDB doesn't provide an inbuilt last modified index with every kv pair. Its implemented by -// by a atomic counter maintained by the libkv and appened to the value passed by the client. -func (b *BoltDB) Get(key string) (*store.KVPair, error) { - b.mu.Lock() - defer b.mu.Unlock() - - db, err := b.getDBhandle() - if err != nil { - return nil, err - } - defer b.releaseDBhandle() - - var val []byte - err = db.View(func(tx *bolt.Tx) error { - bucket := tx.Bucket(b.boltBucket) - if bucket == nil { - return store.ErrKeyNotFound - } - - v := bucket.Get([]byte(key)) - val = make([]byte, len(v)) - copy(val, v) - - return nil - }) - if err != nil { - return nil, err - } - if len(val) == 0 { - return nil, store.ErrKeyNotFound - } - - dbIndex := binary.LittleEndian.Uint64(val[:libkvmetadatalen]) - val = val[libkvmetadatalen:] - - return &store.KVPair{Key: key, Value: val, LastIndex: dbIndex}, nil -} - // Put the key, value pair. index number metadata is prepended to the value func (b *BoltDB) Put(key string, value []byte) error { b.mu.Lock() diff --git a/libnetwork/internal/kvstore/kvstore.go b/libnetwork/internal/kvstore/kvstore.go index e8b61046ad..4566ca9690 100644 --- a/libnetwork/internal/kvstore/kvstore.go +++ b/libnetwork/internal/kvstore/kvstore.go @@ -39,9 +39,6 @@ type Store interface { // Put a value at the specified key Put(key string, value []byte) error - // Get a value given its key - Get(key string) (*KVPair, error) - // Exists verifies if a Key exists in the store. Exists(key string) (bool, error)