cockroach: github.com/cockroachdb/cockroach/pkg/testutils/kvclientutils Index | Files

package kvclientutils

import "github.com/cockroachdb/cockroach/pkg/testutils/kvclientutils"

Index

Package Files

api.go txn_recovery.go

func CheckPushResult Uses

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 Uses

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.

type ExpectedTxnResolution Uses

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 Uses

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
)

Package kvclientutils imports 7 packages (graph). Updated 2020-08-12. Refresh now. Tools for package owners.