Documentation
¶
Overview ¶
Package descriptor provides self-description, manifest, and predict functionality for pulse.
Index ¶
- Constants
- type CohortFieldType
- type Command
- type Components
- type DictionaryInfo
- type Envelope
- func Inspect(fileData io.ReadSeeker, opts *InspectOptions) *Envelope
- func InspectFromBytes(data []byte, opts *InspectOptions) *Envelope
- func NewEnvelope(data any) *Envelope
- func Predict(fileData io.ReadSeeker, req *types.Request, opts *PredictOptions) *Envelope
- func PredictFromBytes(data []byte, req *types.Request, opts *PredictOptions) *Envelope
- type EnvelopeEntry
- type InspectField
- type InspectOptions
- type InspectResult
- type Manifest
- type PredictOptions
- type PredictResult
- type PredictSchemaInfo
- type SkillMeta
Constants ¶
const DefaultDictionaryLimit = 100
DefaultDictionaryLimit is the default max entries shown for categorical dictionaries.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CohortFieldType ¶
CohortFieldType describes a field type available in .pulse files.
type Components ¶
type Components struct {
Aggregators []string `json:"aggregators"`
Attributes []string `json:"attributes"`
Filterers []string `json:"filterers"`
Groupers []string `json:"groupers"`
}
Components lists all registered processing components.
type DictionaryInfo ¶
type DictionaryInfo struct {
TotalEntries int `json:"total_entries"`
Truncated bool `json:"truncated"`
Values []string `json:"values"`
}
DictionaryInfo describes the categorical dictionary for a field.
type Envelope ¶
type Envelope struct {
FormatVersion string `json:"format_version"`
Data any `json:"data"`
Errors []*EnvelopeEntry `json:"errors"`
Warnings []*EnvelopeEntry `json:"warnings"`
}
Envelope is the standard JSON output wrapper for all descriptor operations. All --json output follows this shape.
func Inspect ¶
func Inspect(fileData io.ReadSeeker, opts *InspectOptions) *Envelope
Inspect reads a .pulse file header and schema, returning structured field information. It never reads record data.
func InspectFromBytes ¶
func InspectFromBytes(data []byte, opts *InspectOptions) *Envelope
InspectFromBytes is a convenience wrapper that creates a reader from bytes.
func NewEnvelope ¶
NewEnvelope creates an envelope with the given data and no errors/warnings.
func Predict ¶
func Predict(fileData io.ReadSeeker, req *types.Request, opts *PredictOptions) *Envelope
Predict validates a request against a .pulse file without executing it. It reads only the header and schema, never record data. The returned Envelope contains the PredictResult in Data and any errors/warnings encountered.
func PredictFromBytes ¶
func PredictFromBytes(data []byte, req *types.Request, opts *PredictOptions) *Envelope
PredictFromBytes is a convenience wrapper that creates a reader from bytes.
func (*Envelope) AddWarning ¶
AddWarning appends a structured warning to the envelope.
func (*Envelope) MarshalJSON ¶
MarshalJSON produces deterministic JSON output.
type EnvelopeEntry ¶
type EnvelopeEntry struct {
Code string `json:"code"`
Message string `json:"message"`
Details map[string]any `json:"details,omitempty"`
}
EnvelopeEntry represents a single error or warning in the envelope.
type InspectField ¶
type InspectField struct {
Name string `json:"name"`
Type string `json:"type"`
ByteOffset int `json:"byte_offset"`
BitPosition int `json:"bit_position"`
Description string `json:"description"`
DescriptionSource string `json:"description_source"`
Categorical bool `json:"categorical"`
Dictionary *DictionaryInfo `json:"dictionary,omitempty"`
}
InspectField describes a single field in the inspect output.
type InspectOptions ¶
type InspectOptions struct {
// FullDict disables dictionary truncation when true.
FullDict bool
// DictionaryLimit overrides the default truncation limit.
// Zero means use DefaultDictionaryLimit.
DictionaryLimit int
}
InspectOptions controls inspect behavior.
type InspectResult ¶
type InspectResult struct {
FieldCount int `json:"field_count"`
Fields []*InspectField `json:"fields"`
}
InspectResult holds the schema inspection output.
type Manifest ¶
type Manifest struct {
FormatVersion string `json:"format_version"`
Commands []Command `json:"commands"`
Components Components `json:"components"`
CohortTypes []CohortFieldType `json:"cohort_types"`
Skills []SkillMeta `json:"skills"`
}
Manifest is the root self-description of the Pulse system.
func BuildManifest ¶
func BuildManifest() *Manifest
BuildManifest constructs a deterministic Manifest from the current registries.
type PredictOptions ¶
type PredictOptions struct {
// Strict upgrades warnings to errors.
Strict bool
}
PredictOptions controls predict behavior.
type PredictResult ¶
type PredictResult struct {
Valid bool `json:"valid"`
Request *types.Request `json:"request"`
SchemaInfo *PredictSchemaInfo `json:"schema_info,omitempty"`
}
PredictResult holds the validated request and any diagnostics.
type PredictSchemaInfo ¶
type PredictSchemaInfo struct {
FieldCount int `json:"field_count"`
Fields []string `json:"fields"`
}
PredictSchemaInfo summarizes the schema used for prediction.