Перейти к содержимому

Projections

Это содержимое пока не доступно на вашем языке.

Built-in projections materialize views from streams or $all without changing the source event log. State lives under data/projections/<name>/.

Runtime Program Notes
builtin count, count_by_type, sum_field, latest_by_key, group_count Fast fixed aggregations
cel CEL expression over event, state, position, version JSON numbers are doubles; cast with double(...) / int(double(...))
starlark def reduce(event, state): ... Sandboxed; no FS/network

JavaScript is not supported. WASM is not available in the current documented runtime set.

Terminal window
./bin/chronacta projection create -name orders-count -runtime builtin -program count \
-source-stream orders-1 \
-filter 'event.event_type == "OrderCreated" || event.event_type == "OrderPaid"'
./bin/chronacta projection rebuild -name orders-count
./bin/chronacta projection result -name orders-count
./bin/chronacta projection status -name orders-count
./bin/chronacta projection verify-checkpoint -name orders-count

Optional create flags: -event-types, -filter (CEL bool), -initial-state, -version.

Operational commands: enable, disable, resume, restore-checkpoint, migrate, detect-stalled, errors, dead-letters, delete.

  • Checkpoint advances only after successful processing (or intentional skip of non-matching source events)
  • Stream-scoped projections ignore other streams but still scan $all by global position
  • Prefer rebuild after create when historical events already exist
  • Failures retry then poison into dead letters; source log is unchanged
  • Projection files are included in versioned backups

For SQL/UI/BI, project events into Postgres with a YAML schema and chronacta sqlgen (DDL/DML). JSON projections above stay for ops. See postgres-projections.md.

See also CLI and the examples/projection-test binary.