Documentation
¶
Overview ¶
Package mem exposes the typed funnel for mem-backed accesscore wiring. A single NewBundle call yields a UserRepository, RoleRepository, SetupLock and store-paired TxRunner all derived from the same underlying mem.Store — the Bundle struct is sealed (private fields, exported only via accessor methods consumed by cells/accesscore.WithMemBundle) so composition roots cannot accidentally pair primitives from different stores or substitute a non-store-paired TxRunner.
AI-robust: Hard. Go visibility makes mis-pairing inexpressible outside this package: zero-value Bundle{} has nil getters and is rejected by the existing phase0 validateRequiredDeps; valid bundles can only come from NewBundle. Reverse self-check: ACCESSCORE-BUNDLE-FUNNEL-01 archtest asserts cells/accesscore does not re-expose散装 WithUserRepository / WithRoleRepository / WithSetupLock / WithTxManager from its root.
Backstory: PR #595 review found cmd/corebundle/access_test_helper_test.go wired UserRepository + RoleRepository + SetupLock but forgot the store-paired TxRunner — silently falling back to outbox.DemoCellTxManager after Provisioner.mu was deleted. The Bundle funnel collapses that 4-option foot-gun into a single mandatory wire path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bundle ¶
type Bundle struct {
// contains filtered or unexported fields
}
Bundle is the mem-backed (UserRepository, RoleRepository, SetupLock, TxRunner) quadruple. Fields are unexported; cells/accesscore.WithMemBundle consumes the values via the exported accessor methods.
func NewBundle ¶
NewBundle constructs a mem-backed accesscore bundle. All four wired primitives originate from the same backing mem.Store, guaranteeing the cross-repo effective-admin invariant (S4.0) and serializing concurrent first-admin provisioning via store.mu.
clk is the clock used by the mem store (typically clock.Real() in production; tests inject deterministic clocks).
func (Bundle) RoleRepository ¶
func (b Bundle) RoleRepository() ports.RoleRepository
RoleRepository returns the bundle-paired RoleRepository view.
func (Bundle) SetupLock ¶
func (b Bundle) SetupLock() ports.SetupLockAcquirer
SetupLock returns the bundle-paired SetupLock (NoopSetupLock for mem; the store-paired TxRunner already serializes via store.mu).
func (Bundle) TxRunner ¶
func (b Bundle) TxRunner() persistence.CellTxManager
TxRunner returns the bundle-paired Store-bound CellTxManager.
func (Bundle) UserRepository ¶
func (b Bundle) UserRepository() ports.UserRepository
UserRepository returns the bundle-paired UserRepository view.