MCPcopy Create free account
hub / github.com/RedisGraph/RedisGraph / _RdbSaveHeader

Function _RdbSaveHeader

src/serializers/encoder/v13/encode_graph.c:16–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16static void _RdbSaveHeader
17(
18 RedisModuleIO *rdb,
19 GraphContext *gc
20) {
21 // Header format:
22 // Graph name
23 // Node count
24 // Edge count
25 // Deleted node count
26 // Deleted edge count
27 // Label matrix count
28 // Relation matrix count - N
29 // Does relationship Ri holds mutiple edges under a single entry X N
30 // Number of graph keys (graph context key + meta keys)
31 // Schema
32
33 ASSERT(gc != NULL);
34
35 GraphEncodeHeader *header = &(gc->encoding_context->header);
36
37 // graph name
38 RedisModule_SaveStringBuffer(rdb, header->graph_name, strlen(header->graph_name) + 1);
39
40 // node count
41 RedisModule_SaveUnsigned(rdb, header->node_count);
42
43 // edge count
44 RedisModule_SaveUnsigned(rdb, header->edge_count);
45
46 // deleted node count
47 RedisModule_SaveUnsigned(rdb, header->deleted_node_count);
48
49 // deleted edge count
50 RedisModule_SaveUnsigned(rdb, header->deleted_edge_count);
51
52 // label matrix count
53 RedisModule_SaveUnsigned(rdb, header->label_matrix_count);
54
55 // relation matrix count
56 RedisModule_SaveUnsigned(rdb, header->relationship_matrix_count);
57
58 // does relationship Ri holds mutiple edges under a single entry X N
59 for(int i = 0; i < header->relationship_matrix_count; i++) {
60 // true if R[i] contain a multi edge entry
61 RedisModule_SaveUnsigned(rdb, header->multi_edge[i]);
62 }
63
64 // number of keys
65 RedisModule_SaveUnsigned(rdb, header->key_count);
66
67 // save graph schemas
68 RdbSaveGraphSchema_v13(rdb, gc);
69}
70
71// returns a state information regarding the number of entities required
72// to encode in this state

Callers 1

RdbSaveGraph_v13Function · 0.85

Calls 1

RdbSaveGraphSchema_v13Function · 0.85

Tested by

no test coverage detected