reqctx

package
v1.17.8-partialblocks Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const DefaultMaxStageLayerParallelExecutorCount = 2
View Source
const HeaderCacheTag = "x-substreams-cache-tag"
View Source
const HeaderParallelWorkers = "x-substreams-parallel-workers"

Variables

View Source
var WithLogger = logging.WithLogger

Functions

func ActiveRequestsHandler added in v1.17.3

func ActiveRequestsHandler(ctx context.Context) *active_requests.ActiveRequestsHandler

func CancelFunc added in v1.16.5

func CancelFunc(ctx context.Context) context.CancelCauseFunc

func Emitter added in v1.6.0

func EthCallFallbackToLatestDuration added in v1.17.8

func EthCallFallbackToLatestDuration(ctx context.Context) time.Duration

func GetEffectiveHeaderValues added in v1.16.4

func GetEffectiveHeaderValues(ctx context.Context, headers http.Header, defaultParallelJobs uint64, defaultParallelExecutors uint64) (parallelJobs uint64, parallelExecutors uint64)

GetEffectiveHeaderValues compares the request headers to the 'trusted headers' sent by the authentication layer. It contains some business logic:

  • prevents overriding the numeric values to lower ones for parallel jobs and stage layer executors

func GetSessionKey added in v1.16.5

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

func HasBackfillerRequest added in v1.10.1

func HasBackfillerRequest(ctx context.Context) bool

func IncludePartialBlocks added in v1.17.8

func IncludePartialBlocks(ctx context.Context) bool

func IsBackfillerRequest added in v1.10.1

func IsBackfillerRequest(ctx context.Context) bool

func Logger

func Logger(ctx context.Context) *zap.Logger

func MaxStageLayerParallelExecutor added in v1.13.0

func MaxStageLayerParallelExecutor(ctx context.Context) uint64

MaxStageLayerParallelExecutor returns the maximum number of parallel executors (e.g. go routines) that can be executed at the same time for a particular stage's layer as configured and accepted by the auth plugin.

If the request is in development mode, returns 1. If the value is not set, returns the default value which is 2.

func ModuleExecutionTracing added in v1.1.4

func ModuleExecutionTracing(ctx context.Context) bool

func OutputModuleHash added in v1.10.9

func OutputModuleHash(ctx context.Context) string

func PartialBlocksOnly added in v1.17.8

func PartialBlocksOnly(ctx context.Context) bool

func ReqStats

func ReqStats(ctx context.Context) *metrics.Stats

func Spkg added in v1.17.0

func Tracer

func Tracer(ctx context.Context) ttrace.Tracer

func WasmExtensionReqStats added in v1.13.0

func WasmExtensionReqStats(ctx context.Context) metrics.WasmExtensionStats

func WithActiveRequestsHandler added in v1.17.3

func WithActiveRequestsHandler(ctx context.Context, reqMgr *active_requests.ActiveRequestsHandler) context.Context

func WithBackfillerRequest added in v1.10.1

func WithBackfillerRequest(ctx context.Context) context.Context

func WithCancelFunc added in v1.16.5

func WithCancelFunc(ctx context.Context, f context.CancelCauseFunc) context.Context

func WithEmitter added in v1.6.0

func WithEmitter(ctx context.Context, emitter dmetering.EventEmitter) context.Context

func WithEthCallFallbackToLatestDuration added in v1.17.8

func WithEthCallFallbackToLatestDuration(ctx context.Context, duration time.Duration) context.Context

func WithIncludePartialBlocks added in v1.17.8

func WithIncludePartialBlocks(ctx context.Context, includePartialblocks bool) context.Context

func WithModuleExecutionTracing added in v1.1.4

func WithModuleExecutionTracing(ctx context.Context) context.Context

func WithOutputModuleHash added in v1.10.9

func WithOutputModuleHash(ctx context.Context, hash string) context.Context

func WithPartialBlocksOnly added in v1.17.8

func WithPartialBlocksOnly(ctx context.Context, partialBlocksOnly bool) context.Context

func WithReqStats

func WithReqStats(ctx context.Context, stats *metrics.Stats) context.Context

func WithRequest

func WithRequest(ctx context.Context, req *RequestDetails) context.Context

func WithSessionKey added in v1.16.5

func WithSessionKey(ctx context.Context, key string) context.Context

func WithSpkg added in v1.17.0

func WithSpkg(ctx context.Context, pkg *pbsubstreams.Package) context.Context

func WithTier2RequestParameters added in v1.5.0

func WithTier2RequestParameters(ctx context.Context, parameters Tier2RequestParameters) context.Context

func WithTracer

func WithTracer(ctx context.Context, tracer ttrace.Tracer) context.Context

func WithWasmExtensionReqStats added in v1.13.0

func WithWasmExtensionReqStats(ctx context.Context, stats metrics.WasmExtensionStats) context.Context

Types

type ISpan

