libnetwork/internal/kvstore: remove unused Delete()

All code is using the atomic alternatives (AtomicDelete)

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
Sebastiaan van Stijn 2023-07-02 23:34:39 +02:00
parent 4d09e60f5b
commit 4c4149a09c
No known key found for this signature in database
GPG key ID: 76698F39D527CE8C
3 changed files with 2 additions and 30 deletions

View file

@ -48,12 +48,6 @@ func (s *MockStore) Put(key string, value []byte) error {
return nil
}
// Delete a value at "key"
func (s *MockStore) Delete(key string) error {
delete(s.db, key)
return nil
}
// Exists checks that the key exists inside the store
func (s *MockStore) Exists(key string) (bool, error) {
_, ok := s.db[key]
@ -95,7 +89,8 @@ func (s *MockStore) AtomicDelete(key string, previous *store.KVPair) error {
if mData != nil && mData.Index != previous.LastIndex {
return types.BadRequestErrorf("atomic delete failed due to mismatched Index")
}
return s.Delete(key)
delete(s.db, key)
return nil
}
// Close closes the client connection

View file

@ -178,26 +178,6 @@ func (b *BoltDB) Put(key string, value []byte) error {
})
}
// Delete the value for the given key.
func (b *BoltDB) Delete(key string) error {
b.mu.Lock()
defer b.mu.Unlock()
db, err := b.getDBhandle()
if err != nil {
return err
}
defer b.releaseDBhandle()
return db.Update(func(tx *bolt.Tx) error {
bucket := tx.Bucket(b.boltBucket)
if bucket == nil {
return store.ErrKeyNotFound
}
return bucket.Delete([]byte(key))
})
}
// Exists checks if the key exists inside the store
func (b *BoltDB) Exists(key string) (bool, error) {
b.mu.Lock()

View file

@ -42,9 +42,6 @@ type Store interface {
// Get a value given its key
Get(key string) (*KVPair, error)
// Delete the value at the specified key
Delete(key string) error
// Exists verifies if a Key exists in the store.
Exists(key string) (bool, error)