commit 3a657f48e068ce522e0a4d1eda81296bfcfd272e
parent d396fd45d80568bbf80f4ab48724da30056ba6fb
Author: lash <dev@holbrook.no>
Date: Sat, 31 Aug 2024 01:28:58 +0100
Update persister in http example
Diffstat:
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/examples/http/main.go b/examples/http/main.go
@@ -15,6 +15,7 @@ import (
"git.defalsify.org/vise.git/persist"
"git.defalsify.org/vise.git/resource"
"git.defalsify.org/vise.git/logging"
+ "git.defalsify.org/vise.git/db"
)
var (
@@ -96,13 +97,15 @@ func(f *DefaultSessionHandler) GetEngine(ctx context.Context, sessionId string)
cfg.SessionId = sessionId
persistPath := path.Join(f.peBase, sessionId)
- err := os.MkdirAll(persistPath, 0700)
+ store := db.NewFsDb()
+ err := store.Connect(ctx, persistPath)
if err != nil {
return nil, err
}
+
f.rh.SetSession(sessionId)
- pe := persist.NewFsPersister(persistPath)
+ pe := persist.NewPersister(store)
en, err := engine.NewPersistedEngine(ctx, cfg, pe, f.rs)
if err != nil {
st := state.NewState(cfg.FlagCount)