diff --git a/doc.go b/doc.go index 6214cec..10952ef 100644 --- a/doc.go +++ b/doc.go @@ -2,7 +2,9 @@ // namespace isolation, quota enforcement, reactive events, journal writes, // workspace buffering, cold archive compaction, and orphan recovery. // -// Prefer struct literals when the configuration is already known: +// Prefer `store.NewConfigured(store.StoreConfig{...})` and +// `store.NewScopedConfigured(store.ScopedStoreConfig{...})` when the +// configuration is already known: // // configuredStore, err := store.NewConfigured(store.StoreConfig{ // DatabasePath: ":memory:", diff --git a/scope.go b/scope.go index eaf3b36..d52459c 100644 --- a/scope.go +++ b/scope.go @@ -83,6 +83,8 @@ type scopedWatcherBridge struct { // NewScoped validates a namespace and prefixes groups with namespace + ":". // Usage example: `scopedStore, err := store.NewScoped(storeInstance, "tenant-a"); if err != nil { return }` +// Prefer `NewScopedConfigured` when the namespace and quota are already known +// as a struct literal. func NewScoped(storeInstance *Store, namespace string) (*ScopedStore, error) { if storeInstance == nil { return nil, core.E("store.NewScoped", "store instance is nil", nil) diff --git a/store.go b/store.go index 019e97e..da76b82 100644 --- a/store.go +++ b/store.go @@ -29,9 +29,9 @@ const ( ) // 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 +// Prefer `store.NewConfigured(store.StoreConfig{...})` when the full +// configuration is already known. Use `StoreOption` only when values need to +// be assembled incrementally, such as when a caller receives them from // different sources. type StoreOption func(*StoreConfig)