From 28fc7a0462b82942c6c2c56f00bdd4f69d580089 Mon Sep 17 00:00:00 2001 From: lash Date: Sun, 22 Sep 2024 02:28:00 +0100 Subject: [PATCH] Implement threaded gdbm in storageservice --- internal/storage/storageservice.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/internal/storage/storageservice.go b/internal/storage/storageservice.go index 7cceb4e..07bccd6 100644 --- a/internal/storage/storageservice.go +++ b/internal/storage/storageservice.go @@ -8,7 +8,6 @@ import ( "git.defalsify.org/vise.git/db" fsdb "git.defalsify.org/vise.git/db/fs" - gdbmdb "git.defalsify.org/vise.git/db/gdbm" "git.defalsify.org/vise.git/persist" "git.defalsify.org/vise.git/resource" "git.defalsify.org/vise.git/logging" @@ -41,7 +40,7 @@ func NewMenuStorageService(dbDir string, resourceDir string) *MenuStorageService } func (ms *MenuStorageService) GetPersister(ctx context.Context) (*persist.Persister, error) { - ms.stateStore = gdbmdb.NewGdbmDb() + ms.stateStore = NewThreadGdbmDb() storeFile := path.Join(ms.dbDir, "state.gdbm") err := ms.stateStore.Connect(ctx, storeFile) if err != nil { @@ -53,7 +52,7 @@ func (ms *MenuStorageService) GetPersister(ctx context.Context) (*persist.Persis } func (ms *MenuStorageService) GetUserdataDb(ctx context.Context) (db.Db, error) { - ms.userDataStore = gdbmdb.NewGdbmDb() + ms.userDataStore = NewThreadGdbmDb() storeFile := path.Join(ms.dbDir, "userdata.gdbm") err := ms.userDataStore.Connect(ctx, storeFile) if err != nil { @@ -76,7 +75,7 @@ func (ms *MenuStorageService) GetStateStore(ctx context.Context) (db.Db, error) if ms.stateStore != nil { panic("set up store when already exists") } - ms.stateStore = gdbmdb.NewGdbmDb() + ms.stateStore = NewThreadGdbmDb() storeFile := path.Join(ms.dbDir, "state.gdbm") err := ms.stateStore.Connect(ctx, storeFile) if err != nil {