app/instance: wrap internal implementation
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 1m44s
Test / Fortify (push) Successful in 2m37s
Test / Sandbox (race detector) (push) Successful in 2m59s
Test / Fpkg (push) Successful in 3m34s
Test / Fortify (race detector) (push) Successful in 4m6s
Test / Flake checks (push) Successful in 59s

This reduces the scope of the fst package, which was growing questionably large.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-04-12 13:56:41 +09:00
parent 0d7c1a9a43
commit 6309469e93
32 changed files with 337 additions and 280 deletions

View File

@@ -6,11 +6,12 @@ import (
"time"
"git.gensokyo.uk/security/fortify/fst"
"git.gensokyo.uk/security/fortify/internal/app"
)
var ErrNoConfig = errors.New("state does not contain config")
type Entries map[fst.ID]*State
type Entries map[app.ID]*State
type Store interface {
// Do calls f exactly once and ensures store exclusivity until f returns.
@@ -29,7 +30,7 @@ type Store interface {
// Cursor provides access to the store
type Cursor interface {
Save(state *State, configWriter io.WriterTo) error
Destroy(id fst.ID) error
Destroy(id app.ID) error
Load() (Entries, error)
Len() (int, error)
}
@@ -37,7 +38,7 @@ type Cursor interface {
// State is a fortify process's state
type State struct {
// fortify instance id
ID fst.ID `json:"instance"`
ID app.ID `json:"instance"`
// child process PID value
PID int `json:"pid"`
// sealed app configuration