Documentation ¶
Overview ¶
Package transaction implements a distributed transaction handling framework
Index ¶
Constants ¶
View Source
const ( //Leader is a constant string representing the leader node Leader = "leader" //All is a contant string representing all the nodes in a transaction All = "all" )
Variables ¶
This section is empty.
Functions ¶
func CreateLockStepFunc ¶
CreateLockStepFunc returns a lock and an unlock StepFunc which lock/unlock the given key
Types ¶
type SimpleTxn ¶
type SimpleTxn struct { // Ctx is the transaction context Ctx *context.Context // Nodes are the nodes where the stage and commit functions are performed Nodes []string // LockKey is the key to be locked LockKey string // Stage function verifies if the node can perform an operation. Stage StepFunc // Commit performs the operation on the a node Commit StepFunc // Store stores the results of an operation. This will only be run on the leader Store StepFunc // Rollback rollsback any changes done by Commit Rollback StepFunc }
SimpleTxn is transaction with fixed stage, commit and store steps
type Step ¶
Step is a combination of a StepFunc and a list of nodes the step is supposed to be run on
DoFunc performs does the action UndoFunc undoes anything done by DoFunc
type Txn ¶
Txn is a set of steps
Nodes is a union of the all the TxnStep.Nodes
Click to show internal directories.
Click to hide internal directories.