work

package
v1.15.6 Latest Latest
Warning

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

Go to latest
Published: May 21, 2025 License: Apache-2.0 Imports: 33 Imported by: 1

Documentation

Index

Constants

View Source
const FreeWorkerKeyPrefix = "FREE.WORKER.KEY:"
View Source
const Tier1RequestServiceName = "t1r"
View Source
const Tier2WorkerServiceName = "t2w"

Variables

View Source
var ErrConnectionRefused = errors.New("connection refused")
View Source
var ErrorResourceExhausted = errors.New("resource exhausted")
View Source
var ErrorResourceExhaustedRampUp = errors.New("resource exhausted during ramp up")

Functions

func CmdDelayedScheduleNextJob added in v1.13.0

func CmdDelayedScheduleNextJob(triggerBy string) loop.Cmd

func CmdScheduleNextJob added in v1.1.9

func CmdScheduleNextJob(triggerBy string) loop.Cmd

func NewRequest added in v1.1.9

func NewRequest(ctx context.Context, req *reqctx.RequestDetails, stageIndex int, startBlock uint64) *pbssinternal.ProcessRangeRequest

Types

type DelayedMsgScheduleNextJob added in v1.13.0

type DelayedMsgScheduleNextJob struct {
	loop.IsMsg
	TriggerBy string
}

type GlobalWorkerPool added in v1.13.0

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

func NewGlobalWorkerPool added in v1.13.0

func NewGlobalWorkerPool(ctx context.Context, userID string, apiKeyID string, traceID string, maxWorkerForTraceID uint64, remoteWorkerPoolClient pbworker.WorkerPoolClient, clientFactory client.InternalClientFactory, workerKeepAliveDelay time.Duration) *GlobalWorkerPool

func (*GlobalWorkerPool) Borrow added in v1.13.0

func (p *GlobalWorkerPool) Borrow(ctx context.Context) (Worker, error)

func (*GlobalWorkerPool) RampingUp added in v1.13.0

func (p *GlobalWorkerPool) RampingUp() bool

func (*GlobalWorkerPool) Return added in v1.13.0

func (p *GlobalWorkerPool) Return(ctx context.Context, worker Worker)

type GlobalWorkerPoolFactory added in v1.13.0

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

func NewGlobalWorkerPoolFactory added in v1.13.0

func NewGlobalWorkerPoolFactory(remoteWorkerPool pbworker.WorkerPoolClient, clientFactory client.InternalClientFactory, workerKeepAliveDelay time.Duration) *GlobalWorkerPoolFactory

func (*GlobalWorkerPoolFactory) WorkerPool added in v1.13.0

type MsgJobFailed added in v1.1.9

type MsgJobFailed struct {
	loop.IsMsg
	Unit   stage.Unit
	Worker Worker
	Error  error
}

type MsgJobSucceeded added in v1.1.9

type MsgJobSucceeded struct {
	loop.IsMsg
	Unit   stage.Unit
	Worker Worker
}

type MsgPendingShutdown added in v1.14.3

type MsgPendingShutdown struct {
	loop.IsMsg
}

type MsgScheduleNextJob added in v1.1.9

type MsgScheduleNextJob struct {
	loop.IsMsg
	TriggerBy string
}

type RemoteWorker

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

func NewRemoteWorker

func NewRemoteWorker(clientFactory client.InternalClientFactory, id string, logger *zap.Logger) *RemoteWorker

func (*RemoteWorker) ID added in v0.2.0

func (w *RemoteWorker) ID() string

func (*RemoteWorker) StartKeepAlive added in v1.13.0

func (r *RemoteWorker) StartKeepAlive(ctx context.Context, delay time.Duration, remoteWorkerPoolClient pbworker.WorkerPoolClient)

func (*RemoteWorker) StopKeepAlive added in v1.13.0

func (r *RemoteWorker) StopKeepAlive()

func (*RemoteWorker) Work

