Documentation
¶
Index ¶
Constants ¶
const ( InventoryReserveConsumer = "subscription.inventory_reserve" InventoryRestoreConsumer = "subscription.inventory_restore" )
Inbox consumers for the plan-inventory lifecycle (ADR-001 step 2). Reservation and restoration are subscription-domain writes that used to sit inside billing transactions; the idempotent inbox keys them by order number so the purchase flow, the activation safety net and the close-order compensation can each run at-least-once without double-moving stock.
Variables ¶
var ErrOutOfStock = errors.New("subscribe out of stock")
ErrOutOfStock reports that the plan has no inventory left to reserve.
Functions ¶
This section is empty.
Types ¶
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func (*Service) Reserve ¶
Reserve commits one unit and its inbox marker in the same subscription transaction. A duplicate marker rolls back a concurrent losing reservation.
type Store ¶
type Store interface {
Inbox() repository.InboxRepo
InSubscriptionTx(ctx context.Context, fn func(repository.SubscriptionStore) error) error
}
Store is the narrow persistence surface the inventory lifecycle needs; the repository store satisfies it structurally.