Documentation ¶
Index ¶
- type ReadyTx
- type Saga
- type Storage
- type Tx
- func (tx *Tx) CompensateSubTx(logData log.Log) error
- func (tx *Tx) End() error
- func (tx *Tx) ExecSubTx(subTxID string, args ...interface{}) error
- func (tx *Tx) ExecSubTxAndGetResult(subTxID string, args ...interface{}) ([]reflect.Value, error)
- func (tx *Tx) IsTxIDAlreadyInUse() (bool, error)
- func (tx *Tx) Rollback(tryCount int) error
- func (tx *Tx) RollbackWithInfiniteTries()
- func (tx *Tx) SetContext(ctx context.Context)
- func (tx *Tx) SetLogger(l trace.Logger)
- func (tx *Tx) Start() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ReadyTx ¶
type ReadyTx interface { Start() error ExecSubTx(subTxID string, args ...interface{}) error ExecSubTxAndGetResult(subTxID string, args ...interface{}) ([]reflect.Value, error) End() error SetLogger(l trace.Logger) SetContext(ctx context.Context) RollbackWithInfiniteTries() Rollback(tryCount int) error IsTxIDAlreadyInUse() (bool, error) }
ReadyTx is the Ready-Transaction that exposes the executable actions for the Saga Transaction
type Saga ¶
type Saga interface { GetSubTxDef(subTxID string) (subtx.Definition, error) MarshallArgs(args []interface{}) ([]log.ArgData, error) UnmarshallArgs(argData []log.ArgData) ([]reflect.Value, error) }
Saga is the dependency for Transaction that keeps Sub-Transaction definitions.
type Storage ¶
type Storage interface { TxIDAlreadyExists(string) (bool, error) AppendLog(string, string) error GetTxLogs(id string) ([]string, error) }
Storage is the dependency for Transaction that provides persistence to Saga
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is the Transaction object to perfrom sub-transactions in the Saga
func (*Tx) ExecSubTx ¶
ExecSubTx executes the sub-transaction that's already defined in saga and identified by the identifier
func (*Tx) ExecSubTxAndGetResult ¶
ExecSubTxAndGetResult executes and returns the results of the sub-transaction that's already defined in saga and identified by the identifier
func (*Tx) IsTxIDAlreadyInUse ¶
IsTxIDAlreadyInUse checks if TxID is already in use i.e. another Tx was already initiated.
func (*Tx) Rollback ¶
Rollback tries rolling back the transaction. If rollback is failing it'll try rolling back only tryCount times.
func (*Tx) RollbackWithInfiniteTries ¶
func (tx *Tx) RollbackWithInfiniteTries()
RollbackWithInfiniteTries tries rolling back the transaction. It'll keep retrying the rollback until it's successful.
func (*Tx) SetContext ¶
SetContext to change the Transaction context.