Documentation
¶
Overview ¶
Package graphclustering is the graph-clustering component: it follows ENTITY_STATES and keeps COMMUNITY_INDEX current, one bounded record per entity-ID prefix group, through the graph/clustering Maintainer, and reports on the graph-clustering readiness key. A group is every entity that shares the first 4, 3 or 2 parts of its ID. At tier 0 nothing reaches an external provider: communities are derived from IDs, not detected (ADR-099).
Every delivered change is applied to the Maintainer in delivery order. A ticker publishes the changed groups every detection_interval, and only after the follower has applied the whole replay and while its feed is intact.
A composition registers the factory with Register and creates the component through the component manager, with a configuration that Config describes.
Index ¶
- func CreateGraphClustering(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)
- func DeclarePorts(rawConfig json.RawMessage, _ string) (component.PortConfig, error)
- func Register(registry *component.Registry) error
- type Component
- func (c *Component) DataFlow() component.FlowMetrics
- func (c *Component) Health() component.HealthStatus
- func (c *Component) Initialize() error
- func (c *Component) InputPorts() []component.Port
- func (c *Component) OutputPorts() []component.Port
- func (c *Component) Start(ctx context.Context) error
- func (c *Component) Stop(ctx context.Context) error
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGraphClustering ¶
func CreateGraphClustering(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)
CreateGraphClustering is the factory function for graph-clustering components. It opens no connection.
func DeclarePorts ¶
func DeclarePorts(rawConfig json.RawMessage, _ string) (component.PortConfig, error)
DeclarePorts is the component.PortDeclarer for graph-clustering: the ports CreateGraphClustering will report for rawConfig, computed without dependencies.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component implements the graph-clustering processor.
func (*Component) DataFlow ¶
func (c *Component) DataFlow() component.FlowMetrics
DataFlow reports input messages: one per delivered ENTITY_STATES entry, update or delete, with the delivered value's length.
func (*Component) Health ¶
func (c *Component) Health() component.HealthStatus
Health reports the shell's verdict (component.Lifecycle.Health) over the follower's stuck states: a latched reset, the failures the last tick reported (refused entities, a failed publication), a lost feed.
func (*Component) Initialize ¶
Initialize marks the component initialized (no I/O); the factory validated the configuration.
func (*Component) InputPorts ¶
InputPorts returns the input ports, fixed at construction.
func (*Component) OutputPorts ¶
OutputPorts returns no ports: graph-clustering writes COMMUNITY_INDEX itself.
func (*Component) Start ¶
Start begins following ENTITY_STATES into the maintainer. The lifecycle state is the shell's (component.Lifecycle): Start before Initialize, a nil or ended context and a second Start are refused, the second with errs.ErrAlreadyStarted, and a Start that fails is rolled back through cleanup. A component with no NATS client is refused first.
ctx bounds Start only: the wait for ENTITY_STATES and opening COMMUNITY_INDEX run under it. The follower's watch and the ticker, which publishes every detection_interval, run under a run context start creates and cleanup ends, so ending ctx after Start returned stops nothing (ADR-113).
type Config ¶
type Config struct {
Ports *component.PortConfig `json:"ports" schema:"type:ports,description:Port configuration,category:basic"`
// DetectionInterval is the time between publications of the changed groups, a Go duration
// such as 30s or 5m; empty means 30s.
DetectionInterval string `` /* 148-byte string literal not displayed */
// Dependency startup configuration
StartupAttempts int `` /* 130-byte string literal not displayed */
StartupInterval int `` /* 134-byte string literal not displayed */
}
Config holds the graph-clustering configuration. Decoding is strict: a key it does not define is refused, and a removed key is refused with what replaces it (design D3).
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a valid default configuration.
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults resolves each zero value to the value its reader uses. Validate only checks.