refactor(store): unify scoped prefix helper naming
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

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 <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 16:47:13 +00:00
parent 9dc0b9bfcf
commit b20870178c
2 changed files with 11 additions and 11 deletions

View file

@ -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` |

View file

@ -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 ""
}