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

Function _StatePayloadInfo

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

returns a state information regarding the number of entities required to encode in this state

Source from the content-addressed store, hash-verified

71// returns a state information regarding the number of entities required
72// to encode in this state
73static PayloadInfo _StatePayloadInfo
74(
75 GraphContext *gc,
76 EncodeState state,
77 uint64_t offset,
78 uint64_t entities_to_encode
79) {
80 uint64_t required_entities_count = 0;
81 switch(state) {
82 case ENCODE_STATE_NODES:
83 required_entities_count = Graph_NodeCount(gc->g);
84 break;
85 case ENCODE_STATE_DELETED_NODES:
86 required_entities_count = Graph_DeletedNodeCount(gc->g);
87 break;
88 case ENCODE_STATE_EDGES:
89 required_entities_count = Graph_EdgeCount(gc->g);
90 break;
91 case ENCODE_STATE_DELETED_EDGES:
92 required_entities_count = Graph_DeletedEdgeCount(gc->g);
93 break;
94 case ENCODE_STATE_GRAPH_SCHEMA:
95 required_entities_count = 1;
96 break;
97 default:
98 ASSERT(false && "Unknown encoding state in _CurrentStatePayloadInfo");
99 break;
100 }
101
102 PayloadInfo payload_info;
103 payload_info.state = state;
104 // when this state will be encoded, the number of entities to encode
105 // is the minimum between the number of entities to encode and
106 // the remaining entities left to encode from the same type
107 payload_info.entities_count = MIN(entities_to_encode, required_entities_count - offset);
108 return payload_info;
109}
110
111// this function saves the key content schema
112// and returns it so the encoder can know how to encode the key

Callers 1

_RdbSaveKeySchemaFunction · 0.85

Calls 4

Graph_NodeCountFunction · 0.85
Graph_DeletedNodeCountFunction · 0.85
Graph_EdgeCountFunction · 0.85
Graph_DeletedEdgeCountFunction · 0.85

Tested by

no test coverage detected