type ISpan interface {
	// End completes the Span. The Span is considered complete and ready to be
	// delivered through the rest of the telemetry pipeline after this method
	// is called. Therefore, updates to the Span are not allowed after this
	// method has been called.
	End(options ...ttrace.SpanEndOption)

	// AddEvent adds an event with the provided name and options.
	AddEvent(name string, options ...ttrace.EventOption)

	// IsRecording returns the recording state of the Span. It will return
	// true if the Span is active and events can be recorded.
	IsRecording() bool

	// RecordError will record err as an exception span event for this span. An
	// additional call to SetStatus is required if the Status of the Span should
	// be set to Error, as this method does not change the Span status. If this
	// span is not being recorded or err is nil then this method does nothing.
	RecordError(err error, options ...ttrace.EventOption)

	// SpanContext returns the SpanContext of the Span. The returned SpanContext
	// is usable even after the End method has been called for the Span.
	SpanContext() ttrace.SpanContext

	// SetStatus sets the status of the Span in the form of a code and a
	// description, provided the status hasn't already been set to a higher
	// value before (OK > Error > Unset). The description is only included in a
	// status when the code is for an error.
	SetStatus(code codes.Code, description string)

	// SetName sets the Span name.
	SetName(name string)

	// SetAttributes sets kv as attributes of the Span. If a key from kv
	// already exists for an attribute of the Span it will be overwritten with
	// the value contained in kv.
	SetAttributes(kv ...attribute.KeyValue)

	// TracerProvider returns a TracerProvider that can be used to generate
	// additional Spans on the same telemetry pipeline as the current Span.
	TracerProvider() ttrace.TracerProvider

	EndWithErr(e *error)
}

func Span

func Span(ctx context.Context) ISpan

func WithModuleExecutionSpan added in v1.1.4

func WithModuleExecutionSpan(ctx context.Context, name string) (context.Context, ISpan)

func WithSpan

func WithSpan(ctx context.Context, name string) (context.Context, ISpan)

type IsOutputModuleFunc added in v0.1.0

type IsOutputModuleFunc func(name string) bool

type NoopSpan added in v1.3.6

type NoopSpan struct{}

NoopSpan is an implementation of span that preforms no operations.

func (*NoopSpan) AddEvent added in v1.3.6

func (n *NoopSpan) AddEvent(string, ...ttrace.EventOption)

AddEvent does nothing.

func (*NoopSpan) End added in v1.3.6

func (n *NoopSpan) End(...ttrace.SpanEndOption)

End does nothing.

func (*NoopSpan) EndWithErr added in v1.3.6

func (n *NoopSpan) EndWithErr(e *error)

func (*NoopSpan) IsRecording added in v1.3.6

func (n *NoopSpan) IsRecording() bool

IsRecording always returns false.

func (*NoopSpan) RecordError added in v1.3.6

func (n *NoopSpan) RecordError(error, ...ttrace.EventOption)

RecordError does nothing.

func (*NoopSpan) SetAttributes added in v1.3.6

func (n *NoopSpan) SetAttributes(...attribute.KeyValue)

SetAttributes does nothing.

func (*NoopSpan) SetError added in v1.3.6

func (n *NoopSpan) SetError(bool)

SetError does nothing.

func (*NoopSpan) SetName added in v1.3.6

func (n *NoopSpan) SetName(string)

SetName does nothing.

func (*NoopSpan) SetStatus added in v1.3.6

func (n *NoopSpan) SetStatus(codes.Code, string)

SetStatus does nothing.

func (*NoopSpan) SpanContext added in v1.3.6

func (n *NoopSpan) SpanContext() ttrace.SpanContext

SpanContext returns an empty span context.

func (*NoopSpan) TracerProvider added in v1.3.6

func (n *NoopSpan) TracerProvider() ttrace.TracerProvider

TracerProvider returns a no-op TracerProvider.

type RequestDetails added in v0.1.0

type RequestDetails struct {
	Modules *pbsubstreams.Modules

	DebugInitialStoreSnapshotForModules []string
	OutputModule                        string
	// What the user requested, derived from either the Request.StartBlockNum or Request.Cursor
	ResolvedStartBlockNum uint64
	ResolvedCursor        string

	LinearHandoffBlockNum         uint64
	LinearGateBlockNum            uint64
	StopBlockNum                  uint64
	MaxParallelJobs               uint64
	MaxStageLayerParallelExecutor uint64
	LimitProcessedBlocks          uint64
	UpdateInterval                time.Duration
	UniqueID                      uint64

	ProductionMode   bool
	IsTier2Request   bool
	IsStreamingTier2 bool // special mode where tier2 will stream the data back to tier1, for the first segment
	Tier2Stage       int
}

func Details

func Details(ctx context.Context) *RequestDetails

func (*RequestDetails) AssertProcessedBlocksLimit added in v1.14.3

func (d *RequestDetails) AssertProcessedBlocksLimit(requiredBlocksStore, requiredBlocksRange uint64) error

func (*RequestDetails) IsOutputModule added in v0.1.0

func (d *RequestDetails) IsOutputModule(modName string) bool

func (*RequestDetails) ShouldReturnWrittenPartials added in v1.0.2

func (d *RequestDetails) ShouldReturnWrittenPartials(modName string) bool

func (*RequestDetails) ShouldStreamCachedOutputs added in v0.1.0

func (d *RequestDetails) ShouldStreamCachedOutputs() bool

func (*RequestDetails) UniqueIDString added in v1.1.4

func (d *RequestDetails) UniqueIDString() string

type Tier2RequestParameters added in v1.5.0

type Tier2RequestParameters struct {
	MeteringConfig       string
	FirstStreamableBlock uint64

	MergedBlockStoreURL  string
	StateStoreURL        string
	StateBundleSize      uint64
	StateStoreDefaultTag string

	BlockType string

	WASMModules                map[string]string
	FoundationalStoreEndpoints map[string]string
}

func GetTier2RequestParameters added in v1.5.0

func GetTier2RequestParameters(ctx context.Context) (Tier2RequestParameters, bool)

type TracingConf added in v1.1.4

type TracingConf struct {
	ModuleExecution bool
}

func NewTracingConf added in v1.1.4

func NewTracingConf(
	moduleExecution bool,
) *TracingConf

Jump to

Keyboard shortcuts

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