Documentation
¶
Index ¶
- Variables
- func AddConfigOverride[Cfg cell.Flagger](h *Hive, override func(*Cfg))
- func NewStateDBMetricsImpl(m StateDBMetrics) statedb.Metrics
- func NewStateDBReconcilerMetricsImpl(m ReconcilerMetrics) reconciler.Metrics
- type Fence
- type Hive
- type OnDemand
- type Options
- type ReconcilerMetrics
- type Shutdowner
- type StateDBMetrics
- type WaitFunc
Constants ¶
This section is empty.
Variables ¶
var (
ShutdownWithError = upstream.ShutdownWithError
)
Functions ¶
func AddConfigOverride ¶
func NewStateDBMetricsImpl ¶ added in v1.17.0
func NewStateDBMetricsImpl(m StateDBMetrics) statedb.Metrics
func NewStateDBReconcilerMetricsImpl ¶ added in v1.17.0
func NewStateDBReconcilerMetricsImpl(m ReconcilerMetrics) reconciler.Metrics
Types ¶
type Fence ¶ added in v1.18.0
type Fence interface {
// Add a named wait function to the fence.
// The provided function should block until ready or until context has been
// cancelled. It should return [context.Err] if context is cancelled.
//
// This method will panic if called after Hive has started to ensure that when
// Wait() is called all initializers have already been registered.
Add(name string, waitFn WaitFunc)
// Wait blocks until all registered initializers have completed or until
// context has cancelled.
//
// This method will panic if called before Hive is started.
// Can be called any number of times.
Wait(ctx context.Context) error
}
Fence is an utility for blocking until registered wait functions have completed.
The wait functions can only be Add()'d' before Hive is started, e.g. from constructors or invoke functions. Conversely Wait() method can only be called during/after Hive start.
type OnDemand ¶ added in v1.17.0
type OnDemand[Resource any] interface { // Acquire a resource. On the first call to Acquire() the underlying // resource is started with the provided context that aborts the start // if the context is cancelled. On failure to start the resulting error // is returned. Acquire(context.Context) (Resource, error) // Release a resource. When the last acquired reference to the resource // is released the resource is stopped. If stopping the resource fails // the error is returned. Release(resource Resource) error }
OnDemand provides access to a resource on-demand. On first call to Acquire() the resource is started (cell.Lifecycle.Start). If the starting of the resource fails Acquire() returns the error from Start(). When all references are Release()'d the resource is stopped (cell.Lifecycle.Stop), and again failure from Stop() is returned.
func NewOnDemand ¶ added in v1.17.0
func NewOnDemand[Resource any](log *slog.Logger, resource Resource, lc cell.Lifecycle) OnDemand[Resource]
NewOnDemand wraps a resource that will be started and stopped on-demand. The resource and the lifecycle hooks are provided separately, but can of course be the same thing. They're separate to support the use-case where the resource is a state object (e.g. StateDB table) and the hook is a job group that populates the object.
func NewStaticOnDemand ¶ added in v1.17.0
NewStaticOnDemand creates an on-demand resource that is "static", i.e. always running and not started or stopped.
type ReconcilerMetrics ¶ added in v1.16.0
type ReconcilerMetrics struct {
ReconciliationCount metric.Vec[metric.Counter]
ReconciliationDuration metric.Vec[metric.Observer]
ReconciliationTotalErrors metric.Vec[metric.Counter]
ReconciliationCurrentErrors metric.Vec[metric.Gauge]
PruneCount metric.Vec[metric.Counter]
PruneTotalErrors metric.Vec[metric.Counter]
PruneDuration metric.Vec[metric.Observer]
}
func NewStateDBReconcilerMetrics ¶ added in v1.16.0
func NewStateDBReconcilerMetrics() ReconcilerMetrics
type Shutdowner ¶
type Shutdowner = upstream.Shutdowner
type StateDBMetrics ¶ added in v1.16.0
type StateDBMetrics struct {
// How long a read transaction was held.
WriteTxnDuration metric.Vec[metric.Observer]
// How long writers were blocked while waiting to acquire a write transaction for a specific table.
TableContention metric.Vec[metric.Observer]
// The amount of objects in a given table.
TableObjectCount metric.Vec[metric.Gauge]
// The current revision of a given table.
TableRevision metric.Vec[metric.Gauge]
// The amount of delete trackers for a given table.
TableDeleteTrackerCount metric.Vec[metric.Gauge]
// The amount of objects in the graveyard for a given table.
TableGraveyardObjectCount metric.Vec[metric.Gauge]
// The lowest revision of a given table that has been processed by the graveyard garbage collector.
TableGraveyardLowWatermark metric.Vec[metric.Gauge]
// The time it took to clean the graveyard for a given table.
TableGraveyardCleaningDuration metric.Vec[metric.Observer]
}
func NewStateDBMetrics ¶ added in v1.16.0
func NewStateDBMetrics() StateDBMetrics