Skip to content

Commit 57502b4

Browse files
committed
Merge remote-tracking branch 'origin/orchestrator/blob-version'
2 parents b7e8250 + 616d139 commit 57502b4

8 files changed

Lines changed: 987 additions & 118 deletions

File tree

include/arbiter/arbiter.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,35 @@ int ARBITER_get_requested_actions(const struct ARBITER_result *result,
149149
*/
150150
uint32_t ARBITER_get_last_eval_op_count(const struct ARBITER_ctx *ctx);
151151

152+
/**
153+
* @brief Check whether a model meets a minimum version requirement.
154+
*
155+
* @param model Compiled model to check.
156+
* @param min_major Minimum required major version.
157+
* @param min_minor Minimum required minor version.
158+
* @return ARBITER_OK if the model meets the requirement,
159+
* ARBITER_EMODEL if it does not,
160+
* ARBITER_EINVAL if model is NULL.
161+
*/
162+
int ARBITER_check_version(const struct ARBITER_model *model,
163+
uint8_t min_major, uint8_t min_minor);
164+
165+
#if defined(CONFIG_ARBITER_HOT_SWAP) && CONFIG_ARBITER_HOT_SWAP
166+
/**
167+
* @brief Hot-swap a running context to a new model.
168+
*
169+
* Validates the new model, preserves current fact values where the fact
170+
* index and type match, and atomically swaps the model pointer.
171+
*
172+
* @param ctx Initialized context.
173+
* @param new_model New compiled model.
174+
* @return ARBITER_OK on success, ARBITER_EINVAL on bad pointers,
175+
* ARBITER_EMODEL if the new model fails validation.
176+
*/
177+
int ARBITER_hot_swap(struct ARBITER_ctx *ctx,
178+
const struct ARBITER_model *new_model);
179+
#endif /* CONFIG_ARBITER_HOT_SWAP */
180+
152181
/**
153182
* @brief Get the arbiter version string.
154183
*/

include/arbiter/arbiter_model.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,7 @@ struct ARBITER_rule_def {
166166
/** Complete compiled model. */
167167
struct ARBITER_model {
168168
const char *name;
169+
uint8_t version[3]; /**< Model version: [major, minor, patch]. */
169170
const uint8_t model_hash[32];
170171
const uint8_t schema_hash[32];
171172
arbiter_index_t fact_count;

0 commit comments

Comments
 (0)