backplane

package
v0.6.54 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2026 License: MIT Imports: 64 Imported by: 7

Documentation

Overview

Package backplane is the Go SDK. The author describes the service as one Config struct and one State built by an explicit constructor:

type Config struct {
    config.Backplane `json:"backplane"`
    Postgres pgx.Config `json:"postgres"`
}

type State struct {
    DB    deps.Dependency[*pgxpool.Pool]
    Users *users.Repo
}

func NewState(root backplane.Root[Config]) (*State, error) { ... }

svc, err := backplane.Open(ctx, NewState)
svc.GRPC(svc.State().Users.Register)
err = svc.Run(ctx)

Everything — the SDK's own parts and the author's tree — is one tree of nodes. Run starts it in order:

config → telemetry → health → platform → consul → nats → temporal → hooks →
author's tree → internal-api → reactors → worker →
public:<addr> → drain → register → serving

so components may publish events and call hooks from OnStart to OnStop. It stops in exact reverse within Shutdown.Timeout: readiness drops, the instance deregisters, after Shutdown.Drain the listeners and the internal API finish in-flight calls within one Shutdown.Listeners window (then streams are cut and internal calls cancelled), and at least Shutdown.Reserve is left for components, which stop before the dependencies they use. A second SIGINT/SIGTERM during the stop exits at once with status 1. A panicking handler fails its request (codes.Internal, HTTP 500), never the process. Consul, NATS, Temporal and the telemetry collector are optional. Install configured backends explicitly with drivers (for example standard.Drivers). RequireNATS or RequireTemporal make a configured connection part of readiness.

Index

Constants

View Source
const (
	AuditLabel = "backplane.audit"
	// AuditID deduplicates a record the Collector retries; without it the
	// record's content does.
	AuditID      = "backplane.audit.id"
	AuditActor   = "backplane.audit.actor"
	AuditSubject = "backplane.audit.subject"
	// AuditOutcome: succeeded, failed or rejected by convention.
	AuditOutcome = "backplane.audit.outcome"
)

Application audit (§14): a log record carrying AuditLabel=true is audit. The deployment's Collector forwards such records to backplane, which keeps them; the log itself goes wherever logs go. The rest of the keys are optional and filterable in the console's Audit; the action is the record's event.name, else its message.

View Source
const ProbeCommand = "probe"

ProbeCommand is the first argument that turns a service's binary into a health probe of the service running next to it:

<binary> probe [readiness|liveness|startup]

It asks the platform port's /healthz/<kind> (readiness by default) on 127.0.0.1 and exits 0 when the probe passes, 1 otherwise: a container healthcheck for distroless images, which have no curl or wget.

healthcheck:
  test: ["CMD", "/app/bin/kratos", "probe"]

The port comes from the same configuration the service reads (file and environment; Consul is not asked).

Variables

View Source
var ErrClosed = errors.New("backplane: service already ran or was closed")

ErrClosed is returned by Run after Close or a previous Run.

View Source
var ErrConfig = errors.New("backplane: invalid configuration")

ErrConfig: the SDK block or the service name is unusable.

View Source
var ErrNoMesh = errors.New("backplane: mutual TLS needs the Consul driver and backplane.consul.addr")

ErrNoMesh: mutual TLS between services needs a mesh driver and Consul.

View Source
var ErrProbe = errors.New("backplane: probe failed")

ErrProbe: the probe did not pass.

Functions

func Audit

func Audit() xlog.Field

Audit marks a log record as application audit:

log.Info("identity deleted", backplane.Audit(),
	xlog.String("event.name", "identity.deleted"),
	xlog.String(backplane.AuditSubject, "identity/"+id))

func CaptureError

func CaptureError(ctx context.Context, log *xlog.Logger, err error, fields ...xlog.Field)

CaptureError logs err as an OpenTelemetry exception record (its type, message and the caller's stack, and the context's trace), which the console's Errors section lists with its trace and related logs. It only logs: it neither stops nor retries anything, and returns nothing to check.

