txscope

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: Apache-2.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AfterCommit added in v0.5.0

func AfterCommit(ctx context.Context, fn func(context.Context))

AfterCommit registers fn on the current transaction attempt. If no scope is active, fn runs immediately so callers remain safe outside retrying stores.

func WithIntent

func WithIntent(ctx context.Context, intent Intent) context.Context

WithIntent annotates ctx with the requested transaction intent.

Types

type AfterCommitScope added in v0.5.0

type AfterCommitScope struct {
	// contains filtered or unexported fields
}

AfterCommitScope collects effects that must run only after the surrounding datastore transaction commits. A new scope is required for every retry attempt so effects registered by an aborted attempt are discarded.

func WithAfterCommitScope added in v0.5.0

func WithAfterCommitScope(ctx context.Context) (context.Context, *AfterCommitScope)

WithAfterCommitScope attaches a fresh after-commit scope to ctx.

func (*AfterCommitScope) Run added in v0.5.0

func (s *AfterCommitScope) Run(ctx context.Context)

Run executes the actions registered by the committed transaction attempt.

type Intent

type Intent string

Intent describes the transaction intent attached to a request context.

const (
	IntentRead  Intent = "read"
	IntentWrite Intent = "write"
)

Jump to

Keyboard shortcuts

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