service

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2024 License: Apache-2.0 Imports: 65 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var FailureBlacklistDuration = time.Minute * 10
View Source
var FailureBlacklistMinimalCount = 0

fail fast when the exact same request has already failed twice, preventing waste of tier2 resources

View Source
var FailureForcedBackoffIncrement = time.Millisecond * 500

hold the incoming request for this duration before answering with an error if the client keeps retrying

View Source
var FailureForcedBackoffLimit = time.Second * 30
View Source
var IsValidCacheTag = regexp.MustCompile(`^[a-zA-Z0-9_-]+$`).MatchString
View Source
var ValidateRequest = ValidateTier1Request

Deprecated: use ValidateTier1Request

Functions

func GetCommonServerOptions added in v1.1.6

func GetCommonServerOptions(listenAddr string, logger *zap.Logger, healthcheck dgrpcserver.HealthCheck) []dgrpcserver.Option

func ListenTier1 added in v1.1.6

func ListenTier1(
	addr string,
	svc *Tier1Service,
	auth dauth.Authenticator,
	logger *zap.Logger,
	healthcheck dgrpcserver.HealthCheck,
) error

func ListenTier2 added in v1.1.6

func ListenTier2(
	addr string,
	serviceDiscoveryURL *url.URL,
	svc *Tier2Service,
	auth dauth.Authenticator,
	logger *zap.Logger,
	healthcheck dgrpcserver.HealthCheck,
) (err error)

func RequestBackProcessing added in v1.8.0

func RequestBackProcessing(ctx context.Context, logger *zap.Logger, blockRange *block.Range, stageToProcess int, clientFactory client.InternalClientFactory, jobResult chan error)

func ValidateTier1Request added in v1.6.0

func ValidateTier1Request(request *pbsubstreamsrpc.Request, blockType string) error

ValidateTier1Request is run by the server code.

func ValidateTier2Request added in v1.6.0

func ValidateTier2Request(request *pbssinternal.ProcessRangeRequest) error

Types

type BlockFilter added in v1.6.0

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

type ExecutionPlan added in v1.6.0

type ExecutionPlan struct {
	ExistingExecOuts map[string]*execout.File
	ExecoutWriters   map[string]*execout.Writer
	ExistingIndices  map[string]map[string]*roaring64.Bitmap
	IndexWriters     map[string]*index.Writer
	RequiredModules  map[string]*pbsubstreams.Module
	StoresToWrite    map[string]struct{}
}

func GetExecutionPlan added in v1.6.0

func GetExecutionPlan(
	ctx context.Context,
	logger *zap.Logger,
	execGraph *exec.Graph,
	stage uint32,
	startBlock uint64,
	stopBlock uint64,
	outputModule string,
	execoutConfigs *execout.Configs,
	indexConfigs *index.Configs,
	storeConfigs store.ConfigMap,
) (*ExecutionPlan, error)

type LiveBackFiller added in v1.8.0

type LiveBackFiller struct {
	RequestBackProcessing RequestBackProcessingFunc
	NextHandler           bstream.Handler
	// contains filtered or unexported fields
}

func NewLiveBackFiller added in v1.8.0

func NewLiveBackFiller(nextHandler bstream.Handler, logger *zap.Logger, stageToProcess int, segmentSize uint64, linearHandoff uint64, clientFactory client.InternalClientFactory, requestBackProcessing RequestBackProcessingFunc) *LiveBackFiller

func (*LiveBackFiller) ProcessBlock added in v1.8.0

func (l *LiveBackFiller) ProcessBlock(blk *pbbstream.Block, obj interface{}) (err error)

func (*LiveBackFiller) Start added in v1.8.0

func (l *LiveBackFiller) Start(ctx context.Context)

type ModuleExecutionConfig added in v1.6.0

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

type NoopHandler added in v1.8.1

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

func NewNoopHandler added in v1.8.1

func NewNoopHandler(respFunc substreams.ResponseFunc) *NoopHandler