if err := charge(ctx); err != nil {
	backplane.CaptureError(ctx, c.Log(), err, xlog.String("order", id))
	return err
}

func Probe added in v0.6.15

func Probe(ctx context.Context, addr, kind string) error

Probe asks the platform port at addr (host:port) for the probe of kind (readiness, liveness, startup): nil when it passes.

Types

type Caller added in v0.6.20

type Caller struct {
	// Service is the caller's service name.
	Service string
	// Namespace, Partition and Datacenter of the caller (Consul's).
	Namespace, Partition, Datacenter string
	// TrustDomain is the CA's.
	TrustDomain string
	// URI is its SPIFFE identity.
	URI string
}

Caller is the service that made a request on an mTLS port (api.MTLS): of this service's trust domain, namespace and partition (the mesh spans those; a caller from another does not get past the handshake).

func CallerOf added in v0.6.20

func CallerOf(ctx context.Context) (Caller, bool)

CallerOf is the service that made the request ctx belongs to, on a port served with api.MTLS; ok is false elsewhere.

type ConfigurationState

type ConfigurationState = configrt.State

ConfigurationState exposes masked configuration and live update notifications.

type Connection

type Connection interface {
	Connect(ctx context.Context, group TaskGroup) error
	Close(ctx context.Context) error
	Connected() bool
}

Connection is a transport managed by the service lifecycle.

type EventMessage

type EventMessage = env.Message

EventMessage is the transport-neutral event envelope.

type EventTransport

type EventTransport interface {
	Connection
	Publish(ctx context.Context, message EventMessage) error
	StartReactors(ctx context.Context, group TaskGroup) error
	StopReactors(ctx context.Context) error
}

EventTransport publishes events and serves declared consumers.

type EventTransportFactory

type EventTransportFactory func(config.Backplane, deps.Scope, Identity) EventTransport

EventTransportFactory builds one transport per service, without connecting.

type HookDiscovery added in v0.3.0

type HookDiscovery = direct.Discovery

HookDiscovery finds the platform addresses of backplane's replicas for the direct hook transport.

type HookDiscoveryFactory added in v0.3.0

type HookDiscoveryFactory func(cfg config.Backplane, log *xlog.Logger) (HookDiscovery, error)

HookDiscoveryFactory builds the discovery from the configuration.

type Identity

type Identity struct {
	Service     string
	Version     string
	Instance    string
	Advertise   string
	Environment string
}

Identity is how the instance names itself everywhere: logs, telemetry, Consul, the manifest.

type Info

type Info struct {
	Service     string `json:"service"`
	Version     string `json:"version"`
	Instance    string `json:"instance"`
	Advertise   string `json:"advertise"`
	Environment string `json:"environment,omitempty"`
	SDKVersion  string `json:"sdk_version"`
	GoVersion   string `json:"go_version"`
	Commit      string `json:"commit,omitempty"`
	BuildDate   string `json:"build_date,omitempty"`
}

Info is what /_backplane/info answers.

type Mesh added in v0.6.20

type Mesh interface {
	// Certificate is the current certificate; nil until there is one.
	Certificate() *tls.Certificate
	// Roots are the current trusted roots; nil until known.
	Roots() *x509.CertPool
	// Authorize decides whether caller (a service name) may call this
	// service, and why.
	Authorize(caller string) (bool, string)
	// Run follows the identity until ctx ends.
	Run(ctx context.Context) error
	// Ready is nil once a certificate and the roots are known.
	Ready() error
}

Mesh is a service's identity among services: its certificate, the roots peers' chains lead to and who may call it, followed live. The Consul driver installs one over Consul's CA and intentions.

type MeshFactory added in v0.6.20

type MeshFactory func(cfg config.Backplane, service string, log *xlog.Logger) (Mesh, error)

MeshFactory builds a service's mesh identity without starting it.

type Operator added in v0.6.23

type Operator struct {
	// Session is the console session's id.
	Session string
}

