Documentation
¶
Overview ¶
Package graphlexical is the graph-lexical component: it follows ENTITY_STATES and keeps an in-memory word index (graph/lexical) of each entity's text, rebuilt from the bucket on every start, and reports on the graph-lexical readiness key. An entity's text is chosen by graph/entitytext, the rule graph-embedding uses, split into the entity's name and its body. No model or external provider is involved at any tier.
Every delivered change is applied in delivery order, and a delivery at or below the revision the index holds for its key is ignored. A revision is reported applied only once the index holds its text.
An entity whose body is offloaded to a store is indexed by its inline text at once, and by its body once the one goroutine that reads every body has read it. A body the index does not hold is queued, unread, missing or has no store. Only unread is a failure: the readiness key reads degraded and Health names it until a repair pass, every 30 seconds, reads the body. A read that fails on a store skips that store until the next pass.
The index answers graph.lexical.query.search (graph.LexicalSearchRequest, replying graph.LexicalSearchData in a graph.QueryResponse) from Start until Stop. It refuses transient index_not_ready until the initial build is applied and while the feed is lost, and answers min_revision against the follower's floor as graph-index does. No body state withholds it.
A composition registers the factory with Register and creates the component through the component manager, with a configuration that Config describes.
Index ¶
- func CreateGraphLexical(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 CreateGraphLexical ¶
func CreateGraphLexical(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)
CreateGraphLexical is the factory function for graph-lexical components. It opens no connection. It reads the vocabulary's label predicates, so a product registers its own first. Offloaded bodies are read from the stores in deps.StoreRegistry, looked up at each read.
func DeclarePorts ¶
func DeclarePorts(rawConfig json.RawMessage, _ string) (component.PortConfig, error)
DeclarePorts is the component.PortDeclarer for graph-lexical: the ports CreateGraphLexical will report for rawConfig, computed without dependencies.
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component implements the graph-lexical 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 or 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: the index lives in the component's memory.
func (*Component) Start ¶
Start begins following ENTITY_STATES into a new, empty index, so every start rebuilds it. 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 the query subscriptions run under it. The follower's watch runs under a run context start creates and cleanup ends, so ending ctx after Start returned stops nothing (ADR-113). The search verb is served from Start until Stop.
type Config ¶
type Config struct {
Ports *component.PortConfig `json:"ports" schema:"type:ports,description:Port configuration,category:basic"`
// TextSuffixes are the predicate suffixes whose string values are an entity's text, as for
// graph-embedding; empty means entitytext.DefaultSuffixes.
TextSuffixes []string `` /* 199-byte string literal not displayed */
// MaxTextLen is the most characters of an entity's body indexed, as for graph-embedding; the
// body's tail past it is cut at a word boundary, and the name is never cut. 0 means 16,000.
MaxTextLen int `` /* 205-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-lexical configuration. Decoding is strict: a key it does not define is refused, naming it.
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.