Documentation ¶
Overview ¶
Package txtimer watches for slow transactions and aborts them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GetReplayPosition ¶
type GetReplayPosition func(context.Context) (rpc.LogPosition, error)
GetReplayPosition returns the earliest position (log index and version) that might have a pending transaction. This is where reading the log will begin. It continues retrying until it succeeds; the only error it returns is a context error.
type Options ¶
type Options struct { // The minimum time after seeing a start transaction command before appending a // corresponding abort decision. The zero value defaults to 3s. AbortTxAfter time.Duration }
Options define optional arguments to New. The zero value of Options is usable.
type TxTimer ¶
type TxTimer struct {
// contains filtered or unexported fields
}
TxTimer watches for slow transactions and aborts them. A TxTimer must be constructed with New.
func New ¶
func New( backgroundCtx context.Context, aLog blog.AkutanLog, getReplayPosition GetReplayPosition, options Options, ) *TxTimer
New constructs a new TxTimer. The TxTimer will not do anything until Run is called. The given context is for the background activity of the TxTimer, not just for the call to New. The TxTimer will read from and append to aLog.
func (*TxTimer) LastApplied ¶
LastApplied returns the last applied log index. This method is thread safe.
func (*TxTimer) PendingTxs ¶
PendingTxs returns the number of pending transactions. This method is thread safe.