From fd800e396b223cb4fe4f11a75adc1dde5f91024d Mon Sep 17 00:00:00 2001 From: Andrea V <1577639+karimodm@users.noreply.github.com> Date: Tue, 19 Sep 2023 15:18:54 +0200 Subject: [PATCH] Unused dbVersion in base Storage constructor --- pkg/storage/database/lockedkvstore.go | 4 +++- pkg/storage/storage.go | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/pkg/storage/database/lockedkvstore.go b/pkg/storage/database/lockedkvstore.go index f72558bc5..cb365f46e 100644 --- a/pkg/storage/database/lockedkvstore.go +++ b/pkg/storage/database/lockedkvstore.go @@ -17,7 +17,7 @@ type lockedKVStore struct { func newLockedKVStore(storeInstance kvstore.KVStore) *lockedKVStore { return &lockedKVStore{ openableKVStore: newOpenableKVStore(storeInstance), - instanceMutex: new(syncutils.RWMutex), + instanceMutex: new(syncutils.RWMutex), } } @@ -35,6 +35,7 @@ func (s *lockedKVStore) WithRealm(realm kvstore.Realm) (kvstore.KVStore, error) return s.withRealm(realm) } + func (s *lockedKVStore) withRealm(realm kvstore.Realm) (kvstore.KVStore, error) { return &lockedKVStore{ openableKVStore: &openableKVStore{ @@ -131,6 +132,7 @@ func (s *lockedKVStore) Close() error { return s.CloseWithoutLocking() } + func (s *lockedKVStore) CloseWithoutLocking() error { return s.openableKVStore.Close() } diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index f8b3dec60..85fc0eb3e 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -53,7 +53,7 @@ type Storage struct { } // New creates a new storage instance with the named database version in the given directory. -func New(directory string, dbVersion byte, errorHandler func(error), opts ...options.Option[Storage]) *Storage { +func New(directory string, errorHandler func(error), opts ...options.Option[Storage]) *Storage { return options.Apply(&Storage{ dir: utils.NewDirectory(directory, true), errorHandler: errorHandler, @@ -70,7 +70,7 @@ func New(directory string, dbVersion byte, errorHandler func(error), opts ...opt // Create creates a new storage instance with the named database version in the given directory and initializes its permanent // and prunable counterparts. func Create(directory string, dbVersion byte, errorHandler func(error), opts ...options.Option[Storage]) *Storage { - s := New(directory, dbVersion, errorHandler, opts...) + s := New(directory, errorHandler, opts...) dbConfig := database.Config{ Engine: s.optsDBEngine, Directory: s.dir.PathWithCreate(permanentDirName), @@ -87,7 +87,7 @@ func Create(directory string, dbVersion byte, errorHandler func(error), opts ... // Clone creates a new storage instance with the named database version in the given directory and cloning the permannent // and prunable counterparts from the given source storage. func Clone(source *Storage, directory string, dbVersion byte, errorHandler func(error), opts ...options.Option[Storage]) (*Storage, error) { - s := New(directory, dbVersion, errorHandler, opts...) + s := New(directory, errorHandler, opts...) dbConfig := database.Config{ Engine: s.optsDBEngine,