master
cc 42 lines 1.03 KB
Raw
1 // SPDX-License-Identifier: GPL-3.0-or-later
2
3 #include "context/v1/stream.pb.h"
4
5 #include "context_stream.h"
6
7 #include "libnetdata/libnetdata.h"
8
9 struct stop_streaming_ctxs *parse_stop_streaming_ctxs(const char *data, size_t len)
10 {
11 context::v1::StopStreamingContexts msg;
12
13 struct stop_streaming_ctxs *res;
14
15 if (!msg.ParseFromArray(data, len))
16 return NULL;
17
18 res = (struct stop_streaming_ctxs *)callocz(1, sizeof(struct stop_streaming_ctxs));
19
20 res->claim_id = strdupz(msg.claim_id().c_str());
21 res->node_id = strdupz(msg.node_id().c_str());
22
23 return res;
24 }
25
26 struct ctxs_checkpoint *parse_ctxs_checkpoint(const char *data, size_t len)
27 {
28 context::v1::ContextsCheckpoint msg;
29
30 struct ctxs_checkpoint *res;
31
32 if (!msg.ParseFromArray(data, len))
33 return NULL;
34
35 res = (struct ctxs_checkpoint *)callocz(1, sizeof(struct ctxs_checkpoint));
36
37 res->claim_id = strdupz(msg.claim_id().c_str());
38 res->node_id = strdupz(msg.node_id().c_str());
39 res->version_hash = msg.version_hash();
40
41 return res;
42 }