Documentation
¶
Index ¶
Constants ¶
const ( ContextKeyAPIRequestInfo = "_api_request_info" ContextKeyAPIResponseInfo = "_api_response_info" ContextKeyAPIError = "_api_error" ContextKeyCredential = "_credential" ContextKeySession = "_session" ContextKeyNamespace = "_namespace" ContextKeyDB = "_db" ContextKeyTX = "_tx" ContextKeyLogger = "_logger" ContextKeyTrace = "_trace" ContextKeyConfig = "_config" )
const (
RedactMask = "REDACTED XXXX"
)
const (
TimeFormat = "2006-01-02 15:04:05.00"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Daemon ¶
Daemon may be started and stopped repeatedly on one instance. What a start runs lives until Stop: Start's ctx bounds the start alone and is never kept, its values aside. Stop refuses new work, cancels and awaits the rest (an earlier Stop's leftovers included) until ctx ends, then forces what it can and returns an error wrapping ctx's; it returns only after intake has stopped, and leftovers must not reach a later Start.
type Debuggable ¶
type DependencyState ¶ added in v0.9.5
type DependencyState int
DependencyState is what a dependency has become, as the supervisor tells a dependent that runs on beside it.
const ( // DependencyRunning: the dependency runs again, and has forgotten what was // registered with it before it stopped. DependencyRunning DependencyState = iota + 1 // DependencyStopped: the dependency has stopped, by hand or for a restart, // and has forgotten what was registered with it. DependencyStopped // DependencyFailed: the dependency's Init or Start failed; it is down until // a restart succeeds, which DependencyRunning then says. DependencyFailed )
func (DependencyState) String ¶ added in v0.9.5
func (s DependencyState) String() string
type Initializable ¶
Init runs at the first start and every restart: resolve the reloadable settings here (design/config.md).
type Liveness ¶ added in v0.3.0
Probes honour the caller's ctx deadline; an implementation may only tighten it.
type MessageHandler ¶ added in v0.2.16
MessageHandler's name is its subscription; it need not be a Service.
type MessageSender ¶ added in v0.2.16
type Pair ¶
type Pair[K comparable, V any] interface { SetKey(key K) SetValue(value V) GetKey() K GetValue() V String() string }
func NewPair ¶
func NewPair[K comparable, V any](key K, value V) Pair[K, V]
type RawMessageHandler ¶ added in v0.2.16
type RawMessageHandler interface {
Named
HandleRawMessage(ctx context.Context, kind string, payload any) error
}
RawMessageHandler receives every message, typed or raw.
type RawMessageSender ¶ added in v0.2.16
type Reconcilable ¶ added in v0.9.5
type Reconcilable interface {
Reconcile(ctx context.Context, dep Service, state DependencyState) error
}
Reconcilable is a service that registers something with a dependency, a subscription or a task, which the dependency forgets when it stops. When the supervisor stops or starts that dependency alone, it calls Reconcile on each such dependent that keeps running, in dependency order, under its lock: Reconcile brings what dep holds for this service in line with state, putting back on DependencyRunning what this service holds, and nothing else. It relies on no state but the one it is given: a call that finds nothing to do changes nothing, and a state it does not act on returns nil. It runs beside the service's own work, bounded by ctx, so it registers and never does slow work, nor calls the supervisor. An error fails the service, which the supervisor then restarts, its own Init and Start registering everything.