Documentation ¶
Overview ¶
Package tcommit provides API interfaces and base primitives for transacrion commit protocol. Base types are `Manager` which specify interface for transaction manager (TM) and `Resource` for resource manager (RM). This API assumes that RM votes on the transaction that can be either prepared or aborted. RM also may know votes of other RMs but it's not required.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Manager ¶
type Manager interface { // Begin a transaction, update votes for RMs. // RM starts a transaction when it's prepared. RM doesn't // know if the transaction was started already, so it always // assume it's not started yet and calls begin-transaction of // TM. RM includes all known votes about the transaction // into this message, so TM has to merge all votes // and manage the transaction state correctly. If TM sees that // It receives a quorum of `prepared` votes for each RM, // it can decide to commit; or if it receives a quorum // of `abort` at least for one RM, it can decide to abort. Begin(context.Context, Votes, Meta) error // Finish a transaction. RM notifies about finished transaction. // TM counts finished RM to send synchronous response to the client // when all RMs are finished. TM already know the state of the transaction, // so it needs only a notification hint from RMs without state parameters. Finish(context.Context, NodeID, Meta) error }
Manager of the transaction (TM).
type Meta ¶
type Meta string
Meta is an optional additional transaction metadata that could be sent by RM and used by TM.
type Resource ¶
type Resource interface { // Commit the transaction Commit(context.Context) error // Abort the transaction Abort(context.Context) error }
Resource manager API
Click to show internal directories.
Click to hide internal directories.