Operator is the console session a call through the console's relay comes from: a call on the internal API (Service.Internal). The console signs in with the installation's admin token, so a session is all there is of the person; the console lists sessions with their address and user agent.

func OperatorOf added in v0.6.23

func OperatorOf(ctx context.Context) (Operator, bool)

OperatorOf is the console operator a call on the internal API comes from; ok is false for calls the console did not relay for a session (backplane's own activity calls, other ports).

The relay drops every bp-* key the browser sends and sets the session itself; the platform port admits only calls presenting the internal secret. So the operator is backplane's word as long as the secret is set (BACKPLANE_INTERNAL_SECRET) and kept from whoever reaches the platform port. Without a secret the port is open and the session is the caller's claim.

func (Operator) Actor added in v0.6.23

func (o Operator) Actor() string

Actor is the operator as an audit actor, as backplane's own audit names console sessions: console:<session>.

log.Info("room closed", backplane.Audit(), xlog.String(backplane.AuditActor, op.Actor()))

type Option

type Option func(*options)

Option configures Open.

func Advertise(addr string) Option

Advertise overrides the address registered in Consul.

func ConfigOptions

func ConfigOptions(opts ...config.Option) Option

ConfigOptions pass options to configuration loading.

func GRPCServerOptions

func GRPCServerOptions(opts ...grpc.ServerOption) Option

GRPCServerOptions are passed to every public gRPC server after the SDK's own (telemetry, limits of config.Server, panic recovery): a later limit overrides the SDK's; interceptors run inside recovery and outside those of api.Interceptors. The platform port is not affected.

func Instance

func Instance(id string) Option

Instance overrides the instance id (default: the block's instance, then <service>-<hostname>).

func KeepSlog

func KeepSlog() Option

KeepSlog leaves the log/slog default alone. By default Run routes it into the service logger (the OTel SDK and other libraries log through it) and restores it when Run returns.

func Logger

func Logger(l *xlog.Logger) Option

Logger replaces the default logger.

func Name

func Name(n string) Option

Name overrides build.Service.

func Options

func Options(opts ...Option) Option

Options composes explicit driver options without global registration.

func RequireNATS

func RequireNATS() Option

RequireNATS makes the NATS connection part of readiness: the instance is not ready while it is down. Without NATS configured, Open fails.

func RequireTemporal

func RequireTemporal() Option

RequireTemporal makes the Temporal connection part of readiness: the instance is not ready while it is down. Without Temporal configured, Open fails.

func ServerKeepalive added in v0.6.35

func ServerKeepalive(d time.Duration) Option

ServerKeepalive is the service's default of server.grpc_keepalive_time: how long a connection stays idle before the server pings it. Long streams behind NAT and load balancers that drop quiet connections need less than the SDK's 2h. The file and BACKPLANE_SERVER_GRPC_KEEPALIVE_TIME override it.

func Version

func Version(v string) Option

Version overrides build.Version.

func WithEventTransport

func WithEventTransport(factory EventTransportFactory) Option

WithEventTransport installs an event driver explicitly at the composition root.

func WithHookDiscovery added in v0.3.0

func WithHookDiscovery(factory HookDiscoveryFactory) Option

WithHookDiscovery installs how the direct hook transport finds backplane (the Consul driver installs one over the catalog's instance states).

func WithMesh added in v0.6.20

func WithMesh(factory MeshFactory) Option

WithMesh installs where mutual TLS between services gets its identity (the Consul driver installs Consul's CA).

func WithPresence

func WithPresence(factory PresenceFactory) Option

WithPresence installs the discovery driver used by the service lifecycle.

func WithWorkflowTransport

func WithWorkflowTransport(factory WorkflowTransportFactory) Option

WithWorkflowTransport installs a workflow driver explicitly at the composition root.

type Presence

type Presence interface {
	Start(ctx context.Context, group TaskGroup) error
	Stop(ctx context.Context) error
	Register(ctx context.Context) error
	Deregister(ctx context.Context) error
}

Presence publishes instance state and manages catalog registration.

type PresenceFactory

type PresenceFactory func(PresenceParams) (Presence, error)

PresenceFactory builds a discovery session without starting it.

type PresenceParams

type PresenceParams struct {
	Config        config.Backplane
	Identity      Identity
	Manifest      *backplanev1.Manifest
	Log           *xlog.Logger
	Configuration ConfigurationState
	PlatformPort  uint16
	PrimaryPort   uint16
	Commit        string
	Transports    func() []*backplanev1.TransportStatus
	Nodes         func() []*backplanev1.NodeStatus
	// Sections are the live section values (sections.OfferLive), by name.
	Sections func() map[string]*anypb.Any
}

PresenceParams provides a discovery driver with the service's sealed contract.

type Root

type Root[C any] struct {
	deps.Component
	// contains filtered or unexported fields
}

Root is the root of the author's tree, handed to the State constructor: create components and dependencies under it, read the configuration from it. Embedding it in State is optional.

func (Root[C]) Config

func (r Root[C]) Config() C

Config is a copy of the loaded configuration. Static fields never change; config.Live fields are shared by every copy and update in place.

func (Root[C]) DialPlatform added in v0.6.54

func (r Root[C]) DialPlatform(target, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

DialPlatform is DialService of target's platform port, with PlatformCredentials.

func (Root[C]) DialService added in v0.6.54

func (r Root[C]) DialService(target, addr string, opts ...grpc.DialOption) (*grpc.ClientConn, error)

DialService is a channel to target's api.MTLS port at addr (host:port) with ServiceCredentials: the server verified as target on every handshake, the channel recovering within seconds when the peer's address moves (meshdial). Calls are not retried; one may wait for readiness within its deadline with grpc.WaitForReady(true). opts apply last.

conn, err := root.DialService("sync", cfg.Sync.Addr)

func (Root[C]) Identity

func (r Root[C]) Identity() Identity

Identity of the instance.

func (Root[C]) PlatformCredentials added in v0.6.39

func (r Root[C]) PlatformCredentials(target string) credentials.TransportCredentials

PlatformCredentials are the gRPC credentials of a call to target's platform port (port 9400: its activities, internal API): mutual TLS when backplane.mesh.platform is mtls, plain otherwise. What backplane and the SDK dial platform ports with.

func (Root[C]) PlatformTLS added in v0.6.39

func (r Root[C]) PlatformTLS(target string) *tls.Config

PlatformTLS is PlatformCredentials for an HTTP client; nil when plain.

func (Root[C]) ServiceCredentials added in v0.6.20

func (r Root[C]) ServiceCredentials(target string) credentials.TransportCredentials

ServiceCredentials are the gRPC credentials of a client of target's api.MTLS port: this service's certificate, the server verified as target.

conn, err := grpc.NewClient(addr, grpc.WithTransportCredentials(root.ServiceCredentials("sync")))

DialService builds the channel with them and recovers from address changes. Without a mesh (the Consul driver and Consul) every handshake fails with ErrNoMesh.

func (Root[C]) ServiceTLS added in v0.6.20

func (r Root[C]) ServiceTLS(target string) *tls.Config

ServiceTLS is ServiceCredentials for an HTTP client: &http.Transport{TLSClientConfig: root.ServiceTLS("sync")}.

type Service

type Service[St any] struct {
	// contains filtered or unexported fields
}

Service is one process on the SDK: the author's State plus what it serves.

func Open

func Open[C config.Backplaner, St any](
	ctx context.Context, newState func(root Root[C]) (*St, error), opts ...Option,
) (*Service[St], error)

Open loads the configuration, builds the State with newState and returns a service ready to declare routes and Run. Nothing listens until Run.

Started as "<binary> probe [readiness|liveness|startup]", Open probes the service running next to it instead and exits (see ProbeCommand).

ctx bounds loading only (a required Live value may wait for Consul); the service does not depend on it afterwards. An invalid configuration or a failing constructor is an error; an absent Consul is not. Call Close if Run will not be called.

func (Service) API

func (c Service) API(d api.Decl)

API describes an API the author serves on their own listener.

func (Service) Close

func (c Service) Close() error

Close releases what Open acquired when Run will not be called. Safe to call more than once; Run closes by itself.

func (Service) GRPC

func (c Service) GRPC(register func(r grpc.ServiceRegistrar), opts ...api.GRPCOption)

GRPC serves gRPC services on a public port: one route per registered service, descriptors derived from the registration. Registering the same service twice on one port is a Run error; so is grpc.health.v1, which every public gRPC server serves already. api.Interceptors and api.StreamInterceptors wrap this registration's services only.

func (Service) GraphQL

func (c Service) GraphQL(prefix string, h http.Handler, introspection []byte, opts ...api.HTTPOption)

GraphQL serves the author's GraphQL handler under prefix on a public port, announced with its introspection result (JSON; nil when none).

func (Service) HTTP

func (c Service) HTTP(prefix string, h http.Handler, opts ...api.HTTPOption)

HTTP serves h under prefix on a public port. The prefix is normalized to end with "/" ("/api" serves "/api/..."); with api.Host it matches that host only, so one prefix may serve several hosts. The same host and prefix twice on one port is a Run error.

func (Service) Identity

func (c Service) Identity() Identity

Identity of the instance.

func (Service) Internal

func (c Service) Internal(register func(r grpc.ServiceRegistrar), opts ...api.InterceptorOption)

Internal registers the internal API: gRPC on the platform port for the service's own console plugin, behind the internal secret, served only while the author's tree is up. Any proto package will do but grpc.* and, outside the platform itself, backplane.*; the console relays a method to the service whose manifest declares it. api.Interceptors and api.StreamInterceptors wrap this registration's services only, inside the internal secret's check: backplane.OperatorOf already answers in them.

func (Service) LivenessProbe

func (c Service) LivenessProbe(p probe.Probe)

LivenessProbe adds a liveness probe. Keep dependencies out of it: a dead database is no reason to restart the process.

func (Service) Log

func (c Service) Log() *xlog.Logger

Log is the service logger; context-aware calls carry trace and span ids.

func (Service) Name

func (c Service) Name() string

Name of the service.

func (Service) PlatformCredentials added in v0.6.39

func (c Service) PlatformCredentials(target string) credentials.TransportCredentials

PlatformCredentials are Root.PlatformCredentials, after Open.

func (Service) PlatformTLS added in v0.6.39

func (c Service) PlatformTLS(target string) *tls.Config

PlatformTLS is Root.PlatformTLS, after Open.

func (Service) ReadinessProbe

func (c Service) ReadinessProbe(p probe.Probe)

ReadinessProbe adds a readiness probe; readiness drives grpc.health.v1 and so the Consul check. Required dependencies are readiness probes already.

func (Service) Run

func (c Service) Run(ctx context.Context) error

Run brings the service up and blocks until ctx ends, SIGINT/SIGTERM arrives or a node's goroutine fails; then stops everything within the shutdown budget. A stop requested during start is not an error. A signal during the stop exits the process at once with status 1.

func (Service) ServiceCredentials added in v0.6.20

func (c Service) ServiceCredentials(target string) credentials.TransportCredentials

ServiceCredentials are Root.ServiceCredentials, after Open.

func (Service) ServiceTLS added in v0.6.20

func (c Service) ServiceTLS(target string) *tls.Config

ServiceTLS is Root.ServiceTLS, after Open.

func (Service) StartupProbe

func (c Service) StartupProbe(p probe.Probe)

StartupProbe adds a startup probe.

func (*Service[St]) State

func (s *Service[St]) State() *St

State is what the constructor built.

func (Service) TelemetrySources

func (c Service) TelemetrySources(selectors ...map[string]string)

TelemetrySources declares optional view presets using exact OTel resource attribute matches. Selectors are OR alternatives; each map's entries are AND. Calling with no selectors explicitly disables presets. Not calling retains convention matching by service.name. No admission/visibility rules are created.

func (Service) UI

func (c Service) UI(bundle fs.FS)

UI declares the console plugin bundle, served at /_backplane/ui/ behind the internal secret. Files are snapshotted at declaration; subsequent changes to the source filesystem do not change the bundle or its hash. Every file carries ETag = ui.hash and Cache-Control: no-cache on the internal listener.

func (Service) Validate added in v0.6.36

func (c Service) Validate() error

Validate reports the declaration errors Run would fail with — a prefix served twice, api.MTLS and plain routes on one port, api.MTLS without a mesh, a reserved package, ... — without starting anything. Declarations stay open: call it after the last one, e.g. in a test of the function that declares the service's routes.

type TaskGroup

type TaskGroup = node.Group

TaskGroup runs background tasks within a service lifecycle node.

type WorkflowTransport

type WorkflowTransport interface {
	Connection
	Call(ctx context.Context, hook string, payload []byte) ([]byte, error)
	StartHookWorker(ctx context.Context, group TaskGroup) error
	StopHookWorker(ctx context.Context) error
	StartWorker(ctx context.Context, group TaskGroup) error
	StopWorker(ctx context.Context) error
}

WorkflowTransport carries hooks and serves the service's declared activities and workflows. Native workflow APIs belong to the selected driver.

type WorkflowTransportFactory

type WorkflowTransportFactory func(config.Backplane, deps.Scope, Identity) WorkflowTransport

WorkflowTransportFactory builds one transport per service, without connecting.

Directories

Path Synopsis
Package activity declares operations a service implements ("умею"): the targets of bindings and rules.
Package activity declares operations a service implements ("умею"): the targets of bindings and rules.
Package api describes the APIs a service serves, independently of deployment.
Package api describes the APIs a service serves, independently of deployment.
Package backplanetest runs components without Open, Run, ports or Consul: build them under Root, Start, and inspect what they published, answer their hooks, invoke their activities and reactors, and check their readiness.
Package backplanetest runs components without Open, Run, ports or Consul: build them under Root, Start, and inspect what they published, answer their hooks, invoke their activities and reactors, and check their readiness.
Package build carries what the deployment stamps into the binary at link time.
Package build carries what the deployment stamps into the binary at link time.
Package config loads a service's configuration: one struct, schema from the Go type (schemapb), layers merged by xconf:
Package config loads a service's configuration: one struct, schema from the Go type (schemapb), layers merged by xconf:
Package deps is how a service is composed: a tree of components, dependencies and singletons built explicitly by the author's constructor.
Package deps is how a service is composed: a tree of components, dependencies and singletons built explicitly by the author's constructor.
drivers
consul
Package consul installs optional discovery and live configuration.
Package consul installs optional discovery and live configuration.
nats
Package nats installs the optional nats transport.
Package nats installs the optional nats transport.
standard
Package standard composes the standard platform drivers.
Package standard composes the standard platform drivers.
temporal
Package temporal installs the optional temporal transport.
Package temporal installs the optional temporal transport.
Package event declares the events a service publishes and the reactors it runs.
Package event declares the events a service publishes and the reactors it runs.
Package hook declares operations a service calls without implementing them ("нужно").
Package hook declares operations a service calls without implementing them ("нужно").
infra
nats
Package nats is a NATS connection as a dependency: a configuration section, a connection that never gives up (reconnecting with jitter, no buffering while disconnected, transitions logged), a status probe.
Package nats is a NATS connection as a dependency: a configuration section, a connection that never gives up (reconnecting with jitter, no buffering while disconnected, transitions logged), a status probe.
postgres
Package postgres is a PostgreSQL connection as a dependency: a configuration section, a pgx pool traced and measured through the service's OpenTelemetry providers, a query log, pgtx transactions, an optional schema and sqld migrations applied at start, a ping probe.
Package postgres is a PostgreSQL connection as a dependency: a configuration section, a pgx pool traced and measured through the service's OpenTelemetry providers, a query log, pgtx transactions, an optional schema and sqld migrations applied at start, a ping probe.
temporal
Package temporal is a Temporal client as a dependency: a configuration section, a client traced and measured through the service's OpenTelemetry providers and logging through its logger, a health probe.
Package temporal is a Temporal client as a dependency: a configuration section, a client traced and measured through the service's OpenTelemetry providers and logging through its logger, a health probe.
valkey
Package valkey is a Valkey (Redis protocol) connection as a dependency: a configuration section, a client instrumented with the service's OpenTelemetry providers, a PING probe and a close.
Package valkey is a Valkey (Redis protocol) connection as a dependency: a configuration section, a client instrumented with the service's OpenTelemetry providers, a PING probe and a close.
internal
apifiles
Package apifiles snapshots API files for content-addressed delivery.
Package apifiles snapshots API files for content-addressed delivery.
backoff
Package backoff is the SDK's retry policy as a value: bounds the author can set, run by github.com/cenkalti/backoff (exponential, jittered, so instances recovering from one outage do not retry in lockstep).
Package backoff is the SDK's retry policy as a value: bounds the author can set, run by github.com/cenkalti/backoff (exponential, jittered, so instances recovering from one outage do not retry in lockstep).
broker
Package broker carries events over NATS JetStream (design §8).
Package broker carries events over NATS JetStream (design §8).
configrt
Package configrt is what the SDK core needs from a live configuration and authors do not: the effective values for instance state, schema walks for the manifest and provenance.
Package configrt is what the SDK core needs from a live configuration and authors do not: the effective values for instance state, schema walks for the manifest and provenance.
consul
Package consul keeps a service present in Consul: manifest per version, instance state under a TTL session (it disappears with the instance) and the catalog registration.
Package consul keeps a service present in Consul: manifest per version, instance state under a TTL session (it disappears with the instance) and the catalog registration.
decl
Package decl is shared by the hook, activity and event packages: it resolves the service a Scope belongs to, derives payload schemas and encodes payloads.
Package decl is shared by the hook, activity and event packages: it resolves the service a Scope belongs to, derives payload schemas and encodes payloads.
direct
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.
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.
env
Package env is what every node of one service shares: the manifest being declared into and the wiring of events, hooks and activities to a transport.
Package env is what every node of one service shares: the manifest being declared into and the wiring of events, hooks and activities to a transport.
exception
Package exception writes errors and panics as OpenTelemetry exception log records: exception.type, exception.message, exception.stacktrace and event.name=exception.
Package exception writes errors and panics as OpenTelemetry exception log records: exception.type, exception.message, exception.stacktrace and event.name=exception.
gate
Package gate admits internal API calls only while the author's tree is up: before it started they get Unavailable, and stopping waits for the calls in flight before the tree (and its dependencies) stops.
Package gate admits internal API calls only while the author's tree is up: before it started they get Unavailable, and stopping waits for the calls in flight before the tree (and its dependencies) stops.
guard
Package guard protects the platform port with the installation's internal secret: the console relay presents it, the SDK checks it.
Package guard protects the platform port with the installation's internal secret: the console relay presents it, the SDK checks it.
health
Package health is the single source of a service's health: probes are registered by kind, their composite status is cached in xprobe states, and grpc.health.v1, the HTTP probe endpoints and the Consul check all read the same states.
Package health is the single source of a service's health: probes are registered by kind, their composite status is cached in xprobe states, and grpc.health.v1, the HTTP probe endpoints and the Consul check all read the same states.
link
Package link lets SDK packages reach what public types keep private: the node behind a deps.Scope.
Package link lets SDK packages reach what public types keep private: the node behind a deps.Scope.
listener
Package listener serves gRPC and HTTP on one address through cmux.
Package listener serves gRPC and HTTP on one address through cmux.
manifest
Package manifest collects a service's declarations into a backplanev1.Manifest.
Package manifest collects a service's declarations into a backplanev1.Manifest.
metrics
Package metrics is the SDK's own instrumentation, on meter github.com/backplane-labs/backplane.
Package metrics is the SDK's own instrumentation, on meter github.com/backplane-labs/backplane.
mtls
Package mtls is mutual TLS between services: a Source (the service's live certificate, the trusted roots and who may call it — the Consul driver's follows Consul's CA and intentions) turned into the TLS of a public port and of clients, and the caller of a request: its service, taken from the SPIFFE URI of the certificate it presented.
Package mtls is mutual TLS between services: a Source (the service's live certificate, the trusted roots and who may call it — the Consul driver's follows Consul's CA and intentions) turned into the TLS of a public port and of clients, and the caller of a request: its service, taken from the SPIFFE URI of the certificate it presented.
node
Package node is the service's one lifecycle model: a tree of nodes, each with a name, a logger, an instrumentation scope, start and stop hooks, its own goroutines and an optional readiness probe.
Package node is the service's one lifecycle model: a tree of nodes, each with a name, a logger, an instrumentation scope, start and stop hooks, its own goroutines and an optional readiness probe.
recovery
Package recovery turns a panic in a request handler into an error for that request instead of a crashed process: gRPC and ws-proto calls get codes.Internal, HTTP requests 500.
Package recovery turns a panic in a request handler into an error for that request instead of a crashed process: gRPC and ws-proto calls get codes.Internal, HTTP requests 500.
routes
Package routes holds what route options configure, for the SDK core.
Package routes holds what route options configure, for the SDK core.
telemetry
Package telemetry installs OpenTelemetry through xtrace's SDK bootstrap: resource from the build identity, exporters from the standard OTEL_* environment.
Package telemetry installs OpenTelemetry through xtrace's SDK bootstrap: resource from the build identity, exporters from the standard OTEL_* environment.
temporal
Package temporal runs the service's activities and hook calls on Temporal (design §7.2, §9).
Package temporal runs the service's activities and hook calls on Temporal (design §7.2, §9).
temporal/temporaltest
Package temporaltest runs the SDK's Temporal tests against a dev server (BACKPLANE_TEST_TEMPORAL, e.g.
Package temporaltest runs the SDK's Temporal tests against a dev server (BACKPLANE_TEST_TEMPORAL, e.g.
testlog
Package testlog provides loggers for tests.
Package testlog provides loggers for tests.
Package meshdial dials the gRPC channels of the mesh: a service's api.MTLS port, a platform port.
Package meshdial dials the gRPC channels of the mesh: a service's api.MTLS port, a platform port.
Package meta is a call's metadata: string pairs the product attaches to a hook call that travel with it — through the binding's run to every activity the run calls, on either runtime and either transport.
Package meta is a call's metadata: string pairs the product attaches to a hook call that travel with it — through the binding's run to every activity the run calls, on either runtime and either transport.
Package seal encrypts what a service keeps and has to read back — a receiver's signing secret, a provider's token — so a copy of its database or of a backup holds ciphertext only.
Package seal encrypts what a service keeps and has to read back — a receiver's signing secret, a provider's token — so a copy of its database or of a backup holds ciphertext only.
Package sections is discovery the product defines: a service offers a section — a proto message of the product's under a name — and any service follows that name across the installation, without a registry of its own.
Package sections is discovery the product defines: a service offers a section — a proto message of the product's under a name — and any service follows that name across the installation, without a registry of its own.
Package workflows gives a service its own Temporal workflows (design §9): the SDK owns the connection and the worker on the service's task queue (= its name); the author registers on it and uses the client.
Package workflows gives a service its own Temporal workflows (design §9): the SDK owns the connection and the worker on the service's task queue (= its name); the author registers on it and uses the client.
Package wsproto serves services over ws-proto (protobuf RPC over WebSocket) as a managed public api: gRPC services, with the same register function as Service.GRPC so one implementation serves both, or handlers generated for ws-proto itself.
Package wsproto serves services over ws-proto (protobuf RPC over WebSocket) as a managed public api: gRPC services, with the same register function as Service.GRPC so one implementation serves both, or handlers generated for ws-proto itself.

Jump to

Keyboard shortcuts

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