C Advanced API

Manifest bundles

Load a verified manifest and its policy sources from memory with the C Advanced API.

Use an in-memory manifest when an application already has the JSON and policy bytes—for example, from an authenticated asset store—and still needs manifest governance. Unlike inline loading, this path retains policy IDs, digests, permissions and the public-query whitelist. Unlike the stable file loader, it does not read policy files itself.

Types

Defined on this page

TypePurpose
maelys_datalog_policy_bundle_entry_tOne policy ID and its source bytes.

Used from other pages

These types are defined on the linked pages; this page uses them in the roles below.

TypeUse on this pageDefined in
maelys_datalog_policy_tOutput handle returned by a successful load.Stable Manifests
maelys_datalog_diagnostic_tOptional output argument receiving loading details.Stable Errors

Functions

FunctionPurpose
maelys_datalog_policy_load_manifest_text()Validate a manifest and supplied source bundle, returning an opaque policy handle.
maelys_datalog_policy_load_manifest_text_in()Do the same with caller-owned policy-object storage.

Match sources by policy ID

Each entry names a policy declared by the manifest. The loader matches by policy_id, not by array position. The JSON and source pointers are borrowed only during the call; the returned handle owns compiled policy content. The manifest's SHA-256 and permission checks are the same as for file loading.

C · struct
maelys_datalog_policy_bundle_entry_t
typedef struct {
    const char *policy_id;
    const char *src;
    size_t src_len;
} maelys_datalog_policy_bundle_entry_t;
A manifest policy ID paired with the source bytes supplied by the caller.
Fields
policy_idconst char *
Policy ID appearing in the manifest; entries are matched by ID.
srcconst char *
Borrowed policy source bytes for this load.
src_lensize_t
Exact source length in bytes.
C · function
Load a manifest bundle from memory
maelys_datalog_status_t
maelys_datalog_policy_load_manifest_text(
const char *manifest_json,
size_t manifest_len,
const maelys_datalog_policy_bundle_entry_t *entries,
size_t entry_count,
unsigned flags,
maelys_datalog_policy_t **out_policy,
maelys_datalog_diagnostic_t *diagnostic
);
Loads a manifest and its policy sources from an in-memory bundle, retaining manifest metadata, hash checks and query permissions.
Arguments
manifest_jsonconst char *
Borrowed manifest JSON bytes.
manifest_lensize_t
JSON byte length.
entriesconst maelys_datalog_policy_bundle_entry_t *
Policy source entries keyed by manifest policy ID.
entry_countsize_t
Number of supplied entries.
flagsunsigned int
Explicit manifest loading permissions; use MAELYS_DATALOG_PUBLIC_ALLOW_NONE when granting none.
out_policymaelys_datalog_policy_t **
Receives the opaque policy handle on success; remains NULL on failure.
diagnosticmaelys_datalog_diagnostic_t *
Optional initialized diagnostic output.
Return value
maelys_datalog_status_t

OK only after manifest, source digest, domain and policy checks succeed; otherwise no policy handle is returned.

C · function
Load a manifest bundle into caller storage
maelys_datalog_status_t
maelys_datalog_policy_load_manifest_text_in(
void *storage,
size_t storage_bytes,
const char *manifest_json,
size_t manifest_len,
const maelys_datalog_policy_bundle_entry_t *entries,
size_t entry_count,
unsigned flags,
maelys_datalog_policy_t **out_policy,
maelys_datalog_diagnostic_t *diagnostic
);
Loads an in-memory manifest bundle into policy-object storage supplied by the application, retaining the manifest’s validation checks.
Arguments
storagevoid *
Unused aligned policy-object arena supplied by the caller.
storage_bytessize_t
Available arena size from policy_storage_requirements().
manifest_jsonconst char *
Borrowed manifest JSON bytes.
manifest_lensize_t
JSON byte length.
entriesconst maelys_datalog_policy_bundle_entry_t *
Policy source entries keyed by ID.
entry_countsize_t
Number of supplied entries.
flagsunsigned int
Explicit manifest loading permissions.
out_policymaelys_datalog_policy_t **
Receives the handle on success; NULL on failure.
diagnosticmaelys_datalog_diagnostic_t *
Optional initialized diagnostic output.
Return value
maelys_datalog_status_t

OK when loading succeeds in the provided arena; STORAGE_TOO_SMALL or another status otherwise. A failed load may overwrite the arena.

Example — document access

The document-access tutorial explains the manifest structure and digest. Once the manifest and documents.main source have been read and checked as one input set, supply their bytes together:

CODE
static maelys_datalog_status_t load_documents(
    const char *manifest_json, const char *policy_source,
    maelys_datalog_policy_t **out_policy) {
    const maelys_datalog_policy_bundle_entry_t entries[] = {
        {"documents.main", policy_source, strlen(policy_source)},
    };
    maelys_datalog_diagnostic_t diagnostic = MAELYS_DATALOG_DIAGNOSTIC_INIT;
    return maelys_datalog_policy_load_manifest_text(
        manifest_json, strlen(manifest_json), entries, 1u,
        MAELYS_DATALOG_PUBLIC_ALLOW_NONE, out_policy, &diagnostic);
}

policy_source and manifest_json stand for actual byte buffers, not magic filenames. Their IDs and digests must agree. If the application also supplies policy-object memory, use the _in() form and follow the storage contract. Neither loader quietly switches to inline loading when manifest validation fails.