Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions include/arbiter/arbiter.h
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,35 @@ int ARBITER_get_requested_actions(const struct ARBITER_result *result,
*/
uint32_t ARBITER_get_last_eval_op_count(const struct ARBITER_ctx *ctx);

/**
* @brief Check whether a model meets a minimum version requirement.
*
* @param model Compiled model to check.
* @param min_major Minimum required major version.
* @param min_minor Minimum required minor version.
* @return ARBITER_OK if the model meets the requirement,
* ARBITER_EMODEL if it does not,
* ARBITER_EINVAL if model is NULL.
*/
int ARBITER_check_version(const struct ARBITER_model *model,
uint8_t min_major, uint8_t min_minor);

#if defined(CONFIG_ARBITER_HOT_SWAP) && CONFIG_ARBITER_HOT_SWAP
/**
* @brief Hot-swap a running context to a new model.
*
* Validates the new model, preserves current fact values where the fact
* index and type match, and atomically swaps the model pointer.
*
* @param ctx Initialized context.
* @param new_model New compiled model.
* @return ARBITER_OK on success, ARBITER_EINVAL on bad pointers,
* ARBITER_EMODEL if the new model fails validation.
*/
int ARBITER_hot_swap(struct ARBITER_ctx *ctx,
const struct ARBITER_model *new_model);
#endif /* CONFIG_ARBITER_HOT_SWAP */

/**
* @brief Get the arbiter version string.
*/
Expand Down
1 change: 1 addition & 0 deletions include/arbiter/arbiter_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ struct ARBITER_rule_def {
/** Complete compiled model. */
struct ARBITER_model {
const char *name;
uint8_t version[3]; /**< Model version: [major, minor, patch]. */
const uint8_t model_hash[32];
const uint8_t schema_hash[32];
arbiter_index_t fact_count;
Expand Down
Loading
Loading