diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-01-21 12:10:58 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-01-21 12:10:58 +0900 |
| commit | dfcdc5ce20fb163a729efc0ea960480dff129eae (patch) | |
| tree | bfff30426a461ea1b69e89be295086d7a3f528da /internal/state/state.go | |
| parent | fa0616b2748e363fee23c9cd1a01f286f6dba73c (diff) | |
state: store config in separate gob stream
This enables early serialisation of config.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/state/state.go')
| -rw-r--r-- | internal/state/state.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/internal/state/state.go b/internal/state/state.go index e8208476..6e76d517 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -1,11 +1,15 @@ package state import ( + "errors" + "io" "time" "git.gensokyo.uk/security/fortify/fst" ) +var ErrNoConfig = errors.New("state does not contain config") + type Entries map[fst.ID]*State type Store interface { @@ -24,13 +28,13 @@ type Store interface { // Cursor provides access to the store type Cursor interface { - Save(state *State) error + Save(state *State, configWriter io.WriterTo) error Destroy(id fst.ID) error Load() (Entries, error) Len() (int, error) } -// State is the on-disk format for a fortified process's state information +// State is a fortify process's state type State struct { // fortify instance id ID fst.ID `json:"instance"` @@ -40,5 +44,5 @@ type State struct { Config *fst.Config `json:"config"` // process start time - Time time.Time + Time time.Time `json:"time"` } |
