Documentation
¶
Index ¶
- Constants
- func AdminHandler(store *ConfigStore, runtime *Runtime) http.Handler
- func ConformanceCheck(ctx context.Context, component Component) error
- func HTTPHandler(component Component) http.Handler
- func RedactConfig(values map[string]string) map[string]string
- func Run(ctx context.Context, runtime *Runtime) error
- func RunWithShutdownTimeout(ctx context.Context, runtime *Runtime, timeout time.Duration) error
- func RuntimeHTTPHandler(runtime *Runtime) http.Handler
- type AuditEvent
- type Check
- type CheckScope
- type Checker
- type Code
- type Component
- type Condition
- type ConfigApplier
- type ConfigApplyFunc
- type ConfigStore
- func (s *ConfigStore) Apply(ctx context.Context, envelope Envelope, expected uint64) error
- func (s *ConfigStore) ApplyWith(ctx context.Context, envelope Envelope, expected uint64, apply ConfigApplyFunc) error
- func (s *ConfigStore) Audit() []AuditEvent
- func (s *ConfigStore) Current() (Envelope, bool)
- func (s *ConfigStore) Rollback(ctx context.Context, generation uint64) error
- func (s *ConfigStore) RollbackWith(ctx context.Context, generation uint64, apply ConfigApplyFunc) error
- func (s *ConfigStore) Validate(envelope Envelope, expected uint64) error
- func (s *ConfigStore) Watch(ctx context.Context) <-chan Envelope
- type ConfigValidator
- type CredentialEvent
- type CredentialObserver
- type CredentialObserverFunc
- type CredentialSource
- type CredentialStatus
- type CredentialStatusProvider
- type Envelope
- type Error
- type FuncComponent
- type GRPCHealthAdapter
- type HealthStatus
- type MetricsSink
- type Registry
- type ReloadResult
- type Reloadable
- type Resource
- type Runtime
- func (r *Runtime) Add(component Component) error
- func (r *Runtime) AddWithDependencies(component Component, dependencies ...string) error
- func (r *Runtime) Close(ctx context.Context) error
- func (r *Runtime) Ready(ctx context.Context) error
- func (r *Runtime) Reload(ctx context.Context, name string, envelope Envelope) (ReloadResult, error)
- func (r *Runtime) Start(ctx context.Context) error
- func (r *Runtime) Status() []Snapshot
- type RuntimeMetrics
- type Snapshot
- type State
Constants ¶
const DefaultShutdownTimeout = 30 * time.Second
const Version = "0.6.0"
Variables ¶
This section is empty.
Functions ¶
func AdminHandler ¶
func AdminHandler(store *ConfigStore, runtime *Runtime) http.Handler
AdminHandler exposes local, authenticated-by-the-host admin operations. It does not implement network authentication; products must mount it behind Reef or an equivalent trusted boundary.
func ConformanceCheck ¶
ConformanceCheck performs cheap, deterministic checks an adapter can run in its own test suite. It does not start network listeners or inspect product internals.
func HTTPHandler ¶
HTTPHandler exposes the stable operational endpoints for a component. Products can mount it into an existing mux.
func RedactConfig ¶
RedactConfig removes values for fields conventionally carrying secrets. It is intended for status/admin output, never for applying configuration.
func Run ¶
Run starts runtime and blocks until ctx is canceled, then performs a context-bounded close. Signal delivery belongs to the executable and should be converted to context cancellation with os/signal.NotifyContext.
func RunWithShutdownTimeout ¶ added in v0.6.0
RunWithShutdownTimeout is Run with an explicit shutdown bound. Shutdown gets a fresh context because ctx has already been canceled when cleanup begins.
func RuntimeHTTPHandler ¶
RuntimeHTTPHandler exposes aggregate operational endpoints.
Types ¶
type AuditEvent ¶
type CheckScope ¶
type CheckScope string
const ( ScopeLiveness CheckScope = "liveness" ScopeReadiness CheckScope = "readiness" )
type ConfigApplier ¶
type ConfigApplier interface {
Apply(context.Context, Envelope) (ReloadResult, error)
}
type ConfigStore ¶
type ConfigStore struct {
// contains filtered or unexported fields
}
func (*ConfigStore) ApplyWith ¶ added in v0.6.0
func (s *ConfigStore) ApplyWith(ctx context.Context, envelope Envelope, expected uint64, apply ConfigApplyFunc) error
ApplyWith commits envelope only after apply succeeds. The generation check, product apply, and store commit are serialized as one transaction from the perspective of other ConfigStore operations.
func (*ConfigStore) Audit ¶
func (s *ConfigStore) Audit() []AuditEvent
func (*ConfigStore) Current ¶
func (s *ConfigStore) Current() (Envelope, bool)
func (*ConfigStore) Rollback ¶
func (s *ConfigStore) Rollback(ctx context.Context, generation uint64) error
func (*ConfigStore) RollbackWith ¶ added in v0.6.0
func (s *ConfigStore) RollbackWith(ctx context.Context, generation uint64, apply ConfigApplyFunc) error
RollbackWith reapplies a historical config as a new monotonic generation and commits it only after apply succeeds.
type CredentialEvent ¶
type CredentialEvent struct {
Status CredentialStatus `json:"status"`
Success bool `json:"success"`
Changed bool `json:"changed"`
}
type CredentialObserver ¶
type CredentialObserver interface{ ObserveCredential(CredentialEvent) }
type CredentialObserverFunc ¶
type CredentialObserverFunc func(CredentialEvent)
func (CredentialObserverFunc) ObserveCredential ¶
func (f CredentialObserverFunc) ObserveCredential(e CredentialEvent)
type CredentialSource ¶
type CredentialSource interface {
CredentialStatus() []CredentialStatus
Close() error
}
CredentialSource is the narrow bridge for Reef or another provider. Gyre observes lifecycle only; loading, rotation, and policy stay provider-owned.
type CredentialStatus ¶
type CredentialStatus struct {
Name string `json:"name"`
Kind string `json:"kind"`
Generation uint64 `json:"generation"`
LastSuccess time.Time `json:"last_success,omitempty"`
LastFailure time.Time `json:"last_failure,omitempty"`
LastError string `json:"last_error,omitempty"`
NotBefore time.Time `json:"not_before,omitempty"`
NotAfter time.Time `json:"not_after,omitempty"`
}
CredentialStatus is deliberately secret-free and can be backed by Reef's credential.Status without importing Reef into Gyre core.
type CredentialStatusProvider ¶
type CredentialStatusProvider interface {
CredentialSource
SetObserver(CredentialObserver)
}
type Envelope ¶
type Envelope struct {
APIVersion string `json:"api_version" yaml:"api_version"`
Kind string `json:"kind" yaml:"kind"`
Generation uint64 `json:"generation" yaml:"generation"`
Spec json.RawMessage `json:"spec" yaml:"spec"`
}
func RedactEnvelope ¶ added in v0.6.0
RedactEnvelope recursively removes conventionally secret values from a JSON config envelope. Invalid JSON is omitted rather than returned verbatim.
type FuncComponent ¶
type FuncComponent struct {
ComponentName string
ComponentVersion string
StartFunc func(context.Context) error
ReadyFunc func(context.Context) error
CloseFunc func(context.Context) error
StatusFunc func() Snapshot
}
FuncComponent adapts an existing product lifecycle to Gyre. It is useful during migration and keeps compatibility code at the boundary.
func (*FuncComponent) Name ¶
func (f *FuncComponent) Name() string
func (*FuncComponent) Status ¶
func (f *FuncComponent) Status() Snapshot
func (*FuncComponent) Version ¶
func (f *FuncComponent) Version() string
type GRPCHealthAdapter ¶
type GRPCHealthAdapter struct{ Runtime *Runtime }
GRPCHealthAdapter provides the semantics required by grpc health services without forcing gyre to depend on a particular gRPC implementation. A transport bridge can translate HealthStatus to its native enum.
func (GRPCHealthAdapter) Check ¶
func (a GRPCHealthAdapter) Check(ctx context.Context, service string) HealthStatus
type HealthStatus ¶
type HealthStatus int
HealthStatus is intentionally wire-neutral and maps directly to the grpc.health.v1 ServingStatus values in adapters.
const ( HealthUnknown HealthStatus = iota HealthServing HealthNotServing )
type MetricsSink ¶
MetricsSink is a minimal integration point for products' metrics systems. Implementations should keep recording non-blocking and allocation-light.
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry coordinates a set of components with deterministic startup and reverse-order shutdown. It intentionally does not infer dependencies.
type ReloadResult ¶
func ReloadTransaction ¶
func ReloadTransaction(ctx context.Context, envelope Envelope, validator ConfigValidator, applier ConfigApplier) (ReloadResult, error)
ReloadTransaction validates and applies a generation atomically from the caller's perspective: Apply is invoked only after validation succeeds.
type Reloadable ¶
type Reloadable interface {
Reload(context.Context, Envelope) (ReloadResult, error)
}
type Resource ¶
func MergeResource ¶
Merge applies layers from weakest to strongest. Explicit conflicting service.name values are rejected instead of silently changing identity.
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime owns the lifecycle of registered components and coordinates reloads. Product code still owns dependency meaning and configuration decoding.
func (*Runtime) AddWithDependencies ¶
type RuntimeMetrics ¶
type RuntimeMetrics struct{ Sink MetricsSink }
RuntimeMetrics wraps a sink and can be used by lifecycle adapters.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package conformance provides the reusable Gyre adapter contract suite.
|
Package conformance provides the reusable Gyre adapter contract suite. |