Documentation
¶
Overview ¶
Package postgres provides durable atomic capability consumption through database/sql and PostgreSQL row locks. The caller supplies the SQL driver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConsumptionStore ¶
type ConsumptionStore struct {
// contains filtered or unexported fields
}
ConsumptionStore owns durable PostgreSQL transactions for replay state.
func NewConsumptionStore ¶
func NewConsumptionStore(db *sql.DB) (*ConsumptionStore, error)
NewConsumptionStore binds store to db. The schema in migrations must be installed before use. db remains caller-owned and is never closed here.
func (*ConsumptionStore) Consume ¶
func (store *ConsumptionStore) Consume(ctx context.Context, request capability.Consumption) (capability.ConsumptionResult, error)
Consume serializes one capability row, then commits an increment only when the signed identity and use bound match. Commit errors have unknown outcome.
Click to show internal directories.
Click to hide internal directories.