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/app/app.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/app/app.go')
| -rw-r--r-- | internal/app/app.go | 25 |
1 files changed, 0 insertions, 25 deletions
diff --git a/internal/app/app.go b/internal/app/app.go index 0da8148b..30f893a9 100644 --- a/internal/app/app.go +++ b/internal/app/app.go @@ -3,7 +3,6 @@ package app import ( "context" "sync" - "sync/atomic" "git.gensokyo.uk/security/fortify/fst" "git.gensokyo.uk/security/fortify/internal/linux" @@ -30,9 +29,6 @@ type RunState struct { } type app struct { - // single-use config reference - ct *appCt - // application unique identifier id *fst.ID // operating system interface @@ -74,24 +70,3 @@ func New(os linux.System) (App, error) { a.os = os return a, fst.NewAppID(a.id) } - -// appCt ensures its wrapped val is only accessed once -type appCt struct { - val *fst.Config - done *atomic.Bool -} - -func (a *appCt) Unwrap() *fst.Config { - if !a.done.Load() { - defer a.done.Store(true) - return a.val - } - panic("attempted to access config reference twice") -} - -func newAppCt(config *fst.Config) (ct *appCt) { - ct = new(appCt) - ct.done = new(atomic.Bool) - ct.val = config - return ct -} |
