ores.history.core
Table of Contents
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 providers —
std::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'sentity_type_of()string.ctxis 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 sharedhistory.v1.getNATS subject.
Outputs
- The
get_entity_history_responsefrom 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)anddispatch(request, ctx).include/ores.history.core/messaging/history_handler.hpp— the NATS auth/decode/dispatch/reply glue shared by every entity, resolving each request viamake_request_context().include/ores.history.core/messaging/registrar.hpp—register_history_handlers(nats, registry, queue_group, ctx, verifier), subscribing the singlehistory.v1.getsubject to ahistory_handlerbacked by a caller-owneddispatch_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.security—database::contextandjwt_authenticator.ores.nats/ores.service/ores.logging— the NATS subscribe/decode/reply plumbing.
See also
- ores.history — the group overview.
- ores.history.api — the wire-type sibling this component depends on.
- History Diff Architecture — the design this component implements.
- Entity-composed registrars — the meta-pattern this component's dispatch registry reapplies as a runtime lookup table.