func (NoopHandler) ProcessBlock added in v1.8.1

func (n NoopHandler) ProcessBlock(blk *pbbstream.Block, obj interface{}) (err error)

type Option

type Option func(anyTierService)

func WithMaxConcurrentRequests added in v1.4.0

func WithMaxConcurrentRequests(max uint64) Option

func WithModuleExecutionTracing added in v1.1.4

func WithModuleExecutionTracing() Option

func WithReadinessFunc added in v1.4.0

func WithReadinessFunc(f func(bool)) Option

func WithWASMExtensioner added in v1.5.0

func WithWASMExtensioner(ext wasm.WASMExtensioner) Option

type RequestBackProcessingFunc added in v1.8.0

type RequestBackProcessingFunc = func(ctx context.Context, logger *zap.Logger, blockRange *block.Range, stageToProcess int, clientFactory client.InternalClientFactory, jobCompleted chan error)

type StreamFactory added in v0.0.21

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

func (*StreamFactory) GetHeadBlock added in v1.0.2

func (s *StreamFactory) GetHeadBlock() (uint64, error)

func (*StreamFactory) GetRecentFinalBlock added in v0.1.0

func (s *StreamFactory) GetRecentFinalBlock() (uint64, error)

func (*StreamFactory) New added in v0.0.21

func (sf *StreamFactory) New(
	ctx context.Context,
	h bstream.Handler,
	startBlockNum int64,
	stopBlockNum uint64,
	cursor string,
	finalBlocksOnly bool,
	cursorIsTarget bool,
	logger *zap.Logger,
) (Streamable, error)

type StreamFactoryFunc added in v0.1.0

type StreamFactoryFunc func(ctx context.Context,
	h bstream.Handler,
	startBlockNum int64,
	stopBlockNum uint64,
	cursor string,
	finalBlocksOnly bool,
	cursorIsTarget bool,
	logger *zap.Logger) (Streamable, error)

type Streamable added in v0.1.0

type Streamable interface {
	Run(ctx context.Context) error
}

type Tier1Service added in v1.0.2

type Tier1Service struct {
	*shutter.Shutter
	ssconnect.UnimplementedStreamHandler
	// contains filtered or unexported fields
}

func NewTier1 added in v1.0.2

func NewTier1(
	logger *zap.Logger,
	mergedBlocksStore dstore.Store,
	forkedBlocksStore dstore.Store,
	hub *hub.ForkableHub,

	stateStore dstore.Store,
	defaultCacheTag string,

	parallelSubRequests uint64,
	stateBundleSize uint64,
	blockType string,

	substreamsClientConfig *client.SubstreamsClientConfig,
	tier2RequestParameters reqctx.Tier2RequestParameters,
	opts ...Option,
) (*Tier1Service, error)

func TestNewService added in v0.1.0

func TestNewService(runtimeConfig config.RuntimeConfig, linearHandoffBlockNum uint64, streamFactoryFunc StreamFactoryFunc) *Tier1Service

func (*Tier1Service) Blocks added in v1.0.2

func (*Tier1Service) TestBlocks added in v1.0.2

func (s *Tier1Service) TestBlocks(ctx context.Context, isSubRequest bool, request *pbsubstreamsrpc.Request, respFunc substreams.ResponseFunc) error

type Tier2Service added in v1.0.2

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

func NewTier2 added in v1.0.2

func NewTier2(
	logger *zap.Logger,
	opts ...Option,
) (*Tier2Service, error)

func TestNewServiceTier2 added in v1.0.2

func TestNewServiceTier2(moduleExecutionTracing bool, streamFactoryFunc StreamFactoryFunc) *Tier2Service

func (*Tier2Service) ProcessRange added in v1.0.2

func (*Tier2Service) TestProcessRange added in v1.1.9

func (s *Tier2Service) TestProcessRange(ctx context.Context, request *pbssinternal.ProcessRangeRequest, respFunc substreams.ResponseFunc) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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