ores.history.core

Table of Contents

Diagram

ores.history.core component diagram

Figure 1: ores.history.core

Summary

ores.history.core is the server-only half of ores.history: a dispatch_registry that looks up a caller-registered history provider function by entity_type — the same composed-registrar meta-pattern (Entity-composed registrars) applied as a runtime lookup table instead of N separate subject subscriptions — and the NATS handler/registrar glue that subscribes the single history.v1.get subject.

This layer depends on ores.database=/=ores.security directly: it is server-only glue no client ever touches, and every service that registers a history_provider already links both to do anything else. history_handler resolves each request via make_request_context() exactly like every other NATS handler in the codebase, so a provider receives the same fully-scoped database::context (tenant, party, roles, workspace) any other subject's handler would get — no bespoke auth-context threading.

Inputs

  • Per-entity history providersstd::function<std::vector<entity_history_version>(const database::context& ctx, const std::string& entity_id)> — registered by each domain service/component at startup, keyed by that entity's entity_type_of() string. ctx is the same fully-resolved context any other handler in that service would use — a provider calls its own repository/service with it exactly like every other handler does, no unpacking required.
  • A get_entity_history_request (entity_type, entity_id) arriving on the shared history.v1.get NATS subject.

Outputs

  • The get_entity_history_response from ores.history.api, published back on the request's reply subject.

Entry points

  • include/ores.history.core/service/dispatch_registry.hpp — the server-side registry: register_history_provider(entity_type, fn) and dispatch(request, ctx).
  • include/ores.history.core/messaging/history_handler.hpp — the NATS auth/decode/dispatch/reply glue shared by every entity, resolving each request via make_request_context().
  • include/ores.history.core/messaging/registrar.hppregister_history_handlers(nats, registry, queue_group, ctx, verifier), subscribing the single history.v1.get subject to a history_handler backed by a caller-owned dispatch_registry. Call once per service process, after registering that service's own entities' providers.

Dependencies

  • ores.history.api — the wire types and build_entity_history_versions() every provider uses.
  • ores.database / ores.securitydatabase::context and jwt_authenticator.
  • ores.nats / ores.service / ores.logging — the NATS subscribe/decode/reply plumbing.

See also

Emacs 29.3 (Org mode 9.6.15)