Documentation
¶
Index ¶
- Constants
- func CanonicalInvocationName(platform PlatformID, raw string) string
- func DecodeJSONPayload[T any](body []byte, label string) (*T, error)
- func InternalHookTypeMismatch(name string) error
- func NormalizeHookName(name string) string
- func ValidatePayloadSize(body []byte, label string) error
- type CapabilityID
- type CarrierKind
- type Descriptor
- type DescriptorLookup
- type Engine
- type Env
- type Envelope
- type EnvelopeBuilder
- type EventID
- type Handled
- type HandlerRegistry
- type IO
- type Invocation
- type InvocationContext
- type InvocationKind
- type Logger
- type MaturityLevel
- type Middleware
- type Next
- type NopLogger
- type PlatformID
- type RegistrarBackend
- type Resolver
- type Result
- type SupportEntry
- type SupportStatus
- type TransportMode
- type TypedHandler
Constants ¶
View Source
const (
// MaxPayloadBytes caps stdin and argv JSON payloads accepted by runtime decoders.
MaxPayloadBytes = 1 << 20
)
Variables ¶
This section is empty.
Functions ¶
func CanonicalInvocationName ¶
func CanonicalInvocationName(platform PlatformID, raw string) string
func DecodeJSONPayload ¶ added in v1.1.0
func NormalizeHookName ¶
func ValidatePayloadSize ¶ added in v1.1.0
Types ¶
type CapabilityID ¶
type CapabilityID string
type CarrierKind ¶
type CarrierKind string
const ( CarrierStdinJSON CarrierKind = "stdin_json" CarrierArgvJSON CarrierKind = "argv_json" )
type Descriptor ¶
type Descriptor struct {
Platform PlatformID
Event EventID
Carrier CarrierKind
Decode func(Envelope) (any, string, error)
Encode func(any) Result
}
type DescriptorLookup ¶
type DescriptorLookup func(platform PlatformID, event EventID) (Descriptor, bool)
type Engine ¶
type Engine struct {
Args []string
IO IO
Env Env
Logger Logger
Resolver Resolver
Lookup DescriptorLookup
BuildEnvelope EnvelopeBuilder
Handlers *HandlerRegistry
Middleware []Middleware
}
type EnvelopeBuilder ¶
type EnvelopeBuilder func(ctx context.Context, inv Invocation, carrier CarrierKind, args []string, io IO, env Env) (Envelope, error)
type HandlerRegistry ¶
type HandlerRegistry struct {
// contains filtered or unexported fields
}
func NewHandlerRegistry ¶
func NewHandlerRegistry() *HandlerRegistry
func (*HandlerRegistry) Lookup ¶
func (r *HandlerRegistry) Lookup(platform PlatformID, event EventID) (TypedHandler, bool)
func (*HandlerRegistry) Register ¶
func (r *HandlerRegistry) Register(platform PlatformID, event EventID, handler TypedHandler)
type Invocation ¶
type Invocation struct {
Platform PlatformID
Event EventID
RawName string
}
type InvocationContext ¶
type InvocationContext struct {
Context context.Context
Invocation Invocation
Descriptor Descriptor
Env Env
Logger Logger
}
type InvocationKind ¶
type InvocationKind string
const ( InvocationArgvCommand InvocationKind = "argv_command" InvocationArgvCommandCaseFold InvocationKind = "argv_command_casefold" InvocationArgvPayload InvocationKind = "argv_payload" InvocationEnvMarker InvocationKind = "env_marker" InvocationCustomResolver InvocationKind = "custom_resolver" )
type MaturityLevel ¶
type MaturityLevel string
const ( MaturityStable MaturityLevel = "stable" MaturityBeta MaturityLevel = "beta" MaturityExperimental MaturityLevel = "experimental" )
type Middleware ¶
func RecoveryMiddleware ¶
func RecoveryMiddleware(log Logger) Middleware
type Next ¶
type Next func(InvocationContext) Handled
func Chain ¶
func Chain(middleware []Middleware, final Next) Next
type PlatformID ¶
type PlatformID string
type RegistrarBackend ¶
type RegistrarBackend interface {
Register(platform PlatformID, event EventID, handler TypedHandler)
RegisterCustom(rawName string, desc Descriptor, handler TypedHandler) error
}
type SupportEntry ¶
type SupportEntry struct {
Platform PlatformID
Event EventID
Status SupportStatus
Maturity MaturityLevel
V1Target bool
InvocationKind InvocationKind
Carrier CarrierKind
TransportModes []TransportMode
ScaffoldSupport bool
ValidateSupport bool
Capabilities []CapabilityID
Summary string
LiveTestProfile string
}
type SupportStatus ¶
type SupportStatus string
const ( StatusRuntimeSupported SupportStatus = "runtime_supported" StatusScaffoldOnly SupportStatus = "scaffold_only" StatusDeferred SupportStatus = "deferred" )
type TransportMode ¶
type TransportMode string
const ( ProcessMode TransportMode = "process" HybridMode TransportMode = "hybrid" DaemonMode TransportMode = "daemon" )
type TypedHandler ¶
type TypedHandler func(InvocationContext, any) Handled
Source Files
¶
Click to show internal directories.
Click to hide internal directories.