app/instance: wrap internal implementation
All checks were successful
Test / Create distribution (push) Successful in 26s
Test / Sandbox (push) Successful in 1m44s
Test / Fortify (push) Successful in 2m37s
Test / Sandbox (race detector) (push) Successful in 2m59s
Test / Fpkg (push) Successful in 3m34s
Test / Fortify (race detector) (push) Successful in 4m6s
Test / Flake checks (push) Successful in 59s

This reduces the scope of the fst package, which was growing questionably large.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-04-12 13:56:41 +09:00
parent 0d7c1a9a43
commit 6309469e93
32 changed files with 337 additions and 280 deletions

View File

@@ -14,6 +14,7 @@ import (
"syscall"
"git.gensokyo.uk/security/fortify/fst"
"git.gensokyo.uk/security/fortify/internal/app"
"git.gensokyo.uk/security/fortify/internal/fmsg"
)
@@ -129,7 +130,7 @@ type multiBackend struct {
lock sync.RWMutex
}
func (b *multiBackend) filename(id *fst.ID) string {
func (b *multiBackend) filename(id *app.ID) string {
return path.Join(b.path, id.String())
}
@@ -189,8 +190,8 @@ func (b *multiBackend) load(decode bool) (Entries, error) {
return nil, fmt.Errorf("unexpected directory %q in store", e.Name())
}
id := new(fst.ID)
if err := fst.ParseAppID(id, e.Name()); err != nil {
id := new(app.ID)
if err := app.ParseAppID(id, e.Name()); err != nil {
return nil, err
}
@@ -335,7 +336,7 @@ func (b *multiBackend) encodeState(w io.WriteSeeker, state *State, configWriter
return err
}
func (b *multiBackend) Destroy(id fst.ID) error {
func (b *multiBackend) Destroy(id app.ID) error {
b.lock.Lock()
defer b.lock.Unlock()