aboutsummaryrefslogtreecommitdiffhomepage
path: root/fst
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-21 16:00:31 +0900
committerOphestra <cat@gensokyo.uk>2025-02-21 16:06:24 +0900
commitc64b8163e79d47f1e710c1d067589bb393f8463c (patch)
treec4ffa5b89982af6362f1d65bf2ff2af299600574 /fst
parent9d9a165379798acb237c9071ea865f26cfba8be7 (diff)
app: separate instance from process state
This works better for the implementation. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'fst')
-rw-r--r--fst/app.go16
1 files changed, 11 insertions, 5 deletions
diff --git a/fst/app.go b/fst/app.go
index e1a17f16..3addb46b 100644
--- a/fst/app.go
+++ b/fst/app.go
@@ -6,16 +6,22 @@ import (
)
type App interface {
- // ID returns a copy of App's unique ID.
+ // ID returns a copy of [fst.ID] held by App.
ID() ID
- // Run sets up the system and runs the App.
- Run(ctx context.Context, rs *RunState) error
- Seal(config *Config) error
+ // Seal determines the outcome of config as a [SealedApp].
+ // The value of config might be overwritten and must not be used again.
+ Seal(config *Config) (SealedApp, error)
+
String() string
}
-// RunState stores the outcome of a call to [App.Run].
+type SealedApp interface {
+ // Run commits sealed system setup and starts the app process.
+ Run(ctx context.Context, 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.