work

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Oct 31, 2022 License: Apache-2.0 Imports: 21 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FullStoreFile

type FullStoreFile = block.Range

type Job

type Job struct {
	ModuleName   string // target
	RequestRange *block.Range
	// contains filtered or unexported fields
}

Job is a single unit of scheduling, meaning it is a request that goes to a remote gRPC service for execution.

func NewJob

func NewJob(storeName string, requestRange *block.Range, requiredModules []string, priority int) *Job

func TestJob

func TestJob(modName string, rng string, prio int) *Job

func TestJobDeps

func TestJobDeps(modName string, rng string, prio int, deps string) *Job

func (*Job) CreateRequest

func (j *Job) CreateRequest(originalModules *pbsubstreams.Modules) *pbsubstreams.Request

func (*Job) MarshalLogObject

func (j *Job) MarshalLogObject(enc zapcore.ObjectEncoder) error

func (*Job) String

func (j *Job) String() string

type ModuleStorageState

type ModuleStorageState struct {
	ModuleName         string
	ModuleInitialBlock uint64

	InitialCompleteRange *FullStoreFile // Points to a complete .kv file, to initialize the store upon getting started.
	PartialsMissing      PartialStoreFiles
	PartialsPresent      PartialStoreFiles
}

ModuleStorageState contains all the file-related ranges of things we'll want to plan work for, and things that are already available.

func TestModState

func TestModState(modName string, rng string) *ModuleStorageState

func (*ModuleStorageState) MarshalLogObject

func (w *ModuleStorageState) MarshalLogObject(enc zapcore.ObjectEncoder) error

type ModuleStorageStateMap

type ModuleStorageStateMap map[string]*ModuleStorageState

func TestModStateMap

func TestModStateMap(modStates ...*ModuleStorageState) (out ModuleStorageStateMap)

type PartialStoreFile

type PartialStoreFile = block.Range

type PartialStoreFiles

type PartialStoreFiles = block.Ranges

type Plan

type Plan struct {
	ModulesStateMap ModuleStorageStateMap
	// contains filtered or unexported fields
}

func BuildNewPlan

func BuildNewPlan(ctx context.Context, storeConfigMap store.ConfigMap, storeSnapshotsSaveInterval, subrequestSplitSize, upToBlock uint64, graph *manifest.ModuleGraph) (*Plan, error)

func TestPlanReadyJobs

func TestPlanReadyJobs(jobs ...*Job) *Plan

func (*Plan) MarkDependencyComplete

func (p *Plan) MarkDependencyComplete(modName string, upToBlock uint64)

func (*Plan) NextJob

func (p *Plan) NextJob() (job *Job, more bool)

func (*Plan) SendInitialProgressMessages

func (p *Plan) SendInitialProgressMessages(respFunc substreams.ResponseFunc) error

type Prioritizer

type Prioritizer interface {
	Sort(jobs []*Job) []*Job
}

type RemoteWorker

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

func NewRemoteWorker

func NewRemoteWorker(clientFactory client.Factory, logger *zap.Logger) *RemoteWorker

func (*RemoteWorker) Work

func (w *RemoteWorker) Work(ctx context.Context, request *pbsubstreams.Request, respFunc substreams.ResponseFunc) *Result

type Result

type Result struct {
	PartialsWritten []*block.Range
	Error           error
}

type RetryableErr

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

func (*RetryableErr) Error

func (r *RetryableErr) Error() string

type Snapshot

type Snapshot struct {
	block.Range
	Path string
}

type Snapshots

type Snapshots struct {
	Completes block.Ranges // Shortest completes first, largest last.
	Partials  block.Ranges // First partials first, last last
}

func (*Snapshots) ContainsPartial

func (s *Snapshots) ContainsPartial(r *block.Range) bool

func (*Snapshots) LastCompleteSnapshotBefore

func (s *Snapshots) LastCompleteSnapshotBefore(blockNum uint64) *block.Range

func (*Snapshots) LastCompletedBlock

func (s *Snapshots) LastCompletedBlock() uint64

func (*Snapshots) Sort

func (s *Snapshots) Sort()

func (*Snapshots) String

func (s *Snapshots) String() string

type StorageState

type StorageState struct {
	sync.Mutex
	Snapshots map[string]*Snapshots
}

func (*StorageState) String

func (s *StorageState) String() string

type Worker

type Worker interface {
	Work(ctx context.Context, request *pbsubstreams.Request, respFunc substreams.ResponseFunc) *Result
}

type WorkerFactory

type WorkerFactory = func(logger *zap.Logger) Worker

The tracer will be provided by the worker pool, on worker creation

type WorkerFunc

type WorkerFunc func(ctx context.Context, request *pbsubstreams.Request, respFunc substreams.ResponseFunc) *Result

func (WorkerFunc) Work

func (f WorkerFunc) Work(ctx context.Context, request *pbsubstreams.Request, respFunc substreams.ResponseFunc) *Result

type WorkerPool

type WorkerPool interface {
	Borrow(context.Context) Worker
	Return(Worker)
}

func NewWorkerPool

func NewWorkerPool(ctx context.Context, workerCount uint64, newWorkerFunc WorkerFactory) WorkerPool

Jump to

Keyboard shortcuts

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