direct

package
v0.6.16 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

Package direct is the SDK's side of backplane's direct runtime: the ActivityService that lets backplane run the service's activities over gRPC on the platform port, and the hook Caller that reaches backplane's HookService the same way. Both carry the envelopes Temporal carries; neither needs it.

Index

Constants

View Source
const (
	NonRetryableType = "backplane.NonRetryable"
	PanicType        = "backplane.Panic"
)

Failure types of a direct call, as the binding knows them.

View Source
const KeyHeader = "bp-call-key"

KeyHeader carries the call's idempotency key (hook.Key) to backplane.

View Source
const NoBindingType = "backplane.NoBinding"

NoBindingType is the failure type of a required hook without a binding.

Variables

This section is empty.

Functions

func FailureOf

func FailureOf(err error) (string, bool)

FailureOf reads the CallFailure of a status error: its type and whether retrying can help; retryable (and no type) when it has none, as a transport error is.

func Local

func Local(ctx context.Context, err error) error

Local maps a HookService error to what the caller sees: env.ErrNoBinding, context.DeadlineExceeded, env.ErrUnavailable, or the run's failure with its message.

func Status

func Status(err error) error

Status is a handler's error as the call's status: a CallFailure detail says whether retrying can help. A context error is its own code.

Types

type Caller

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

Caller carries hook calls to backplane's HookService: env.Caller for the direct transport. A call goes to one replica; UNAVAILABLE from it tries another once.

func NewCaller

func NewCaller(p CallerParams) *Caller

NewCaller creates the caller.

func (*Caller) Call

func (c *Caller) Call(ctx context.Context, hook string, in []byte) ([]byte, error)

Call implements env.Caller: HookService.Call on a replica of backplane, within ctx's deadline (the configured timeout when it has none). The error is env.ErrNoBinding, env.ErrUnavailable (no replica, none reachable), context.DeadlineExceeded, or the run's failure with its message.

func (*Caller) Close

func (c *Caller) Close()

Close closes the connections.

type CallerParams

type CallerParams struct {
	Service  string
	Instance string
	// Secret is the installation's internal secret, presented to backplane.
	Secret string
	// Timeout of a call nothing else bounds; 0 is env.DefaultHookTimeout.
	Timeout   time.Duration
	Discovery Discovery
	// Dial replaces the gRPC dial (tests).
	Dial func(addr string) (*grpc.ClientConn, error)
}

CallerParams builds a Caller.

type Discovery

type Discovery interface {
	Backplanes(ctx context.Context) ([]string, error)
}

Discovery finds the platform addresses (host:port) of backplane's replicas; none means backplane is not known to be running.

type DiscoveryFunc

type DiscoveryFunc func(ctx context.Context) ([]string, error)

DiscoveryFunc adapts a function.

func (DiscoveryFunc) Backplanes

func (f DiscoveryFunc) Backplanes(ctx context.Context) ([]string, error)

Backplanes implements Discovery.

type Server

type Server struct {
	backplanev1.UnimplementedActivityServiceServer
	// contains filtered or unexported fields
}

Server serves ActivityService: the handlers activity.Handle registered in the env.

func NewServer

func NewServer(service string, e *env.Env, log *xlog.Logger) *Server

NewServer serves the activities of env.

func (*Server) Run

Run implements ActivityService.

Jump to

Keyboard shortcuts

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