Documentation
¶
Overview ¶
Package graphindextemporal provides the graph-index-temporal component for temporal indexing.
Package graphindextemporal provides the graph-index-temporal component for temporal indexing.
Overview ¶
The graph-index-temporal component watches the ENTITY_STATES KV bucket and maintains a time-based index for entities with temporal data. This enables efficient time-range queries like "find entities modified between dates" or "find entities by hour".
Architecture ¶
graph-index-temporal is an optional component that can be enabled for deployments requiring time-based query capabilities.
┌──────────────────────┐
ENTITY_STATES ─────►│ │
(KV watch) │ graph-index-temporal├──► TEMPORAL_INDEX (KV)
│ │
└──────────────────────┘
Features ¶
- Configurable time resolution (minute, hour, day)
- Automatic extraction of timestamps from entity data
- Batch processing for efficient index updates
- Time bucket keys for range queries
Configuration ¶
The component is configured via JSON with the following structure:
{
"ports": {
"inputs": [
{"name": "entity_watch", "subject": "ENTITY_STATES", "type": "kv-watch"}
],
"outputs": [
{"name": "temporal_index", "subject": "TEMPORAL_INDEX", "type": "kv"}
]
},
"time_resolution": "hour",
"workers": 4,
"batch_size": 100
}
Time Resolution ¶
The time_resolution setting controls the granularity of temporal indexing:
- minute: Index by minute (YYYY-MM-DDTHH:MM)
- hour: Index by hour (YYYY-MM-DDTHH) - default
- day: Index by day (YYYY-MM-DD)
Port Definitions ¶
Inputs:
- KV watch: ENTITY_STATES - watches for entity state changes
Outputs:
- KV bucket: TEMPORAL_INDEX - time-based index
Usage ¶
Register the component with the component registry:
import graphindextemporal "github.com/c360studio/semstreams/processor/graph-index-temporal"
func init() {
graphindextemporal.Register(registry)
}
Dependencies ¶
Upstream:
- graph-ingest: produces ENTITY_STATES that this component watches
Downstream:
- graph-gateway: reads TEMPORAL_INDEX for time-range queries
Package graphindextemporal query handlers
Index ¶
- func CreateGraphIndexTemporal(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)
- func Register(registry *component.Registry) error
- type Component
- func (c *Component) ConfigSchema() component.ConfigSchema
- 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) Meta() component.Metadata
- func (c *Component) OutputPorts() []component.Port
- func (c *Component) Start(ctx context.Context) error
- func (c *Component) Stop(timeout time.Duration) error
- type Config
- type TemporalResult
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateGraphIndexTemporal ¶
func CreateGraphIndexTemporal(rawConfig json.RawMessage, deps component.Dependencies) (component.Discoverable, error)
CreateGraphIndexTemporal is the factory function for creating graph-index-temporal components
Types ¶
type Component ¶
type Component struct {
// contains filtered or unexported fields
}
Component implements the graph-index-temporal processor
func (*Component) ConfigSchema ¶
func (c *Component) ConfigSchema() component.ConfigSchema
ConfigSchema returns the configuration schema
func (*Component) DataFlow ¶
func (c *Component) DataFlow() component.FlowMetrics
DataFlow returns current data flow metrics
func (*Component) Health ¶
func (c *Component) Health() component.HealthStatus
Health returns current health status
func (*Component) Initialize ¶
Initialize validates configuration and sets up ports (no I/O)
func (*Component) InputPorts ¶
InputPorts returns input port definitions
func (*Component) OutputPorts ¶
OutputPorts returns output port definitions
type Config ¶
type Config struct {
Ports *component.PortConfig `json:"ports" schema:"type:ports,description:Port configuration,category:basic"`
TimeResolution string `json:"time_resolution" schema:"type:string,description:Time resolution (minute hour day),category:basic"`
Workers int `json:"workers" schema:"type:int,description:Number of worker goroutines,category:advanced"`
BatchSize int `json:"batch_size" schema:"type:int,description:Batch size for processing,category:advanced"`
// Dependency startup configuration
StartupAttempts int `` /* 130-byte string literal not displayed */
StartupInterval int `` /* 134-byte string literal not displayed */
}
Config holds configuration for graph-index-temporal component
func DefaultConfig ¶
func DefaultConfig() Config
DefaultConfig returns a valid default configuration
func (*Config) ApplyDefaults ¶
func (c *Config) ApplyDefaults()
ApplyDefaults sets default values for configuration
type TemporalResult ¶
TemporalResult represents an entity found in temporal search