txinfo

package
v15.8.0-rc42 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TransactionMetadataKey is the key used to store transaction
	// information in the gRPC metadata.
	TransactionMetadataKey = "gitaly-reference-transaction"
)

Variables

View Source
var ErrTransactionNotFound = errors.New("transaction not found")

ErrTransactionNotFound indicates the transaction metadata could not be found

Functions

func InjectTransaction

func InjectTransaction(ctx context.Context, tranasctionID uint64, node string, primary bool) (context.Context, error)

InjectTransaction injects reference transaction metadata into an incoming context

Types

type Transaction

type Transaction struct {
	// BackchannelID is the ID of the backchannel that corresponds to the Praefect
	// that is handling the transaction. This field is filled in by the Gitaly.
	BackchannelID backchannel.ID `json:"backchannel_id,omitempty"`
	// ID is the unique identifier of a transaction
	ID uint64 `json:"id"`
	// Node is the name used to cast a vote
	Node string `json:"node"`
	// Primary identifies the node's role in this transaction
	Primary bool `json:"primary"`
}

Transaction stores parameters required to identify a reference transaction.

func TransactionFromContext

func TransactionFromContext(ctx context.Context) (Transaction, error)

TransactionFromContext extracts `Transaction` from an incoming context. In case the metadata key is not set, the function will return `ErrTransactionNotFound`.

Jump to

Keyboard shortcuts

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