internal/store: rename from state
All checks were successful
Test / Create distribution (push) Successful in 33s
Test / Sandbox (push) Successful in 2m9s
Test / Hakurei (push) Successful in 3m8s
Test / Hpkg (push) Successful in 4m2s
Test / Sandbox (race detector) (push) Successful in 4m7s
Test / Hakurei (race detector) (push) Successful in 4m55s
Test / Flake checks (push) Successful in 1m25s

This reduces collision with local variable names, and generally makes sense for the new store package, since it no longer specifies the state struct.

Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
2025-10-30 18:43:55 +09:00
parent 46c5ce4936
commit ebdcff1049
16 changed files with 34 additions and 35 deletions

View File

@@ -15,7 +15,7 @@ import (
"hakurei.app/container/fhs"
"hakurei.app/hst"
"hakurei.app/internal"
"hakurei.app/internal/state"
"hakurei.app/internal/store"
"hakurei.app/message"
"hakurei.app/system"
)
@@ -34,7 +34,7 @@ type mainState struct {
// Time is nil if no process was ever created.
Time *time.Time
store state.Store
store store.Store
cancel context.CancelFunc
cmd *exec.Cmd
cmdWait chan error
@@ -127,7 +127,7 @@ func (ms mainState) beforeExit(isFault bool) {
}
if ms.uintptr&mainNeedsRevert != 0 {
if ok, err := ms.store.Do(ms.k.state.identity.unwrap(), func(c state.Cursor) {
if ok, err := ms.store.Do(ms.k.state.identity.unwrap(), func(c store.Cursor) {
if ms.uintptr&mainNeedsDestroy != 0 {
if err := c.Destroy(ms.k.state.id.unwrap()); err != nil {
perror(err, "destroy state entry")
@@ -220,7 +220,7 @@ func (k *outcome) main(msg message.Msg) {
ms.fatal("cannot commit system setup:", err)
}
ms.uintptr |= mainNeedsRevert
ms.store = state.NewMulti(msg, k.state.sc.RunDirPath)
ms.store = store.NewMulti(msg, k.state.sc.RunDirPath)
ctx, cancel := context.WithCancel(k.ctx)
defer cancel()
@@ -281,7 +281,7 @@ func (k *outcome) main(msg message.Msg) {
}
// shim accepted setup payload, create process state
if ok, err := ms.store.Do(k.state.identity.unwrap(), func(c state.Cursor) {
if ok, err := ms.store.Do(k.state.identity.unwrap(), func(c store.Cursor) {
if err := c.Save(&hst.State{
ID: k.state.id.unwrap(),
PID: os.Getpid(),