Skip to content

Commit

Permalink
Unused dbVersion in base Storage constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
karimodm committed Sep 19, 2023
1 parent a4ca65d commit fd800e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion pkg/storage/database/lockedkvstore.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
}
}

Expand All @@ -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{
Expand Down Expand Up @@ -131,6 +132,7 @@ func (s *lockedKVStore) Close() error {

return s.CloseWithoutLocking()
}

func (s *lockedKVStore) CloseWithoutLocking() error {
return s.openableKVStore.Close()
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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),
Expand All @@ -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,
Expand Down

0 comments on commit fd800e3

Please sign in to comment.