service

package
v1.1.15 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 58 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 TestTraceID = "00000000000000000000000000000000"

TestTraceID must be used everywhere a TraceID is required. It must be the same between tier1 and tier2, otherwise tier1 will not find the file produced by tier2 correctly.

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 TestTraceIDParam added in v1.1.3

func TestTraceIDParam() store.TraceIDParam

Types

type Option

type Option func(anyTierService)

func WithMaxWasmFuelPerBlockModule added in v1.0.0

func WithMaxWasmFuelPerBlockModule(maxFuel uint64) Option

func WithModuleExecutionTracing added in v1.1.4

func WithModuleExecutionTracing() Option

func WithPipelineOptions

func WithPipelineOptions(f pipeline.PipelineOptioner) Option

WithPipelineOptions is used to configure pipeline options for consumer outside of the substreams library itself, for example in chain specific Firehose implementations.

func WithWASMExtension

func WithWASMExtension(ext wasm.WASMExtensioner) Option

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,

	blockType string,

	parallelSubRequests uint64,
	stateBundleSize uint64,

	substreamsClientConfig *client.SubstreamsClientConfig,
	opts ...Option,
) *Tier1Service

func TestNewService added in v0.1.0

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

func (*Tier1Service) BlockType added in v1.0.2

func (s *Tier1Service) BlockType() string

func (*Tier1Service) Blocks added in v1.0.2

func (s *Tier1Service) Blocks(
	ctx context.Context,
	req *connect.Request[pbsubstreamsrpc.Request],
	stream *connect.ServerStream[pbsubstreamsrpc.Response],
) error

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,
	mergedBlocksStore dstore.Store,

	stateStore dstore.Store,
	defaultCacheTag string,
	stateBundleSize uint64,

	blockType string,
	opts ...Option,

) (s *Tier2Service)

func TestNewServiceTier2 added in v1.0.2

func TestNewServiceTier2(runtimeConfig config.RuntimeConfig, streamFactoryFunc StreamFactoryFunc) *Tier2Service

func (*Tier2Service) BlockType added in v1.0.2

func (s *Tier2Service) BlockType() string

func (*Tier2Service) ProcessRange added in v1.0.2

func (s *Tier2Service) ProcessRange(request *pbssinternal.ProcessRangeRequest, streamSrv pbssinternal.Substreams_ProcessRangeServer) (grpcError error)

func (*Tier2Service) TestProcessRange added in v1.1.9

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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