Durable journals, canonical serialization, schemas, and migrations. More...
Namespaces | |
| namespace | pulp::timeline::detail |
Classes | |
| struct | pulp::timeline::FileJournalError |
| File-journal failure with the offending byte and nested JSON error. More... | |
| struct | pulp::timeline::FileJournalLimits |
| File size, record size, and nested decode ceilings. More... | |
| struct | pulp::timeline::FileJournalOpenResult |
| Result of opening or recovering a native Timeline journal. More... | |
| class | pulp::timeline::FileJournal |
| Native, crash-consistent Timeline persistence sink. More... | |
| struct | pulp::timeline::JournalLimits |
| In-memory command-journal quotas. More... | |
| struct | pulp::timeline::JournalEntry |
| One contiguous revision transition retained by the command journal. More... | |
| class | pulp::timeline::JournalSink |
| Synchronous durability boundary used by DocumentSession. More... | |
| class | pulp::timeline::CommandJournal |
| Bounded, replayable in-memory log of contiguous document revisions. More... | |
| struct | pulp::timeline::PersistenceError |
| Structured persistence failure. More... | |
| struct | pulp::timeline::DecodeLimits |
| Parser, migration, opaque-payload, and Timeline structure quotas. More... | |
| struct | pulp::timeline::JsonValue |
| Owning JSON DOM node with source byte bounds. More... | |
| struct | pulp::timeline::JsonObjectMember |
| Pair-like owning member of a JSON object. More... | |
| class | pulp::timeline::ParsedJson |
| Parsed JSON tree that owns the source bytes referenced by node offsets. More... | |
| struct | pulp::timeline::StructuralPreflightSuccess |
| Empty success value returned by structural preflight. More... | |
| struct | pulp::timeline::SchemaWriteSuccess |
| Empty success value returned by bounded schema writers. More... | |
| class | pulp::timeline::BoundedJsonSink |
| Append-only JSON output sink with an enforced byte ceiling. More... | |
| struct | pulp::timeline::FieldSchema |
| Public field metadata for one registered schema type. More... | |
| struct | pulp::timeline::SchemaCodec |
| Immutable callback bundle and shared context for a registered type. More... | |
| struct | pulp::timeline::MigrationStep |
| One adjacent version transition for a schema type. More... | |
| struct | pulp::timeline::TypeSchema |
| Complete registration contract for one domain-qualified schema type. More... | |
| struct | pulp::timeline::SchemaError |
| Schema-registration failure with the affected type and version. More... | |
| struct | pulp::timeline::SchemaRegistration |
| Empty success value returned after registering a schema. More... | |
| class | pulp::timeline::SchemaRegistry |
| Immutable, shareable registry of Timeline schema contracts. More... | |
| class | pulp::timeline::SchemaRegistryBuilder |
| Mutable, single-owner accumulator for constructing a SchemaRegistry. More... | |
| struct | pulp::timeline::SchemaVersionTarget |
| Target version for one schema identity in a release projection. More... | |
| struct | pulp::timeline::SchemaReleaseMap |
| Immutable set of schema-version targets identified by a release label. More... | |
| struct | pulp::timeline::SerializeOptions |
| Output quota for project serialization. More... | |
| struct | pulp::timeline::SerializedSnapshot |
| Canonical serialized project plus extension-preservation status. More... | |
| struct | pulp::timeline::ProjectSnapshotCounts |
| Structural item counts extracted from a serialized project. More... | |
| struct | pulp::timeline::ProjectSnapshotSummary |
| Allocation-light metadata view for project browsers and admission checks. More... | |
Typedefs | |
| using | pulp::timeline::SchemaDecodeFn |
| Decodes schema data into an immutable type-erased value. | |
| using | pulp::timeline::SchemaEncodeFn |
| Encodes a type-erased value into a quota-enforcing JSON sink. | |
| using | pulp::timeline::SchemaRetainedSizeFn |
| Estimates bytes retained by a decoded type-erased value. | |
| using | pulp::timeline::SchemaMigrationFn |
| Rewrites one exact schema envelope into a quota-enforcing sink. | |
Functions | |
| std::size_t | pulp::timeline::retained_size (const JournalEntry &entry) noexcept |
| Returns a saturated retained-memory estimate for one journal entry. | |
| runtime::Result< std::string, PersistenceError > | pulp::timeline::emit_schema_manifest (const SchemaRegistry ®istry, std::size_t maximum_bytes=8ull *1024ull *1024ull) |
| Emits a deterministic JSON-Schema projection of a SchemaRegistry. | |
| runtime::Result< std::shared_ptr< const ParsedJson >, PersistenceError > | pulp::timeline::parse_json (std::string_view json, const DecodeLimits &limits={}) |
| Parses one complete UTF-8 JSON value into an owning immutable document. | |
| runtime::Result< const JsonValue *, PersistenceError > | pulp::timeline::validate_exact_envelope (const JsonValue &value, std::string_view expected_type, std::uint32_t expected_version, std::string path={}, PersistenceErrorCode failure_code=PersistenceErrorCode::InvalidSchema) |
| Validates an exact extension or migration envelope. | |
| runtime::Result< StructuralPreflightSuccess, PersistenceError > | pulp::timeline::preflight_timeline_structure (std::string_view json, const DecodeLimits &limits) |
| Performs an allocation-light, schema-aware Timeline quota scan. | |
| runtime::Result< std::string, PersistenceError > | pulp::timeline::canonicalize_json (const JsonValue &value) |
| Serializes a DOM value as deterministic JSON with sorted object keys. | |
| std::string | pulp::timeline::quote_json_string (std::string_view value) |
| Quotes and escapes a byte sequence as a JSON string token. | |
| runtime::Result< std::uint64_t, PersistenceError > | pulp::timeline::parse_canonical_u64_string (const JsonValue &value, std::string path={}) |
| Parses a canonical decimal unsigned integer stored as a JSON string. | |
| runtime::Result< std::int64_t, PersistenceError > | pulp::timeline::parse_canonical_i64_string (const JsonValue &value, std::string path={}) |
| Parses a canonical decimal signed integer stored as a JSON string. | |
| runtime::Result< std::uint32_t, PersistenceError > | pulp::timeline::parse_u32_number (const JsonValue &value, std::string path={}) |
| Parses an integral JSON number representable as uint32_t. | |
| runtime::Result< SchemaRegistration, SchemaError > | pulp::timeline::register_builtin_timeline_schemas (SchemaRegistryBuilder &builder) |
| Registers the built-in document, content, command, and diagnostic schemas. | |
| runtime::Result< SchemaRegistry, SchemaError > | pulp::timeline::make_builtin_timeline_registry () |
| Constructs a registry containing exactly the built-in Timeline schemas. | |
| std::span< const SchemaReleaseMap > | pulp::timeline::builtin_timeline_schema_releases () noexcept |
| Returns every built-in release projection in stable static storage. | |
| const SchemaReleaseMap * | pulp::timeline::find_builtin_timeline_schema_release (std::string_view release_label) noexcept |
| Finds a built-in release projection by exact label. | |
| runtime::Result< SerializedSnapshot, PersistenceError > | pulp::timeline::serialize_project (const Project &project, const SchemaRegistry ®istry, const SerializeOptions &options={}) |
| Serializes a model-valid project as canonical UTF-8 JSON. | |
| runtime::Result< SerializedSnapshot, PersistenceError > | pulp::timeline::serialize_project_for_release (const Project &project, const SchemaRegistry ®istry, const SchemaReleaseMap &release, const SerializeOptions &options={}) |
| Serializes a project using the schema versions pinned by a release map. | |
| runtime::Result< ProjectSnapshotSummary, PersistenceError > | pulp::timeline::peek_project_summary (std::string_view json, const SchemaRegistry ®istry, const DecodeLimits &limits={}) |
| Scans project metadata and structural counts without constructing Project. | |
| runtime::Result< Project, PersistenceError > | pulp::timeline::deserialize_project (std::string_view json, const SchemaRegistry ®istry, const DecodeLimits &limits={}) |
| Decodes canonical Timeline JSON into a validated Project. | |
| runtime::Result< std::vector< Command >, PersistenceError > | pulp::timeline::deserialize_commands (std::string_view json, const SchemaRegistry ®istry, const DecodeLimits &limits={}) |
| Decodes a JSON command array through the supplied schema registry. | |
Variables | |
| constexpr std::uint32_t | pulp::timeline::schema_manifest_version = 1 |
| Manifest-shape version consumed by Timeline surface generators. | |
Durable journals, canonical serialization, schemas, and migrations.
Decodes schema data into an immutable type-erased value.
The returned shared object owns its value independently of the parsed JSON.
Encodes a type-erased value into a quota-enforcing JSON sink.
Rewrites one exact schema envelope into a quota-enforcing sink.
Estimates bytes retained by a decoded type-erased value.
|
strong |
|
strong |
|
strong |
Failure category returned by a durable JournalSink.
| Enumerator | |
|---|---|
| Closed | |
| IoError | |
| InvalidState | |
| DurabilityUncertain | |
|
strong |
Stable category for a JSON, schema, quota, migration, or model rejection.
|
strong |
|
strong |
Reason a TypeSchema cannot be registered.
| Enumerator | |
|---|---|
| InvalidIdentity | |
| DuplicateType | |
| DuplicateField | |
| InvalidCodec | |
| InvalidMigration | |
| DuplicateMigration | |
|
strong |
|
noexcept |
Returns every built-in release projection in stable static storage.
| runtime::Result< std::string, PersistenceError > pulp::timeline::canonicalize_json | ( | const JsonValue & | value | ) |
Serializes a DOM value as deterministic JSON with sorted object keys.
Strings are escaped as needed and numbers must already use an accepted JSON lexical form.
| value | Complete DOM subtree. |
| runtime::Result< std::vector< Command >, PersistenceError > pulp::timeline::deserialize_commands | ( | std::string_view | json, |
| const SchemaRegistry & | registry, | ||
| const DecodeLimits & | limits = {} ) |
Decodes a JSON command array through the supplied schema registry.
The complete array and all nested values are subject to DecodeLimits.
| json | Complete command-envelope array JSON, borrowed for the call. |
| registry | Command schema contracts and migrations. |
| limits | Parser, migration, and value quotas. |
| runtime::Result< Project, PersistenceError > pulp::timeline::deserialize_project | ( | std::string_view | json, |
| const SchemaRegistry & | registry, | ||
| const DecodeLimits & | limits = {} ) |
Decodes canonical Timeline JSON into a validated Project.
The input is copied as needed and need not outlive the call. Parsing, migrations, structural quotas, registered content, and model invariants are validated before a Project is returned.
| json | Complete project JSON, borrowed for the call. |
| registry | Structural and extension schema contracts. |
| limits | Parser, migration, opaque-content, and structural quotas. |
| runtime::Result< std::string, PersistenceError > pulp::timeline::emit_schema_manifest | ( | const SchemaRegistry & | registry, |
| std::size_t | maximum_bytes = 8ull *1024ull *1024ull ) |
Emits a deterministic JSON-Schema projection of a SchemaRegistry.
Every TypeSchema becomes a $defs entry containing its domain, current version, fields, required set, and migration edges. The result is canonical JSON, so equivalent registries produce byte-identical output independent of registration order.
This manifest is the authoritative input for the Timeline JavaScript, TypeScript, MCP, and CLI projections; those surfaces derive from the schema contract instead of maintaining independent type descriptions.
| registry | Immutable source registry. |
| maximum_bytes | Hard ceiling for the generated document. |
|
noexcept |
Finds a built-in release projection by exact label.
| runtime::Result< SchemaRegistry, SchemaError > pulp::timeline::make_builtin_timeline_registry | ( | ) |
Constructs a registry containing exactly the built-in Timeline schemas.
| runtime::Result< std::int64_t, PersistenceError > pulp::timeline::parse_canonical_i64_string | ( | const JsonValue & | value, |
| std::string | path = {} ) |
Parses a canonical decimal signed integer stored as a JSON string.
Redundant leading zeroes, a leading plus, negative zero, non-digits, and overflow are rejected.
| value | JSON string node to parse. |
| path | Diagnostic path for a rejection. |
| runtime::Result< std::uint64_t, PersistenceError > pulp::timeline::parse_canonical_u64_string | ( | const JsonValue & | value, |
| std::string | path = {} ) |
Parses a canonical decimal unsigned integer stored as a JSON string.
Leading zeroes, signs, non-digits, and overflow are rejected.
| value | JSON string node to parse. |
| path | Diagnostic path for a rejection. |
| runtime::Result< std::shared_ptr< const ParsedJson >, PersistenceError > pulp::timeline::parse_json | ( | std::string_view | json, |
| const DecodeLimits & | limits = {} ) |
Parses one complete UTF-8 JSON value into an owning immutable document.
Duplicate object keys are rejected. Input bytes are copied, and all parser depth, value, container, and string ceilings are enforced before success.
| json | Complete JSON text, borrowed for the call. |
| limits | Parser resource ceilings. |
| runtime::Result< std::uint32_t, PersistenceError > pulp::timeline::parse_u32_number | ( | const JsonValue & | value, |
| std::string | path = {} ) |
Parses an integral JSON number representable as uint32_t.
Fractions, exponents, signs, noncanonical leading zeroes, and overflow are rejected.
| value | JSON number node to parse. |
| path | Diagnostic path for a rejection. |
| runtime::Result< ProjectSnapshotSummary, PersistenceError > pulp::timeline::peek_project_summary | ( | std::string_view | json, |
| const SchemaRegistry & | registry, | ||
| const DecodeLimits & | limits = {} ) |
Scans project metadata and structural counts without constructing Project.
The input is borrowed only for the call. Structural quotas, exact envelopes, schema versions, UTF-8, and numeric forms are validated; cross-item model references are not resolved.
| json | Complete project JSON, borrowed for the call. |
| registry | Structural schema contracts and migrations. |
| limits | Parser, migration, and structural quotas. |
| runtime::Result< StructuralPreflightSuccess, PersistenceError > pulp::timeline::preflight_timeline_structure | ( | std::string_view | json, |
| const DecodeLimits & | limits ) |
Performs an allocation-light, schema-aware Timeline quota scan.
Only arrays reached through supported structural envelopes contribute to the named Timeline item ceilings. This pass does not replace full JSON parsing or model validation.
| json | Complete Timeline JSON, borrowed for the call. |
| limits | Input and Timeline structure ceilings. |
| std::string pulp::timeline::quote_json_string | ( | std::string_view | value | ) |
Quotes and escapes a byte sequence as a JSON string token.
The function escapes JSON syntax and control bytes but does not validate Unicode. Callers producing a JSON document must validate UTF-8 first.
| value | Unquoted bytes to escape. |
| runtime::Result< SchemaRegistration, SchemaError > pulp::timeline::register_builtin_timeline_schemas | ( | SchemaRegistryBuilder & | builder | ) |
Registers the built-in document, content, command, and diagnostic schemas.
Registration stops at and returns the first builder error.
|
noexcept |
Returns a saturated retained-memory estimate for one journal entry.
| runtime::Result< SerializedSnapshot, PersistenceError > pulp::timeline::serialize_project | ( | const Project & | project, |
| const SchemaRegistry & | registry, | ||
| const SerializeOptions & | options = {} ) |
Serializes a model-valid project as canonical UTF-8 JSON.
Registered codecs are resolved through registry. Output is deterministic and bounded by options.max_output_bytes.
| project | Immutable source project. |
| registry | Schema contracts and extension codecs used by the project. |
| options | Output quota. |
| runtime::Result< SerializedSnapshot, PersistenceError > pulp::timeline::serialize_project_for_release | ( | const Project & | project, |
| const SchemaRegistry & | registry, | ||
| const SchemaReleaseMap & | release, | ||
| const SerializeOptions & | options = {} ) |
Serializes a project using the schema versions pinned by a release map.
The current canonical snapshot is rewritten through registered downgrade migrations. The release map must cover compatible registered structural types; unsupported content or missing migration paths fail closed.
| project | Immutable source project. |
| registry | Schema contracts and migrations. |
| release | Target versions for the release projection. |
| options | Output quota applied to current and rewritten documents. |
| runtime::Result< const JsonValue *, PersistenceError > pulp::timeline::validate_exact_envelope | ( | const JsonValue & | value, |
| std::string_view | expected_type, | ||
| std::uint32_t | expected_version, | ||
| std::string | path = {}, | ||
| PersistenceErrorCode | failure_code = PersistenceErrorCode::InvalidSchema ) |
Validates an exact extension or migration envelope.
value must contain only data, type_name, and version; data must be an object, and identity fields must equal the expected values.
| value | Candidate envelope. |
| expected_type | Required type_name value. |
| expected_version | Required version value. |
| path | Diagnostic path for the envelope. |
| failure_code | Error category returned for envelope mismatch. |
|
inlineconstexpr |
Manifest-shape version consumed by Timeline surface generators.