Documentation
¶
Index ¶
Constants ¶
const ConfigKey = "dynamic-lifecycle-config"
const TableName = "dynamic-features"
Variables ¶
var (
ByFeature = featureIndex.Query
)
var Cell = cell.Module( "dynamic-lifecycle-manager", "Groups dynamic feature lifecycles and allows to start and stop dynamically", cell.ProvidePrivate( newDynamicFeatureTable, newOps, ), cell.Provide( statedb.RWTable[*DynamicFeature].ToTable, ), cell.Invoke( registerWatcher, registerReconciler, ), cell.Config(defaultConfig), )
Cell registers a manager that manages the lifecycle of dynamic features. It allows to add new DynamicFeatureName, Append cell.HookInterface, and Start/Stop lifecycles. A dynamic feature is a group of cell hooks that are grouped together and their lifecycles are managed by the feature manager. The manager uses the DynamicConfig table as the source of truth for enablement. The manager delegates the responsibility of enablement to DynamicFeature StateDB reconciler.
Functions ¶
func WithDynamicLifecycle ¶
func WithDynamicLifecycle(feature DynamicFeatureName, deps []DynamicFeatureName, cells ...cell.Cell) cell.Cell
WithDynamicLifecycle provides a wrapper over the cell.Lifecycle to register DynamicFeature It groups the cells by DynamicFeatureName, providing a DynamicLifecycle for each feature. The hooks are immutable after the hive is initialized and are stored in a stateDB table, see table.go.
Types ¶
type DynamicFeature ¶
type DynamicFeature struct {
Name DynamicFeatureName // DynamicFeature name
Hooks []cell.HookInterface // Lifecycle hooks
Deps []DynamicFeatureName // DynamicFeature dependencies
Enabled bool // lifecycle enablement status
IsRunning bool // lifecycle running status
Status reconciler.Status // reconciliation status
StartedAt time.Time // last lifecycle start time
StoppedAt time.Time // last lifecycle stop time
StartDuration time.Duration // last lifecycle start time duration
}
func (*DynamicFeature) Clone ¶
func (tl *DynamicFeature) Clone() *DynamicFeature
Clone returns a shallow copy of the DynamicFeature.
func (*DynamicFeature) TableHeader ¶
func (tl *DynamicFeature) TableHeader() []string
func (*DynamicFeature) TableRow ¶
func (tl *DynamicFeature) TableRow() []string
type DynamicFeatureName ¶
type DynamicFeatureName string
func (DynamicFeatureName) String ¶
func (f DynamicFeatureName) String() string
type FeatureStatus ¶
type FeatureStatus struct {
Feature DynamicFeatureName
Enabled bool
}
type Lifecycle ¶
type Lifecycle struct {
Hooks []cell.HookInterface // Lifecycle hooks
// contains filtered or unexported fields
}
Lifecycle provides a wrapper over the cell.Lifecycle which only allows appending hooks and performing get on them.
func (*Lifecycle) Append ¶
func (l *Lifecycle) Append(hook cell.HookInterface)