From 294a998282f502dc1e869efbc9bf65852a79da69 Mon Sep 17 00:00:00 2001 From: Virgil Date: Fri, 3 Apr 2026 05:28:57 +0000 Subject: [PATCH] refactor(store): rename journal config fields Co-Authored-By: Virgil --- journal.go | 4 ++-- store.go | 18 +++++++++++------- store_test.go | 6 +++--- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/journal.go b/journal.go index 9baa21b..3ce4bd1 100644 --- a/journal.go +++ b/journal.go @@ -160,10 +160,10 @@ func (storeInstance *Store) queryJournalFlux(flux string) (string, []any, error) } func (storeInstance *Store) journalBucket() string { - if storeInstance.journal.bucket == "" { + if storeInstance.journal.bucketName == "" { return defaultJournalBucket } - return storeInstance.journal.bucket + return storeInstance.journal.bucketName } func ensureJournalSchema(database schemaDatabase) error { diff --git a/store.go b/store.go index 79efb11..d2bd176 100644 --- a/store.go +++ b/store.go @@ -33,10 +33,10 @@ const ( // Usage example: `storeInstance, err := store.New("/tmp/go-store.db", store.WithJournal("http://127.0.0.1:8086", "core", "events"))` type StoreOption func(*Store) -type journalConfig struct { - url string - org string - bucket string +type journalDestinationConfig struct { + endpointURL string + organisation string + bucketName string } // Store provides SQLite-backed grouped entries with TTL expiry, namespace @@ -47,7 +47,7 @@ type Store struct { cancelPurge context.CancelFunc purgeWaitGroup sync.WaitGroup purgeInterval time.Duration // interval between background purge cycles - journal journalConfig + journal journalDestinationConfig closeLock sync.Mutex closed bool @@ -62,9 +62,13 @@ type Store struct { // WithJournal records journal connection metadata for workspace commits, // journal queries, and archive generation. // Usage example: `storeInstance, err := store.New("/tmp/go-store.db", store.WithJournal("http://127.0.0.1:8086", "core", "events"))` -func WithJournal(url, org, bucket string) StoreOption { +func WithJournal(endpointURL, organisation, bucketName string) StoreOption { return func(storeInstance *Store) { - storeInstance.journal = journalConfig{url: url, org: org, bucket: bucket} + storeInstance.journal = journalDestinationConfig{ + endpointURL: endpointURL, + organisation: organisation, + bucketName: bucketName, + } } } diff --git a/store_test.go b/store_test.go index f3eb9a3..be32e88 100644 --- a/store_test.go +++ b/store_test.go @@ -103,9 +103,9 @@ func TestStore_New_Good_WithJournalOption(t *testing.T) { require.NoError(t, err) defer storeInstance.Close() - assert.Equal(t, "events", storeInstance.journal.bucket) - assert.Equal(t, "core", storeInstance.journal.org) - assert.Equal(t, "http://127.0.0.1:8086", storeInstance.journal.url) + assert.Equal(t, "events", storeInstance.journal.bucketName) + assert.Equal(t, "core", storeInstance.journal.organisation) + assert.Equal(t, "http://127.0.0.1:8086", storeInstance.journal.endpointURL) } // ---------------------------------------------------------------------------