diff options
| author | Ophestra <cat@gensokyo.uk> | 2025-07-02 20:42:51 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2025-07-02 20:42:51 +0900 |
| commit | eb22a8bcc1ac03357d4073e5d3ed6d0ab5246a37 (patch) | |
| tree | d27d1f724a18bb47bf48816a444dccac28b5248c /internal/state/state.go | |
| parent | 31aef905fa819310ee7694775a836c294ff742e4 (diff) | |
cmd/hakurei: move to cmd
Having it at the project root never made sense since the "ego" name was deprecated. This change finally addresses it.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/state/state.go')
| -rw-r--r-- | internal/state/state.go | 49 |
1 files changed, 0 insertions, 49 deletions
diff --git a/internal/state/state.go b/internal/state/state.go deleted file mode 100644 index 0c07b371..00000000 --- a/internal/state/state.go +++ /dev/null @@ -1,49 +0,0 @@ -package state - -import ( - "errors" - "io" - "time" - - "git.gensokyo.uk/security/hakurei/hst" - "git.gensokyo.uk/security/hakurei/internal/app" -) - -var ErrNoConfig = errors.New("state does not contain config") - -type Entries map[app.ID]*State - -type Store interface { - // Do calls f exactly once and ensures store exclusivity until f returns. - // Returns whether f is called and any errors during the locking process. - // Cursor provided to f becomes invalid as soon as f returns. - Do(aid int, f func(c Cursor)) (ok bool, err error) - - // List queries the store and returns a list of aids known to the store. - // Note that some or all returned aids might not have any active apps. - List() (aids []int, err error) - - // Close releases any resources held by Store. - Close() error -} - -// Cursor provides access to the store -type Cursor interface { - Save(state *State, configWriter io.WriterTo) error - Destroy(id app.ID) error - Load() (Entries, error) - Len() (int, error) -} - -// State is an instance state -type State struct { - // hakurei instance id - ID app.ID `json:"instance"` - // child process PID value - PID int `json:"pid"` - // sealed app configuration - Config *hst.Config `json:"config"` - - // process start time - Time time.Time `json:"time"` -} |
