Documentation ¶
Overview ¶
Package committable provides an easy to use interface for creating committables.
Index ¶
- Variables
- type CommittableStore
- type SavepointCommittable
- func (a *SavepointCommittable) Begin(ctx context.Context, idempotencyKey []byte) error
- func (a *SavepointCommittable) BeginRecovery(ctx context.Context, idempotencyKey []byte) error
- func (a *SavepointCommittable) Cancel(ctx context.Context) error
- func (a *SavepointCommittable) Commit(ctx context.Context, idempotencyKey []byte) ([]byte, error)
- func (a *SavepointCommittable) Register(value []byte) error
- func (a *SavepointCommittable) SetIDFunc(idFn func() ([]byte, error))
- func (a *SavepointCommittable) Skip() bool
Constants ¶
This section is empty.
Variables ¶
var ( // used to identify the last used idempotency key in the store IdempotencyKeyKey = []byte("idempotencyKey") // used to identify the last used apphash in the store ApphashKey = []byte("apphash") )
Functions ¶
This section is empty.
Types ¶
type CommittableStore ¶
type SavepointCommittable ¶
type SavepointCommittable struct {
// contains filtered or unexported fields
}
SavepointCommittable is a committable that can be used to commit a savepoint.
func New ¶
func New(db CommittableStore) *SavepointCommittable
func (*SavepointCommittable) Begin ¶
func (a *SavepointCommittable) Begin(ctx context.Context, idempotencyKey []byte) error
Begin begins a session for the account store. It will check the stored idempotency key and return an error if it is the same as the one provided.
func (*SavepointCommittable) BeginRecovery ¶
func (a *SavepointCommittable) BeginRecovery(ctx context.Context, idempotencyKey []byte) error
BeginRecovery begins a session for the account store in recovery mode. If the idempotency key is the same as the last used one, it will skip all incoming spends.
func (*SavepointCommittable) Cancel ¶
func (a *SavepointCommittable) Cancel(ctx context.Context) error
Cancel cancels the session for the committables.
func (*SavepointCommittable) Register ¶
func (a *SavepointCommittable) Register(value []byte) error
Register registers a value to be used in the commit hash.
func (*SavepointCommittable) SetIDFunc ¶
func (a *SavepointCommittable) SetIDFunc(idFn func() ([]byte, error))
SetIDFunc sets the id function.
func (*SavepointCommittable) Skip ¶
func (a *SavepointCommittable) Skip() bool
Skip returns whether or not the committable is in skip mode.