aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app
diff options
context:
space:
mode:
authorOphestra Umiker <cat@ophivana.moe>2024-12-19 21:36:17 +0900
committerOphestra Umiker <cat@ophivana.moe>2024-12-19 21:36:17 +0900
commiteae3034260b3abbb8da1deeddfef135b36eeb390 (patch)
treea3dbc5d679a1137018ccec0886c68853e679b7bb /internal/app
parent5ea7333431942780c79c02a990682e44b6834ed6 (diff)
state: expose aids and use instance id as key
Fortify state store instances was specific to aids due to outdated design decisions carried over from the ego rewrite. That no longer makes sense in the current application, so the interface now enables a single store object to manage all transient state. Signed-off-by: Ophestra Umiker <cat@ophivana.moe>
Diffstat (limited to 'internal/app')
-rw-r--r--internal/app/seal.go2
-rw-r--r--internal/app/start.go8
2 files changed, 5 insertions, 5 deletions
diff --git a/internal/app/seal.go b/internal/app/seal.go
index d71553a2..3c49584a 100644
--- a/internal/app/seal.go
+++ b/internal/app/seal.go
@@ -218,7 +218,7 @@ func (a *app) Seal(config *fst.Config) error {
// open process state store
// the simple store only starts holding an open file after first action
// store activity begins after Start is called and must end before Wait
- seal.store = state.NewSimple(seal.RunDirPath, seal.sys.user.as)
+ seal.store = state.NewMulti(seal.RunDirPath)
// initialise system interface with full uid
seal.sys.I = system.New(seal.sys.user.uid)
diff --git a/internal/app/start.go b/internal/app/start.go
index 1ebc94f8..8de7821b 100644
--- a/internal/app/start.go
+++ b/internal/app/start.go
@@ -76,8 +76,8 @@ func (a *app) Start() error {
// register process state
var err0 = new(StateStoreError)
- err0.Inner, err0.DoErr = a.seal.store.Do(func(b state.Backend) {
- err0.InnerErr = b.Save(&sd)
+ err0.Inner, err0.DoErr = a.seal.store.Do(a.seal.sys.user.aid, func(c state.Cursor) {
+ err0.InnerErr = c.Save(&sd)
})
a.seal.sys.saveState = true
return err0.equiv("cannot save process state:")
@@ -199,11 +199,11 @@ func (a *app) Wait() (int, error) {
// update store and revert app setup transaction
e := new(StateStoreError)
- e.Inner, e.DoErr = a.seal.store.Do(func(b state.Backend) {
+ e.Inner, e.DoErr = a.seal.store.Do(a.seal.sys.user.aid, func(b state.Cursor) {
e.InnerErr = func() error {
// destroy defunct state entry
if cmd := a.shim.Unwrap(); cmd != nil && a.seal.sys.saveState {
- if err := b.Destroy(cmd.Process.Pid); err != nil {
+ if err := b.Destroy(*a.id); err != nil {
return err
}
}