aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/app.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-02-18 23:05:37 +0900
committerOphestra <cat@gensokyo.uk>2025-02-18 23:07:28 +0900
commit648e1d641a8b0ae7c5bc4899f84b884d4335c97f (patch)
treefdb45d1fedb60487c22a1fceb9d87ba883f03779 /internal/app/app.go
parent3c327084d387b316795f45420e8d0c6f9ce71ffe (diff)
app: separate interface from implementation
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/app.go')
-rw-r--r--internal/app/app.go30
1 files changed, 5 insertions, 25 deletions
diff --git a/internal/app/app.go b/internal/app/app.go
index 2a96c544..cf21ac71 100644
--- a/internal/app/app.go
+++ b/internal/app/app.go
@@ -1,7 +1,6 @@
package app
import (
- "context"
"sync"
"git.gensokyo.uk/security/fortify/fst"
@@ -9,23 +8,11 @@ import (
"git.gensokyo.uk/security/fortify/internal/sys"
)
-type App interface {
- // ID returns a copy of App's unique ID.
- ID() fst.ID
- // Run sets up the system and runs the App.
- Run(ctx context.Context, rs *RunState) error
-
- Seal(config *fst.Config) error
- String() string
-}
-
-type RunState struct {
- // Start is true if fsu is successfully started.
- Start bool
- // ExitCode is the value returned by shim.
- ExitCode int
- // WaitErr is error returned by the underlying wait syscall.
- WaitErr error
+func New(os sys.State) (fst.App, error) {
+ a := new(app)
+ a.id = new(fst.ID)
+ a.os = os
+ return a, fst.NewAppID(a.id)
}
type app struct {
@@ -63,10 +50,3 @@ func (a *app) String() string {
return "(unsealed fortified app)"
}
-
-func New(os sys.State) (App, error) {
- a := new(app)
- a.id = new(fst.ID)
- a.os = os
- return a, fst.NewAppID(a.id)
-}