grpcoperator

package
v0.106.8-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package grpcoperator serves v1.OperatorService, the engine API for operators that run outside the engine process (kind = GRPC in v1_operator). It owns operator and worker registration and the Listen stream, and delegates task-event and durable-task RPCs to the dispatcher.

Index

Constants

View Source
const (
	// DefaultMaxListenStreamsPerOperator caps the Listen streams one operator may hold open on
	// this engine replica at once. Every stream is a live worker with its own session and
	// action set, so the cap bounds what one tenant token can allocate here.
	DefaultMaxListenStreamsPerOperator = 100

	// DefaultMaxActionsPerOperator caps the action links held across all workers of one
	// operator. Deltas that would exceed it are refused with ResourceExhausted.
	DefaultMaxActionsPerOperator = 1_000_000
)
View Source
const (

	// MaxActionsPerDelta caps the ids (adds plus removes) one OperatorActionsDelta may carry.
	MaxActionsPerDelta = 1000
)
View Source
const OperatorIdMetadataKey = "hatchet-operator-id"

OperatorIdMetadataKey is the incoming gRPC metadata key that carries the operator id on every RPC after Register (Listen, SendStepActionEvent, DurableTask).

Variables

This section is empty.

Functions

This section is empty.

Types

type OperatorService

type OperatorService interface {
	v1contracts.OperatorServiceServer
	Cleanup() error
}

type OperatorServiceImpl

type OperatorServiceImpl struct {
	v1contracts.UnimplementedOperatorServiceServer
	// contains filtered or unexported fields
}

func (*OperatorServiceImpl) Cleanup

func (s *OperatorServiceImpl) Cleanup() error

Cleanup stops the operator cache's expiry goroutine.

func (*OperatorServiceImpl) DurableTask

DurableTask is the durable task event stream. The operator is authorized once when the stream opens, and the worker named by the first register_worker message is checked for ownership before the dispatcher's V1 service sees it; the dispatcher then owns the stream. The SDK's durable listener registers exactly once per stream (it opens a new stream to register again), so a second register_worker is refused as a protocol error rather than re-checked: the stream stays bound to the worker it was authorized for.

func (*OperatorServiceImpl) Listen

Listen activates a registered worker for the lifetime of the stream and fans assigned actions out to it. The dispatcher session owns the send side of the stream: actions go out through its fan-out and delta acks go out through the session handle, so the two never overlap. This goroutine consumes heartbeats and action deltas.

func (*OperatorServiceImpl) Register

Register upserts the operator by name and creates the worker for this connection, or resumes the worker named by req.WorkerId when it still belongs to the operator. The worker starts with no actions: the client adds them on the Listen stream.

func (*OperatorServiceImpl) SendStepActionEvent

SendStepActionEvent reports task progress for an action delivered on a Listen stream. The event's worker must belong to the calling operator; the dispatcher then handles it exactly like an SDK worker's event.

type OperatorServiceOpt

type OperatorServiceOpt func(*OperatorServiceOpts)

func WithLogger

func WithLogger(l *zerolog.Logger) OperatorServiceOpt

func WithMaxActionsPerOperator

func WithMaxActionsPerOperator(n int64) OperatorServiceOpt

WithMaxActionsPerOperator caps the action links held across all workers of one operator; zero disables the cap.

func WithMaxListenStreamsPerOperator

func WithMaxListenStreamsPerOperator(n int) OperatorServiceOpt

WithMaxListenStreamsPerOperator caps the Listen streams one operator may hold open on this replica; zero disables the cap.

type OperatorServiceOpts

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

Jump to

Keyboard shortcuts

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