Add model version in metadata
This commit is contained in:
parent
610516840e
commit
861a4b7f73
5
ovni.c
5
ovni.c
@ -176,7 +176,10 @@ proc_set_version(void)
|
|||||||
die("json_value_get_object failed\n");
|
die("json_value_get_object failed\n");
|
||||||
|
|
||||||
if(json_object_set_number(meta, "version", OVNI_METADATA_VERSION) != 0)
|
if(json_object_set_number(meta, "version", OVNI_METADATA_VERSION) != 0)
|
||||||
die("json_object_set_number for app_id failed\n");
|
die("json_object_set_number for version failed\n");
|
||||||
|
|
||||||
|
if(json_object_set_string(meta, "model_version", OVNI_MODEL_VERSION) != 0)
|
||||||
|
die("json_object_set_string for model_version failed\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
1
ovni.h
1
ovni.h
@ -50,6 +50,7 @@ typedef struct json_value_t JSON_Value;
|
|||||||
|
|
||||||
#define OVNI_STREAM_MAGIC "ovni"
|
#define OVNI_STREAM_MAGIC "ovni"
|
||||||
#define OVNI_STREAM_VERSION 1
|
#define OVNI_STREAM_VERSION 1
|
||||||
|
#define OVNI_MODEL_VERSION "O1 V1 T1 M1 D1 K1"
|
||||||
|
|
||||||
/* ----------------------- common ------------------------ */
|
/* ----------------------- common ------------------------ */
|
||||||
|
|
||||||
|
17
trace.c
17
trace.c
@ -146,6 +146,23 @@ check_metadata_version(struct ovni_eproc *proc)
|
|||||||
proc->pid, version,
|
proc->pid, version,
|
||||||
OVNI_METADATA_VERSION);
|
OVNI_METADATA_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
JSON_Value *mversion_val = json_object_get_value(meta, "model_version");
|
||||||
|
if(mversion_val == NULL)
|
||||||
|
{
|
||||||
|
die("process %d is missing attribute \"model_version\" in metadata\n",
|
||||||
|
proc->pid);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *mversion = json_string(mversion_val);
|
||||||
|
|
||||||
|
if(strcmp(mversion, OVNI_MODEL_VERSION) != 0)
|
||||||
|
{
|
||||||
|
die("pid %d: metadata model version mismatch '%s' (expected '%s')\n",
|
||||||
|
proc->pid, mversion,
|
||||||
|
OVNI_MODEL_VERSION);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
Loading…
Reference in New Issue
Block a user