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
| Type | Purpose |
|---|---|
maelys_datalog_policy_bundle_entry_t | One 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.
| Type | Use on this page | Defined in |
|---|---|---|
maelys_datalog_policy_t | Output handle returned by a successful load. | Stable Manifests |
maelys_datalog_diagnostic_t | Optional output argument receiving loading details. | Stable Errors |
Functions
| Function | Purpose |
|---|---|
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.
typedef struct {
const char *policy_id;
const char *src;
size_t src_len;
} maelys_datalog_policy_bundle_entry_t;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
);maelys_datalog_status_tOK only after manifest, source digest, domain and policy checks succeed; otherwise no policy handle is returned.
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
);maelys_datalog_status_tOK 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:
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.