aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-30 18:43:55 +0900
committerOphestra <cat@gensokyo.uk>2025-10-30 18:43:55 +0900
commitebdcff1049fb979405677a823a47410df7ee7c4f (patch)
treea5a14d409e4bc9f3b4b2e2c15f6c23de5ad0755f /cmd
parent46c5ce493638ea2d034bbbdb9449e93b66d0330f (diff)
internal/store: rename from state
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>
Diffstat (limited to 'cmd')
-rw-r--r--cmd/hakurei/command.go4
-rw-r--r--cmd/hakurei/parse.go6
-rw-r--r--cmd/hakurei/print.go6
-rw-r--r--cmd/hakurei/print_test.go4
4 files changed, 10 insertions, 10 deletions
diff --git a/cmd/hakurei/command.go b/cmd/hakurei/command.go
index f8173e60..e71ac16a 100644
--- a/cmd/hakurei/command.go
+++ b/cmd/hakurei/command.go
@@ -20,7 +20,7 @@ import (
"hakurei.app/internal"
"hakurei.app/internal/env"
"hakurei.app/internal/outcome"
- "hakurei.app/internal/state"
+ "hakurei.app/internal/store"
"hakurei.app/message"
"hakurei.app/system/dbus"
)
@@ -322,7 +322,7 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
c.NewCommand("ps", "List active instances", func(args []string) error {
var sc hst.Paths
env.CopyPaths().Copy(&sc, new(outcome.Hsu).MustID(nil))
- printPs(os.Stdout, time.Now().UTC(), state.NewMulti(msg, sc.RunDirPath), flagShort, flagJSON)
+ printPs(os.Stdout, time.Now().UTC(), store.NewMulti(msg, sc.RunDirPath), flagShort, flagJSON)
return errSuccess
}).Flag(&flagShort, "short", command.BoolFlag(false), "Print instance id")
}
diff --git a/cmd/hakurei/parse.go b/cmd/hakurei/parse.go
index bbb9e81c..8aef8e98 100644
--- a/cmd/hakurei/parse.go
+++ b/cmd/hakurei/parse.go
@@ -13,7 +13,7 @@ import (
"hakurei.app/hst"
"hakurei.app/internal/env"
"hakurei.app/internal/outcome"
- "hakurei.app/internal/state"
+ "hakurei.app/internal/store"
"hakurei.app/message"
)
@@ -85,8 +85,8 @@ func tryIdentifier(msg message.Msg, name string) (config *hst.Config, entry *hst
return tryIdentifierEntries(msg, name, func() map[hst.ID]*hst.State {
var sc hst.Paths
env.CopyPaths().Copy(&sc, new(outcome.Hsu).MustID(nil))
- s := state.NewMulti(msg, sc.RunDirPath)
- if entries, err := state.Join(s); err != nil {
+ s := store.NewMulti(msg, sc.RunDirPath)
+ if entries, err := store.Join(s); err != nil {
msg.GetLogger().Printf("cannot join store: %v", err) // not fatal
return nil
} else {
diff --git a/cmd/hakurei/print.go b/cmd/hakurei/print.go
index ff4764ca..15f71a6b 100644
--- a/cmd/hakurei/print.go
+++ b/cmd/hakurei/print.go
@@ -14,7 +14,7 @@ import (
"hakurei.app/internal"
"hakurei.app/internal/env"
"hakurei.app/internal/outcome"
- "hakurei.app/internal/state"
+ "hakurei.app/internal/store"
"hakurei.app/message"
)
@@ -168,9 +168,9 @@ func printShowInstance(
}
// printPs writes a representation of active instances to output.
-func printPs(output io.Writer, now time.Time, s state.Store, short, flagJSON bool) {
+func printPs(output io.Writer, now time.Time, s store.Store, short, flagJSON bool) {
var entries map[hst.ID]*hst.State
- if e, err := state.Join(s); err != nil {
+ if e, err := store.Join(s); err != nil {
log.Fatalf("cannot join store: %v", err)
} else {
entries = e
diff --git a/cmd/hakurei/print_test.go b/cmd/hakurei/print_test.go
index abdcefc6..3db06ec4 100644
--- a/cmd/hakurei/print_test.go
+++ b/cmd/hakurei/print_test.go
@@ -6,7 +6,7 @@ import (
"time"
"hakurei.app/hst"
- "hakurei.app/internal/state"
+ "hakurei.app/internal/store"
)
var (
@@ -709,6 +709,6 @@ func TestPrintPs(t *testing.T) {
type stubStore map[hst.ID]*hst.State
func (s stubStore) Join() (map[hst.ID]*hst.State, error) { return s, nil }
-func (s stubStore) Do(int, func(c state.Cursor)) (bool, error) { panic("unreachable") }
+func (s stubStore) Do(int, func(c store.Cursor)) (bool, error) { panic("unreachable") }
func (s stubStore) List() ([]int, error) { panic("unreachable") }
func (s stubStore) Close() error { return nil }