Documentation
¶
Overview ¶
Package invoke is the chain every call to a function's worker runs (ADR-0302): invokePlugins, steps compiled into funcd, at three points of a call. Admit runs before anything about the Function is read, Before before the worker is called or woken, and After once it answered, before the caller sees the answer.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdmitPlugin ¶
AdmitPlugin runs before anything about the Function is read.
type AfterPlugin ¶
AfterPlugin runs once the worker answered, before the caller sees the answer.
type Answer ¶
Answer is the worker's answer at the After point.
type BeforePlugin ¶
BeforePlugin runs before the worker is called or woken.
type Call ¶
type Call struct {
Caller Caller
Target activator.FunctionRef // namespace, name and a step's revision pin (ADR-0190)
Stance v1.AuthMode // External: the stance the route resolved (ADR-0113); "" otherwise
Remainder string // External and Function: the function-relative path
Received time.Time // External: when the listener received the call (ADR-0151)
Request *http.Request // what the worker gets; a Before plugin may replace it
Function *v1.Function // set by the data plane before Before; nil at Admit and on the other paths
}
Call is one call to a function's worker.
type Chain ¶
type Chain struct {
// contains filtered or unexported fields
}
Chain runs its plugins in order. It is safe for concurrent use; a nil Chain runs nothing.
type Plugin ¶
Plugin is an invokePlugin; it also implements one or more of AdmitPlugin, BeforePlugin and AfterPlugin. Applies reads the call's facts, never its body.
type Refusal ¶
type Refusal struct {
Err error
Header http.Header // set before the answer, e.g. Retry-After
Status int
Body []byte
}
Refusal ends a call before its worker, or replaces the worker's answer: an RFC 9457 problem from Err, or, when Status is set, that status with Body, for an answer an ADR fixes in another shape (ADR-0058's contract answers).
func (*Refusal) Error ¶
Error is Err's text, else the status and the body, which a client path keeps in a step's or an Invocation's error.
func (*Refusal) StatusCode ¶
StatusCode is the status the refusal answers with.
func (*Refusal) WriteAnswer ¶
func (r *Refusal) WriteAnswer(w http.ResponseWriter)
WriteAnswer writes the refusal to w: its headers, then its problem, or its status and body. It sets no Content-Type of its own, so a refusal with a body carries one in Header.