Merge pull request '[agent/codex:gpt-5.4-mini] Read docs/RFC-STORE.md fully. Find features described in the...' (#148) from agent/read---spec-code-core-go-store-rfc-md-fu into dev
Some checks are pending
Security Scan / security (push) Waiting to run
Test / test (push) Waiting to run

This commit is contained in:
Virgil 2026-04-04 13:37:38 +00:00
commit 30a3c5fce6

View file

@ -27,7 +27,7 @@ const (
entryValueColumn = "entry_value"
)
// Usage example: `storeInstance, err := store.New("/tmp/go-store.db", store.WithJournal("http://127.0.0.1:8086", "core", "events"), store.WithPurgeInterval(30*time.Second))`
// Usage example: `storeInstance, err := store.NewConfigured(store.StoreConfig{DatabasePath: "/tmp/go-store.db", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}, PurgeInterval: 30 * time.Second})`
// Prefer `store.NewConfigured(store.StoreConfig{...})` when the configuration
// is already known as a struct literal. Use `StoreOption` only when values
// need to be assembled incrementally, such as when a caller receives them from
@ -204,7 +204,7 @@ func (storeInstance *Store) IsClosed() bool {
return closed
}
// Usage example: `storeInstance, err := store.New(":memory:", store.WithPurgeInterval(20*time.Millisecond))`
// Usage example: `storeInstance, err := store.NewConfigured(store.StoreConfig{DatabasePath: ":memory:", PurgeInterval: 20 * time.Millisecond})`
func WithPurgeInterval(interval time.Duration) StoreOption {
return func(storeConfig *StoreConfig) {
if storeConfig == nil {
@ -249,7 +249,7 @@ func openConfiguredStore(operation string, storeConfig StoreConfig) (*Store, err
return storeInstance, nil
}
// Usage example: `storeInstance, err := store.New("/tmp/go-store.db", store.WithJournal("http://127.0.0.1:8086", "core", "events"))`
// Usage example: `storeInstance, err := store.NewConfigured(store.StoreConfig{DatabasePath: "/tmp/go-store.db", Journal: store.JournalConfiguration{EndpointURL: "http://127.0.0.1:8086", Organisation: "core", BucketName: "events"}})`
func New(databasePath string, options ...StoreOption) (*Store, error) {
storeConfig := StoreConfig{DatabasePath: databasePath}
for _, option := range options {