From b20870178cfae15b28f9506eb5ea180a2a65e960 Mon Sep 17 00:00:00 2001 From: Virgil Date: Sat, 4 Apr 2026 16:47:13 +0000 Subject: [PATCH] refactor(store): unify scoped prefix helper naming Align the scoped helper name with the rest of the package and fix the RFC reference paths so the docs point at real local sources. Co-Authored-By: Virgil --- docs/RFC-STORE.md | 8 ++++---- scope.go | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/RFC-STORE.md b/docs/RFC-STORE.md index 25299da..171fbd2 100644 --- a/docs/RFC-STORE.md +++ b/docs/RFC-STORE.md @@ -40,7 +40,7 @@ SQLite-backed key-value store with TTL, namespace isolation, reactive events, an ## 4. Store Struct ```go -// Store is the SQLite KV store with optional InfluxDB journal backing. +// Store is the SQLite KV store with optional SQLite journal backing. type Store struct { db *sql.DB // SQLite connection (single, WAL mode) journal influxdb2.Client // InfluxDB client (nil if no journal configured) @@ -255,7 +255,7 @@ func (s *Store) Compact(opts CompactOptions) core.Result { } Output: gzip JSONL files. Each line is a complete unit of work — ready for training data ingestion, CDN publishing, or long-term analytics. -### 7.6 File Lifecycle +### 8.1 File Lifecycle Workspace files are ephemeral: @@ -288,5 +288,5 @@ func (s *Store) RecoverOrphans(stateDir string) []*Workspace { } | Resource | Location | |----------|----------| -| Core Go RFC | `code/core/go/RFC.md` | -| IO RFC | `code/core/go/io/RFC.md` | +| Architecture docs | `docs/architecture.md` | +| Development guide | `docs/development.md` | diff --git a/scope.go b/scope.go index 4e4120d..0c91c78 100644 --- a/scope.go +++ b/scope.go @@ -207,13 +207,13 @@ func (scopedStore *ScopedStore) Count(group string) (int, error) { // Usage example: `keyCount, err := scopedStore.CountAll("config")` // Usage example: `keyCount, err := scopedStore.CountAll()` func (scopedStore *ScopedStore) CountAll(groupPrefix ...string) (int, error) { - return scopedStore.storeInstance.CountAll(scopedStore.namespacedGroup(firstString(groupPrefix))) + return scopedStore.storeInstance.CountAll(scopedStore.namespacedGroup(firstScopedString(groupPrefix))) } // Usage example: `groupNames, err := scopedStore.Groups("config")` // Usage example: `groupNames, err := scopedStore.Groups()` func (scopedStore *ScopedStore) Groups(groupPrefix ...string) ([]string, error) { - groupNames, err := scopedStore.storeInstance.Groups(scopedStore.namespacedGroup(firstString(groupPrefix))) + groupNames, err := scopedStore.storeInstance.Groups(scopedStore.namespacedGroup(firstScopedString(groupPrefix))) if err != nil { return nil, err } @@ -228,7 +228,7 @@ func (scopedStore *ScopedStore) Groups(groupPrefix ...string) ([]string, error) func (scopedStore *ScopedStore) GroupsSeq(groupPrefix ...string) iter.Seq2[string, error] { return func(yield func(string, error) bool) { namespacePrefix := scopedStore.namespacePrefix() - for groupName, err := range scopedStore.storeInstance.GroupsSeq(scopedStore.namespacedGroup(firstString(groupPrefix))) { + for groupName, err := range scopedStore.storeInstance.GroupsSeq(scopedStore.namespacedGroup(firstScopedString(groupPrefix))) { if err != nil { if !yield("", err) { return @@ -427,7 +427,7 @@ func (scopedStoreTransaction *ScopedStoreTransaction) CountAll(groupPrefix ...st if err := scopedStoreTransaction.ensureReady("store.ScopedStoreTransaction.CountAll"); err != nil { return 0, err } - return scopedStoreTransaction.storeTransaction.CountAll(scopedStoreTransaction.scopedStore.namespacedGroup(firstString(groupPrefix))) + return scopedStoreTransaction.storeTransaction.CountAll(scopedStoreTransaction.scopedStore.namespacedGroup(firstScopedString(groupPrefix))) } // Usage example: `groupNames, err := scopedStoreTransaction.Groups("config")` @@ -437,7 +437,7 @@ func (scopedStoreTransaction *ScopedStoreTransaction) Groups(groupPrefix ...stri return nil, err } - groupNames, err := scopedStoreTransaction.storeTransaction.Groups(scopedStoreTransaction.scopedStore.namespacedGroup(firstString(groupPrefix))) + groupNames, err := scopedStoreTransaction.storeTransaction.Groups(scopedStoreTransaction.scopedStore.namespacedGroup(firstScopedString(groupPrefix))) if err != nil { return nil, err } @@ -457,7 +457,7 @@ func (scopedStoreTransaction *ScopedStoreTransaction) GroupsSeq(groupPrefix ...s } namespacePrefix := scopedStoreTransaction.scopedStore.namespacePrefix() - for groupName, err := range scopedStoreTransaction.storeTransaction.GroupsSeq(scopedStoreTransaction.scopedStore.namespacedGroup(firstString(groupPrefix))) { + for groupName, err := range scopedStoreTransaction.storeTransaction.GroupsSeq(scopedStoreTransaction.scopedStore.namespacedGroup(firstScopedString(groupPrefix))) { if err != nil { if !yield("", err) { return @@ -601,7 +601,7 @@ func (scopedStore *ScopedStore) checkQuota(operation, group, key string) error { return nil } -func firstString(values []string) string { +func firstScopedString(values []string) string { if len(values) == 0 { return "" }