docs(store): clarify journal metadata
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

Align the RFC text and store comments with the SQLite-backed journal implementation.

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 17:27:10 +00:00
parent 1905ce51ae
commit 08e896ad4d
2 changed files with 8 additions and 4 deletions

View file

@ -43,9 +43,9 @@ SQLite-backed key-value store with TTL, namespace isolation, reactive events, an
// 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)
bucket string // InfluxDB bucket name
org string // InfluxDB org
journal JournalConfiguration // SQLite journal metadata (nil-equivalent when zero-valued)
bucket string // Journal bucket name
org string // Journal organisation
mu sync.RWMutex
watchers map[string][]chan Event
}
@ -62,7 +62,7 @@ type Event struct {
// New creates a store. Journal is optional — pass WithJournal() to enable.
//
// st, _ := store.New(":memory:") // SQLite only
// st, _ := store.New("/path/to/db", store.WithJournal( // SQLite + InfluxDB
// st, _ := store.New("/path/to/db", store.WithJournal(
// "http://localhost:8086", "core-org", "core-bucket",
// ))
func New(path string, opts ...StoreOption) (*Store, error) { }

View file

@ -67,6 +67,10 @@ func (storeConfig StoreConfig) Validate() error {
}
// Usage example: `config := storeInstance.JournalConfiguration(); fmt.Println(config.EndpointURL, config.Organisation, config.BucketName)`
// JournalConfiguration stores the SQLite journal metadata used by
// CommitToJournal and QueryJournal. The field names stay aligned with the
// agent-facing RFC vocabulary even though the implementation is local to this
// package.
// Usage example: `store.NewConfigured(store.StoreConfig{DatabasePath: ":memory:", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}})`
type JournalConfiguration struct {
// Usage example: `config := store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086"}`