func (w *RemoteWorker) Work(ctx context.Context, unit stage.Unit, startBlock uint64, moduleNames []string, upstream *response.Stream) loop.Cmd

type Result

type Result struct {
	PartialFilesWritten store.FileInfos
	Error               error
}

type RetryableErr

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

func NewRetryableErr added in v1.1.1

func NewRetryableErr(cause error) *RetryableErr

func (*RetryableErr) Error

func (r *RetryableErr) Error() string

func (*RetryableErr) Unwrap added in v1.14.3

func (r *RetryableErr) Unwrap() error

type SimpleWorkerFactory added in v0.2.0

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

func NewWorkerFactoryFromFunc added in v0.2.0

func NewWorkerFactoryFromFunc(f func(ctx context.Context, unit stage.Unit, startBlock uint64, moduleNames []string, upstream *response.Stream) loop.Cmd) *SimpleWorkerFactory

func (SimpleWorkerFactory) ID added in v0.2.0

func (f SimpleWorkerFactory) ID() string

func (SimpleWorkerFactory) StartKeepAlive added in v1.13.0

func (f SimpleWorkerFactory) StartKeepAlive(ctx context.Context, delay time.Duration, remoteWorkerPoolClient pbworker.WorkerPoolClient)

func (SimpleWorkerFactory) StopKeepAlive added in v1.13.0

func (f SimpleWorkerFactory) StopKeepAlive()

func (SimpleWorkerFactory) Work added in v0.2.0

func (f SimpleWorkerFactory) Work(ctx context.Context, unit stage.Unit, startBlock uint64, moduleNames []string, upstream *response.Stream) loop.Cmd

type SimpleWorkerPool added in v1.13.0

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

func NewSimpleWorkerPool added in v1.13.0

func NewSimpleWorkerPool(ctx context.Context, workerCount int, clientFactory client.InternalClientFactory) *SimpleWorkerPool

func (*SimpleWorkerPool) Borrow added in v1.13.0

func (p *SimpleWorkerPool) Borrow(_ context.Context) (Worker, error)

func (*SimpleWorkerPool) RampingUp added in v1.13.0

func (p *SimpleWorkerPool) RampingUp() bool

func (*SimpleWorkerPool) Return added in v1.13.0

func (p *SimpleWorkerPool) Return(_ context.Context, worker Worker)

type SimpleWorkerPoolFactory added in v1.13.0

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

func NewSimpleWorkerPoolFactory added in v1.13.0

func NewSimpleWorkerPoolFactory(clientFactory client.InternalClientFactory) *SimpleWorkerPoolFactory

func (*SimpleWorkerPoolFactory) WorkerPool added in v1.13.0

type TestWorkerPool added in v1.13.0

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

func NewTestWorkerPool added in v1.13.0

func NewTestWorkerPool(t *testing.T, workerFactory func(ctx context.Context) Worker) *TestWorkerPool

func (*TestWorkerPool) Borrow added in v1.13.0

func (t *TestWorkerPool) Borrow(ctx context.Context) (Worker, error)

func (*TestWorkerPool) RampingUp added in v1.13.0

func (t *TestWorkerPool) RampingUp() bool

func (*TestWorkerPool) Return added in v1.13.0

func (t *TestWorkerPool) Return(ctx context.Context, worker Worker)

type Worker

type Worker interface {
	ID() string
	Work(ctx context.Context, unit stage.Unit, startBlock uint64, moduleNames []string, upstream *response.Stream) loop.Cmd // *Result
	StartKeepAlive(ctx context.Context, delay time.Duration, remoteWorkerPoolClient pbworker.WorkerPoolClient)
	StopKeepAlive()
}

type WorkerPool

type WorkerPool interface {
	Borrow(ctx context.Context) (Worker, error)
	Return(ctx context.Context, worker Worker)
	RampingUp() bool
}

type WorkerPoolFactory added in v1.13.0

type WorkerPoolFactory func(ctx context.Context) WorkerPool

type WorkerState added in v1.1.9

type WorkerState int

Jump to

Keyboard shortcuts

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