aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/app.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-07-02 20:42:51 +0900
committerOphestra <cat@gensokyo.uk>2025-07-02 20:42:51 +0900
commiteb22a8bcc1ac03357d4073e5d3ed6d0ab5246a37 (patch)
treed27d1f724a18bb47bf48816a444dccac28b5248c /internal/app/app.go
parent31aef905fa819310ee7694775a836c294ff742e4 (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/app/app.go')
-rw-r--r--internal/app/app.go59
1 files changed, 0 insertions, 59 deletions
diff --git a/internal/app/app.go b/internal/app/app.go
deleted file mode 100644
index 902df10f..00000000
--- a/internal/app/app.go
+++ /dev/null
@@ -1,59 +0,0 @@
-// Package app defines the generic [App] interface.
-package app
-
-import (
- "syscall"
- "time"
-
- "git.gensokyo.uk/security/hakurei/hst"
-)
-
-type App interface {
- // ID returns a copy of [ID] held by App.
- ID() ID
-
- // Seal determines the outcome of config as a [SealedApp].
- // The value of config might be overwritten and must not be used again.
- Seal(config *hst.Config) (SealedApp, error)
-
- String() string
-}
-
-type SealedApp interface {
- // Run commits sealed system setup and starts the app process.
- Run(rs *RunState) error
-}
-
-// RunState stores the outcome of a call to [SealedApp.Run].
-type RunState struct {
- // Time is the exact point in time where the process was created.
- // Location must be set to UTC.
- //
- // Time is nil if no process was ever created.
- Time *time.Time
- // RevertErr is stored by the deferred revert call.
- RevertErr error
- // WaitErr is the generic error value created by the standard library.
- WaitErr error
-
- syscall.WaitStatus
-}
-
-// SetStart stores the current time in [RunState] once.
-func (rs *RunState) SetStart() {
- if rs.Time != nil {
- panic("attempted to store time twice")
- }
- now := time.Now().UTC()
- rs.Time = &now
-}
-
-// Paths contains environment-dependent paths used by hakurei.
-type Paths struct {
- // path to shared directory (usually `/tmp/hakurei.%d`)
- SharePath string `json:"share_path"`
- // XDG_RUNTIME_DIR value (usually `/run/user/%d`)
- RuntimePath string `json:"runtime_path"`
- // application runtime directory (usually `/run/user/%d/hakurei`)
- RunDirPath string `json:"run_dir_path"`
-}