C Extension API
Extension registration
Bundle native components and select them through a sealed context.Declare a bundle of native components, register it in a context, then select those components explicitly when loading policies and creating sessions. The Extension registration guide executes a document-access frontend, filter and planner in one sealed context.
Handle: context_t
#include <maelys/datalog_extension.h>
typedef struct maelys_datalog_context maelys_datalog_context_t;Creation
context_create()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_create(
maelys_datalog_context_t **out_context
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with a new mutable context containing the standard filters, Datalog frontend and reference backend. It does not inherit legacy process-global extension registrations; register the additional components before sealing.
maelys_datalog_context_t *created = NULL;
maelys_datalog_status_t status = maelys_datalog_context_create(&created);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("context created: %s\n", created ? "yes" : "no");
check_status(maelys_datalog_context_free(created));status: ok context created: yes
Functions
backend_reference()
#include <maelys/datalog_extension.h>
const maelys_datalog_backend_t *
maelys_datalog_backend_reference(
void
);const maelys_datalog_backend_t *
Returns a borrowed pointer to the built-in ABI 5 descriptor. Do not free it; the callback code is provided by the loaded SDK.
const maelys_datalog_backend_t *backend = maelys_datalog_backend_reference();
printf("reference available: %s\n", backend ? "yes" : "no");
if (!backend) exit(EXIT_FAILURE);reference available: yes
backend_reference_v6()
#include <maelys/datalog_extension.h>
const maelys_datalog_backend_v6_t *
maelys_datalog_backend_reference_v6(
void
);const maelys_datalog_backend_v6_t *
Returns a borrowed pointer to the built-in ABI 6 descriptor. It is a different descriptor type from ABI 5; do not cast between them or free this pointer.
const maelys_datalog_backend_v6_t *backend = maelys_datalog_backend_reference_v6();
printf("reference available: %s\n", backend ? "yes" : "no");
if (!backend) exit(EXIT_FAILURE);reference available: yes
context_backend_v6_count()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_backend_v6_count(
const maelys_datalog_context_t *context,
size_t *out_count
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with the separate ABI 6 backend count. Invalid context or output pointers return INVALID_ARGUMENT.
size_t count = 0;
maelys_datalog_status_t status = maelys_datalog_context_backend_v6_count(context, &count);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("registered ABI 6 backends: %zu\n", count);status: ok registered ABI 6 backends: 0
context_backend_v6_info()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_backend_v6_info(
const maelys_datalog_context_t *context,
size_t index,
maelys_datalog_component_info_t *out_info
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with the ABI 6 backend identity borrowed from the context. An index outside context_backend_v6_count returns NOT_FOUND; invalid context or output pointers return INVALID_ARGUMENT.
maelys_datalog_backend_v6_t named_backend = *maelys_datalog_backend_reference_v6();
named_backend.name = "documents_v6";
named_backend.semantic_id = "example.document-reference.v6";
const maelys_datalog_extension_v2_t bundle_v2 = {
.abi_version = MAELYS_DATALOG_EXTENSION_V2_ABI_VERSION,
.struct_size = sizeof(bundle_v2),
.name = "resource_backend", .semantic_id = "example.resource-backend-bundle.v1",
.backends_v6 = &named_backend, .backend_v6_count = 1
};
check_status(maelys_datalog_context_register_v2(context, &bundle_v2));
maelys_datalog_component_info_t info;
maelys_datalog_status_t status = maelys_datalog_context_backend_v6_info(context, 0, &info);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("backend: %s\n", info.name);status: ok backend: documents_v6
context_component_count()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_component_count(
const maelys_datalog_context_t *context,
maelys_datalog_extension_kind_t kind,
size_t *out_count
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with the number of components in the requested catalog, including its built-ins. Invalid arguments or an unknown kind return INVALID_ARGUMENT. Use context_backend_v6_count for the separate ABI 6 backend catalog.
size_t count = 0;
maelys_datalog_status_t status = maelys_datalog_context_component_count(
context, MAELYS_DATALOG_EXTENSION_FRONTEND, &count);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("frontends: %zu\n", count);status: ok frontends: 1
context_component_info()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_component_info(
const maelys_datalog_context_t *context,
maelys_datalog_extension_kind_t kind,
size_t index,
maelys_datalog_component_info_t *out_info
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with metadata borrowed from the live context, not executable callback pointers. An index outside the count for the same kind returns NOT_FOUND; invalid arguments or an unknown kind return INVALID_ARGUMENT.
size_t count = 0;
check_status(maelys_datalog_context_component_count(context, MAELYS_DATALOG_EXTENSION_FRONTEND, &count));
if (count == 0) exit(EXIT_FAILURE);
maelys_datalog_component_info_t info;
maelys_datalog_status_t status = maelys_datalog_context_component_info(
context, MAELYS_DATALOG_EXTENSION_FRONTEND, 0, &info);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("frontend: %s\n", info.name);status: ok frontend: datalog
context_load_inline()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_load_inline(
maelys_datalog_context_t *context,
const char *frontend_name,
const char *domain,
const char *policy_id,
const char *source,
size_t source_length,
maelys_datalog_policy_t **out_policy,
maelys_datalog_diagnostic_t *out_diagnostic
);Written on success.
out_diagnostic: optional diagnostic details on failure; pass NULL when not needed.
maelys_datalog_status_t — OK on success.
Returns OK with a policy lowered by the selected frontend and accepted by core validation. The context must be sealed. A missing frontend fails instead of using another grammar; invalid source, domain or program records are reported through the status and diagnostic.
check_status(maelys_datalog_context_seal(context, NULL));
maelys_datalog_policy_t *loaded = NULL;
maelys_datalog_status_t status = maelys_datalog_context_load_inline(context, NULL,
"registration_cards", "context-policy", policy_source, strlen(policy_source), &loaded, &diagnostic);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
check_status(maelys_datalog_policy_free(loaded));status: ok
context_register()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_register(
maelys_datalog_context_t *context,
const maelys_datalog_extension_t *extension
);maelys_datalog_status_t — OK on success.
Returns OK only after the whole bundle has been copied into the catalog; no callback is executed. A sealed context returns INVALID_STATE. Invalid descriptors return INVALID_ARGUMENT, exhausted catalog capacity returns PAYLOAD_TOO_LARGE, and duplicate identities are rejected without publishing a partial bundle.
maelys_datalog_status_t status = maelys_datalog_context_register(context, &document_components);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
context_register_v2()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_register_v2(
maelys_datalog_context_t *context,
const maelys_datalog_extension_v2_t *extension
);maelys_datalog_status_t — OK on success.
Returns OK after atomically copying the bundle. A sealed context returns INVALID_STATE, an unsupported registration ABI returns UNSUPPORTED, and an incomplete descriptor, invalid component or exhausted capacity fails without partially updating the catalog. Each backend array uses its exact public base type.
maelys_datalog_backend_v6_t named_backend = *maelys_datalog_backend_reference_v6();
named_backend.name = "documents_v6";
named_backend.semantic_id = "example.document-reference.v6";
const maelys_datalog_extension_v2_t bundle_v2 = {
.abi_version = MAELYS_DATALOG_EXTENSION_V2_ABI_VERSION,
.struct_size = sizeof(bundle_v2),
.name = "resource_backend", .semantic_id = "example.resource-backend-bundle.v1",
.backends_v6 = &named_backend, .backend_v6_count = 1
};
maelys_datalog_status_t status = maelys_datalog_context_register_v2(context, &bundle_v2);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
context_seal()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_seal(
maelys_datalog_context_t *context,
const char *planner_name
);maelys_datalog_status_t — OK on success.
Returns OK after choosing the reference planner for NULL, or the registered planner with the given name, and sealing the catalog. An unknown selection fails; component names are explicit choices rather than fallback hints.
maelys_datalog_status_t status = maelys_datalog_context_seal(context, NULL);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
context_session_create()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_session_create(
maelys_datalog_context_t *context,
const maelys_datalog_policy_t *policy,
size_t policy_index,
const char *backend_name,
uint64_t required_capabilities,
uint64_t work_limit,
maelys_datalog_session_t **out_session
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with a session that retains the policy’s context. The context must be sealed and must be the one used to compile the policy. An unknown backend, unsupported capability, invalid policy index or failed backend preparation returns an error instead of falling back. This convenience call supplies no backend state buffer.
check_status(maelys_datalog_context_seal(context, NULL));
maelys_datalog_policy_t *context_policy = NULL;
check_status(maelys_datalog_context_load_inline(context, NULL, "registration_cards", "context-policy",
policy_source, strlen(policy_source), &context_policy, &diagnostic));
maelys_datalog_session_t *created = NULL;
maelys_datalog_status_t status = maelys_datalog_context_session_create(
context, context_policy, 0, NULL, 0, 0, &created);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
check_status(maelys_datalog_session_free(created));
check_status(maelys_datalog_policy_free(context_policy));status: ok
frontend_datalog()
#include <maelys/datalog_extension.h>
const maelys_datalog_frontend_t *
maelys_datalog_frontend_datalog(
void
);const maelys_datalog_frontend_t *
Returns a borrowed pointer to the built-in Datalog frontend descriptor. Do not free it or retain callback arguments supplied during a load.
const maelys_datalog_frontend_t *frontend = maelys_datalog_frontend_datalog();
if (!frontend) exit(EXIT_FAILURE);
printf("frontend: %s\n", frontend->name);frontend: datalog
Release
context_free()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_context_free(
maelys_datalog_context_t *context
);maelys_datalog_status_t — OK on success.
Returns OK after dropping the caller’s context reference. Already-created policies and sessions retain their own references. No longer use the released caller handle.
maelys_datalog_status_t status = maelys_datalog_context_free(context);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
context = NULL;status: ok
Constants
Catalog limits
CONTEXT_MAX_EXTENSIONS
#define MAELYS_DATALOG_CONTEXT_MAX_EXTENSIONS 16uMaximum number of native bundles registered in one context.
16
CONTEXT_MAX_COMPONENTS
#define MAELYS_DATALOG_CONTEXT_MAX_COMPONENTS 16uMaximum entries in each context frontend, backend or planner catalog; filter capacity is governed separately.
16
Handle: policy_t ↗
Creation
policy_load_frontend()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_policy_load_frontend(
const char *domain,
const char *policy_id,
const char *source,
size_t source_length,
const maelys_datalog_frontend_t *frontend,
maelys_datalog_policy_t **out_policy,
maelys_datalog_diagnostic_t *out_diagnostic
);Written on success.
out_diagnostic: optional diagnostic details on failure; pass NULL when not needed.
maelys_datalog_status_t — OK on success.
Returns OK with a policy after the selected callback lowers the source and the core validates the resulting records. The selection is local to this load, not a mutable global grammar. Frontends must not retain source or builder pointers or reenter loading; a lowering or validation failure rejects the load.
maelys_datalog_policy_t *loaded = NULL;
maelys_datalog_status_t status = maelys_datalog_policy_load_frontend("registration_cards",
"selected-frontend", policy_source, strlen(policy_source), maelys_datalog_frontend_datalog(), &loaded, &diagnostic);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
check_status(maelys_datalog_policy_free(loaded));status: ok
policy_load_frontend_in()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_policy_load_frontend_in(
void *storage,
size_t storage_bytes,
const char *domain,
const char *policy_id,
const char *source,
size_t source_length,
const maelys_datalog_frontend_t *frontend,
maelys_datalog_policy_t **out_policy,
maelys_datalog_diagnostic_t *out_diagnostic
);Written on success.
out_diagnostic: optional diagnostic details on failure; pass NULL when not needed.
maelys_datalog_status_t — OK on success.
Returns OK with a policy in the supplied arena after frontend lowering and core validation. Measure the arena with policy_storage_requirements and keep it aligned, immovable and alive until policy_free closes the policy; policy_free does not free the arena. Loader and callback allocations remain separate from this caller-owned policy object.
size_t bytes = 0, alignment = 0;
check_status(maelys_datalog_policy_storage_requirements(&bytes, &alignment));
void *arena = allocate_policy_storage(bytes, alignment);
maelys_datalog_policy_t *loaded = NULL;
maelys_datalog_status_t status = maelys_datalog_policy_load_frontend_in(arena, bytes,
"registration_cards", "caller-owned-policy", policy_source, strlen(policy_source),
maelys_datalog_frontend_datalog(), &loaded, &diagnostic);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
check_status(maelys_datalog_policy_free(loaded));
free(arena);status: ok
Functions
Documented on Rulesets.
policy_count()↗ — Reads how many policies belong to a loaded set, so the application can choose a valid policy index when creating a session.policy_fingerprint()↗ — Reads the identity of the complete loaded policy set. Use it to distinguish policy sets, rather than the execution configuration of a session.policy_id()↗ — Reads the identifier of one enabled policy without preparing a session or allocating storage. The returned string is borrowed from the loaded policy set.policy_reads_predicate()↗ — Checks whether one compiled policy reads a named predicate in a rule body, without preparing a session. Reads include positive and negated atoms and aggregate sources; heads and static facts do not count.policy_stat_get()↗ — Read a selected policy's compiled predicate, policy-fact or normalized-rule count without preparing a session.
Release
Documented on Rulesets.
policy_free()↗ — Releases a loaded policy-set handle when the application no longer needs it for creating sessions.
Handle: session_t ↗
Creation
backend_storage_requirements()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_backend_storage_requirements(
const maelys_datalog_policy_t *policy,
size_t policy_index,
const maelys_datalog_backend_t *backend,
size_t *out_bytes,
size_t *out_alignment
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with deterministic byte and alignment requirements for this policy and backend. It allocates nothing and leaves both outputs unchanged on failure. Zero bytes is valid; alignment is a nonzero power of two. The requirements are checked again at session creation.
size_t bytes = 0, alignment = 0;
maelys_datalog_status_t status = maelys_datalog_backend_storage_requirements(
policy, 0, maelys_datalog_backend_reference(), &bytes, &alignment);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
printf("external storage required: %s\n", bytes ? "yes" : "no");
printf("alignment valid: %s\n", alignment && !(alignment & (alignment - 1)) ? "yes" : "no");status: ok external storage required: no alignment valid: yes
session_create_ex()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_create_ex(
const maelys_datalog_policy_t *policy,
size_t policy_index,
const maelys_datalog_session_options_t *options,
maelys_datalog_session_t **out_session
);Written on success.
maelys_datalog_status_t — OK on success.
Returns OK with a session using the chosen ABI 5 descriptor, or the reference descriptor for a NULL backend or options pointer. Policy-required and caller-required capabilities are checked before preparation; a nonzero work limit additionally requires WORK_LIMIT. The options use BACKEND_ABI_VERSION and their exact structure size. No caller-owned backend buffer is supplied by this convenience call.
const maelys_datalog_session_options_t options = {
.abi_version = MAELYS_DATALOG_BACKEND_ABI_VERSION,
.struct_size = sizeof(options), .backend = maelys_datalog_backend_reference(),
.required_capabilities = MAELYS_DATALOG_CAP_NEGATION, .work_limit = 0
};
maelys_datalog_session_t *created = NULL;
maelys_datalog_status_t status = maelys_datalog_session_create_ex(policy, 0, &options, &created);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
check_status(maelys_datalog_session_free(created));status: ok
Functions
Documented on Solving, Session resources.
session_execution_fingerprint()↗ — Reads the combined identity of the selected policy and its execution configuration, for distinguishing how a policy is evaluated.session_fingerprint()↗ — Reads the policy identity selected by this session, independently of its execution configuration.session_get_allocation_stats()↗ — Reads elastic allocation accounting without allocating. The reference backend returns UNSUPPORTED for its fixed-memory sessions and leaves the initialized output unchanged. This is not a claim of zero memory use.session_get_resources()↗ — Reads the normalized resource capacities of a session. The output reports admitted capacities, not unresolved defaults or presence sentinels.session_solve()↗ — Evaluates the selected policy against a fact array supplied by the application, without requiring an input EDB handle.session_solve_edb()↗ — Evaluates the selected policy against all facts in an input EDB. Each call is a complete request snapshot, not an incremental update to the previous result.
Release
Documented on Solving.
session_free()↗ — Releases a prepared session once its live result has been released.
Handle: session_config_t ↗
Functions
session_config_set_backend()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_backend(
maelys_datalog_session_config_t *config,
const maelys_datalog_backend_t *backend
);maelys_datalog_status_t — OK on success.
Returns OK after selecting and copying the ABI 5 descriptor and identities. NULL restores ordinary reference configuration. This direct selection clears a context selection; callback code must outlive every session that uses it. Invalid descriptors fail before replacing the configuration.
maelys_datalog_status_t status = maelys_datalog_session_config_set_backend(config, maelys_datalog_backend_reference());
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
session_config_set_backend_storage()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_backend_storage(
maelys_datalog_session_config_t *config,
const maelys_datalog_backend_storage_t *storage
);maelys_datalog_status_t — OK on success.
Returns OK after copying the storage descriptor, while borrowing its buffer; NULL clears the attachment. The buffer must be disjoint from other live storage and remain valid through session destruction. Backend or context selection does not clear this attachment. Session creation rejects insufficient size or alignment before calling prepare, without implicit allocation or fallback.
size_t bytes = 0, alignment = 0;
check_status(maelys_datalog_backend_storage_requirements(
policy, 0, maelys_datalog_backend_reference(), &bytes, &alignment));
void *arena = bytes ? allocate_policy_storage(bytes, alignment) : NULL;
const maelys_datalog_backend_storage_t storage = {
sizeof(storage), arena, bytes, alignment
};
maelys_datalog_status_t status = maelys_datalog_session_config_set_backend_storage(config, &storage);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);
/* Release the configuration before its caller-owned storage. */
check_status(maelys_datalog_session_config_free(config));
config = NULL;
free(arena);status: ok
session_config_set_backend_v6()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_backend_v6(
maelys_datalog_session_config_t *config,
const maelys_datalog_backend_v6_t *backend
);maelys_datalog_status_t — OK on success.
Returns OK after selecting the independent ABI 6 descriptor. Its complete resource-aware descriptor and supported resource features are required; do not cast an ABI 5 or ABI 7 descriptor. An invalid selection fails rather than silently choosing another backend.
maelys_datalog_status_t status = maelys_datalog_session_config_set_backend_v6(config, maelys_datalog_backend_reference_v6());
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
session_config_set_backend_v7()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_backend_v7(
maelys_datalog_session_config_t *config,
const maelys_datalog_backend_v7_t *backend
);maelys_datalog_status_t — OK on success.
Returns OK after copying a valid ABI 7 descriptor and identities; NULL restores ordinary reference configuration. Unsupported ABI versions return UNSUPPORTED; short descriptors or missing callbacks return INVALID_ARGUMENT without modifying the configuration. Before solving, attach retained inputs: ordinary session_solve is refused. v0.26 has no ABI 7 extension registry.
/* NULL clears the retained-input backend selection. */
maelys_datalog_status_t status = maelys_datalog_session_config_set_backend_v7(config, NULL);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
session_config_set_context()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_context(
maelys_datalog_session_config_t *config,
maelys_datalog_context_t *context,
const char *backend_name
);maelys_datalog_status_t — OK on success.
Returns OK after retaining the sealed context and selecting its named ABI 5 backend; NULL backend_name selects its reference backend. Policies used with this configuration must have been compiled in that same context. A missing component fails; a later direct backend selection clears this context selection.
check_status(maelys_datalog_context_seal(context, NULL));
maelys_datalog_status_t status = maelys_datalog_session_config_set_context(config, context, NULL);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
session_config_set_context_backend_v6()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_context_backend_v6(
maelys_datalog_session_config_t *config,
maelys_datalog_context_t *context,
const char *backend_name
);maelys_datalog_status_t — OK on success.
Returns OK after retaining the sealed context and selecting the named ABI 6 backend; NULL backend_name selects its ABI 6 reference. The policy must come from the same context, and an unknown name is an error rather than a fallback selection.
maelys_datalog_backend_v6_t named_backend = *maelys_datalog_backend_reference_v6();
named_backend.name = "documents_v6";
named_backend.semantic_id = "example.document-reference.v6";
const maelys_datalog_extension_v2_t bundle_v2 = {
.abi_version = MAELYS_DATALOG_EXTENSION_V2_ABI_VERSION,
.struct_size = sizeof(bundle_v2),
.name = "resource_backend", .semantic_id = "example.resource-backend-bundle.v1",
.backends_v6 = &named_backend, .backend_v6_count = 1
};
check_status(maelys_datalog_context_register_v2(context, &bundle_v2));
check_status(maelys_datalog_context_seal(context, NULL));
maelys_datalog_status_t status = maelys_datalog_session_config_set_context_backend_v6(
config, context, named_backend.name);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
session_config_set_requirements()
#include <maelys/datalog_extension.h>
maelys_datalog_status_t
maelys_datalog_session_config_set_requirements(
maelys_datalog_session_config_t *config,
uint64_t capabilities,
uint64_t work_limit
);maelys_datalog_status_t — OK on success.
Returns OK after storing the required capability mask and work limit. Unknown capability bits return INVALID_ARGUMENT. These requirements are enforced at session creation; a nonzero work limit also requires WORK_LIMIT support. Work units are backend-specific, not a wall-clock timeout or sandbox.
maelys_datalog_status_t status = maelys_datalog_session_config_set_requirements(
config, MAELYS_DATALOG_CAP_NEGATION, 0);
printf("status: %s\n", maelys_datalog_status_name(status));
check_status(status);status: ok
Release
Documented on Solving.
session_config_free()↗ — Releases a configuration after its values have been copied into any created sessions.
Struct: extension_t
#include <maelys/datalog_extension.h>
Typedef
typedef struct {
uint32_t abi_version;
size_t struct_size;
const char *name;
const char *semantic_id;
const maelys_datalog_frontend_t *frontends;
size_t frontend_count;
const maelys_datalog_backend_t *backends;
size_t backend_count;
const maelys_datalog_planner_module_t *planners;
size_t planner_count;
const maelys_datalog_filter_module_t *filters;
size_t filter_count;
} maelys_datalog_extension_t;Constants
Registration ABI
EXTENSION_ABI_VERSION
#define MAELYS_DATALOG_EXTENSION_ABI_VERSION 1uRegistration ABI used by extension_t; component descriptors have their own independent ABI versions.
1
Struct: extension_v2_t
#include <maelys/datalog_extension.h>
Typedef
typedef struct {
uint32_t abi_version;
size_t struct_size;
const char *name;
const char *semantic_id;
const maelys_datalog_frontend_t *frontends;
size_t frontend_count;
const maelys_datalog_backend_t *backends_v5;
size_t backend_v5_count;
const maelys_datalog_backend_v6_t *backends_v6;
size_t backend_v6_count;
const maelys_datalog_planner_module_t *planners;
size_t planner_count;
const maelys_datalog_filter_module_t *filters;
size_t filter_count;
} maelys_datalog_extension_v2_t;Constants
Registration ABI
EXTENSION_V2_ABI_VERSION
#define MAELYS_DATALOG_EXTENSION_V2_ABI_VERSION 2uRegistration ABI used by extension_v2_t, including its separate ABI 5 and ABI 6 backend arrays.
2
Enum: extension_kind_t
#include <maelys/datalog_extension.h>
Typedef
typedef enum {
MAELYS_DATALOG_EXTENSION_FRONTEND = 1,
MAELYS_DATALOG_EXTENSION_BACKEND,
MAELYS_DATALOG_EXTENSION_PLANNER,
MAELYS_DATALOG_EXTENSION_FILTER
} maelys_datalog_extension_kind_t;Struct: component_info_t
#include <maelys/datalog_extension.h>
Typedef
typedef struct {
const char *name;
const char *semantic_id;
} maelys_datalog_component_info_t;Struct: session_options_t
#include <maelys/datalog_extension.h>
Typedef
typedef struct {
uint32_t abi_version;
size_t struct_size;
const maelys_datalog_backend_t *backend; /* NULL selects the reference. */
uint64_t required_capabilities;
/* Zero selects 1,048,576 host work units. Nonzero requires WORK_LIMIT. */
uint64_t work_limit;
} maelys_datalog_session_options_t;