capgw

package
v0.2.32-rc1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2026 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package capgw is the capability inlet: `POST /v1/cap/<name>` on the web head, where dispatched work — a run on a NODE, a chassis of its own that this chassis dispatched a run to — asks this chassis to do something on its behalf: call a model, note a card, finish the run. The request carries the run's grant as a token (Txco-Run-Grant) and the call's input as JSON; the grant gateway decides it (chassis/server/grantgw.Invoke) and, when it is allowed, the tenant's `_cap` stack runs it as an ordinary pipeline run (`@src == "cap"`, the call at `@cap.*`) and answers at the top-level `_cap.output` — or `_cap.error {code, message}`.

The inlet owns the transport and the identity; the stacks own the policy (`_grant`) and the work (`_cap`). The chassis does not know what a capability does.

Answers, always JSON:

200 {"ok":true,"output":…}
401 {"ok":false,"error":{"code":"unauthorized"}}   no token, or not a live grant's
403 {"ok":false,"error":{"code":"denied"}}         refused: allowlist, standing grant, budget, a rule
409 {"ok":false,"error":{"code":"held"}}           a rule held it for a person
404 {"ok":false,"error":{"code":"no_capability"}}  no `_cap` rule answered
422 {"ok":false,"error":{"code":…,"message":…}}    the stack's own error
503 {"ok":false,"error":{"code":"unavailable"}}    the chassis could not decide or run

A refusal says only that it was refused: the trace of the `_grant` run has the reason.

Index

Constants

View Source
const (

	// Header is where the token travels. The node's web head reads the same
	// header off the dispatching request and keeps it out of its envelope.
	Header = processor.RunGrantHeader
	// CallerRIDHeader names the run that is calling, on the node: stamped
	// as `@cap.caller.rid` so a run can be followed across the two chassis.
	CallerRIDHeader = "Txco-Caller-Rid"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Gateway

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

Gateway is the inlet.

func New

func New(ctx context.Context, pu *processor.Unit, grants *grantgw.Gateway) *Gateway

New builds the inlet over the grant gateway and the processor's bus.

func (*Gateway) Handle

func (g *Gateway) Handle(w http.ResponseWriter, r *http.Request)

Handle serves POST /v1/cap/{name}. Registered ahead of the web catch-all: no BasicAuth (the token is the whole authorization), no opstack render path.

Jump to

Keyboard shortcuts

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