Save and load pointers in ast capnp serialization
Summary: Pointers in AstTreeStorage can point to same nodes. These nodes should be serialized(saved) only once when serializing Ast tree. Same goes for deserializing(loading). When deserializing nodes, one should not use storage Create method, because it will add node which isn't completely loaded to storage vector. Therefore, one should use new Deserialize method which doesn't add node to storage vector. Inserting node into storage vector is defered until all node data is loaded. Pass pointer to saved uids set, instead of storage Delete unused set Reviewers: teon.banek, msantl Reviewed By: teon.banek Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1344
This commit is contained in:
parent
8795501890
commit
4b9970ccf8
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -154,14 +154,16 @@ class CapnpAstGenerator : public Base {
|
||||
{
|
||||
query::capnp::Tree::Builder builder =
|
||||
message.initRoot<query::capnp::Tree>();
|
||||
visitor.query()->Save(builder);
|
||||
std::vector<int> saved_uids;
|
||||
visitor.query()->Save(&builder, &saved_uids);
|
||||
}
|
||||
|
||||
AstTreeStorage new_ast;
|
||||
{
|
||||
query::capnp::Tree::Reader reader =
|
||||
const query::capnp::Tree::Reader reader =
|
||||
message.getRoot<query::capnp::Tree>();
|
||||
new_ast.Load(reader);
|
||||
std::vector<int> loaded_uids;
|
||||
new_ast.Load(reader, &loaded_uids);
|
||||
}
|
||||
return new_ast;
|
||||
}()),
|
||||
|
Loading…
Reference in New Issue
Block a user