kvclientutils

package
v0.0.0-...-1dc08c0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPushResult

func CheckPushResult(
	ctx context.Context,
	db *kv.DB,
	txn roachpb.Transaction,
	expResolution ExpectedTxnResolution,
	pushExpectation PushExpectation,
) error

CheckPushResult pushes the specified txn and checks that the pushee's resolution is the expected one.

func StrToCPutExistingValue

func StrToCPutExistingValue(s string) []byte

StrToCPutExistingValue takes a string that was written using, say, a Put and returns the bytes that can be passed to a Batch.CPut() as the expected value resulting from said Put.

Types

type ExpectedTxnResolution

type ExpectedTxnResolution int

ExpectedTxnResolution expresses an expectation for CheckPushResult about the outcome of the push.

const (
	// ExpectAborted means that the pushee is expected to have been aborted. Note
	// that a committed txn that has been cleaned up also results in an ABORTED
	// result for a pusher.
	ExpectAborted ExpectedTxnResolution = iota
	// ExpectCommitted means that the pushee is expected to have found the pushee
	// to be committed - or STAGING in which case the push will have performed
	// successful transaction recovery.
	ExpectCommitted
)

type PushExpectation

type PushExpectation int

PushExpectation expresses an expectation for CheckPushResult about what the push did.

const (
	// ExpectPusheeTxnRecovery means we're expecting transaction recovery to be
	// performed (after finding a STAGING txn record).
	ExpectPusheeTxnRecovery PushExpectation = iota
	// ExpectPusheeTxnRecordNotFound means we're expecting the push to not find the
	// pushee txn record.
	ExpectPusheeTxnRecordNotFound
	// DontExpectAnything means we're not going to check the state in which the
	// pusher found the pushee's txn record.
	DontExpectAnything
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL