context

package
v0.73.6-patch.2 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrBlockHeightMissing = errors.New("no or invalid block height set on context")
	ErrChainIDMissing     = errors.New("no or invalid chain id set on context")
	ErrTxHashMissing      = errors.New("no or invalid transaction hash set on context")
)

Functions

func BlockHeightFromContext

func BlockHeightFromContext(ctx context.Context) (int64, error)

func ChainIDFromContext

func ChainIDFromContext(ctx context.Context) (string, error)

func InProgressUpgradeFrom added in v0.73.0

func InProgressUpgradeFrom(ctx context.Context, from string) bool

InProgressUpgradeFrom returns whether the data in the contexts tells us that the node is restoring from a snapshot taken for a protocol-upgrade by the given version.

func RemoteIPAddrFromContext

func RemoteIPAddrFromContext(ctx context.Context) (string, bool)

RemoteIPAddrFromContext returns the remote IP addr value stored in ctx, if any.

func TraceIDFromContext

func TraceIDFromContext(ctx context.Context) (context.Context, string)

TraceIDFromContext get traceID from context (add one if none is set).

func TxHashFromContext

func TxHashFromContext(ctx context.Context) (string, error)

func WithBlockHeight

func WithBlockHeight(ctx context.Context, h int64) context.Context

func WithChainID

func WithChainID(ctx context.Context, chainID string) context.Context

func WithRemoteIPAddr

func WithRemoteIPAddr(ctx context.Context, addr string) context.Context

WithRemoteIPAddr wrap the context into a new context and embed the ip addr as a key.

func WithSnapshotInfo added in v0.73.0

func WithSnapshotInfo(ctx context.Context, version string, upgrade bool) context.Context

func WithTraceID

func WithTraceID(ctx context.Context, tID string) context.Context

WithTraceID returns a context with a traceID value.

func WithTxHash

func WithTxHash(ctx context.Context, txHash string) context.Context

Types

This section is empty.

Jump to

Keyboard shortcuts

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