| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | |
| 3 | #ifndef ACLK_SCHEMA_WRAPPER_CONTEXT_H |
| 4 | #define ACLK_SCHEMA_WRAPPER_CONTEXT_H |
| 5 | |
| 6 | #include <stdint.h> |
| 7 | #include <sys/types.h> |
| 8 | |
| 9 | #ifdef __cplusplus |
| 10 | extern "C" { |
| 11 | #endif |
| 12 | |
| 13 | typedef void* contexts_updated_t; |
| 14 | typedef void* contexts_snapshot_t; |
| 15 | |
| 16 | struct context_updated { |
| 17 | // context id |
| 18 | const char *id; |
| 19 | |
| 20 | uint64_t version; |
| 21 | |
| 22 | uint64_t first_entry; |
| 23 | uint64_t last_entry; |
| 24 | |
| 25 | int deleted; |
| 26 | |
| 27 | const char *title; |
| 28 | uint64_t priority; |
| 29 | const char *chart_type; |
| 30 | const char *units; |
| 31 | const char *family; |
| 32 | }; |
| 33 | |
| 34 | // ContextS Snapshot related |
| 35 | contexts_snapshot_t contexts_snapshot_new(const char *claim_id, const char *node_id, uint64_t version); |
| 36 | void contexts_snapshot_delete(contexts_snapshot_t ctxs_snapshot); |
| 37 | void contexts_snapshot_set_version(contexts_snapshot_t ctxs_snapshot, uint64_t version); |
| 38 | void contexts_snapshot_add_ctx_update(contexts_snapshot_t ctxs_snapshot, struct context_updated *ctx_update); |
| 39 | char *contexts_snapshot_2bin(contexts_snapshot_t ctxs_snapshot, size_t *len); |
| 40 | |
| 41 | // ContextS Updated related |
| 42 | contexts_updated_t contexts_updated_new(const char *claim_id, const char *node_id, uint64_t version_hash, uint64_t created_at); |
| 43 | void contexts_updated_delete(contexts_updated_t ctxs_updated); |
| 44 | void contexts_updated_update_version_hash(contexts_updated_t ctxs_updated, uint64_t version_hash); |
| 45 | void contexts_updated_add_ctx_update(contexts_updated_t ctxs_updated, struct context_updated *ctx_update); |
| 46 | char *contexts_updated_2bin(contexts_updated_t ctxs_updated, size_t *len); |
| 47 | |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | #endif /* ACLK_SCHEMA_WRAPPER_CONTEXT_H */ |