docs(store): clarify journal metadata
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:
parent
1905ce51ae
commit
08e896ad4d
2 changed files with 8 additions and 4 deletions
|
|
@ -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) { }
|
||||
|
|
|
|||
4
store.go
4
store.go
|
|
@ -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"}`
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue