Use generic :dont-save mechanism in LCP
Summary: It doesn't make sense to tie skipping a member for serialization to a particular serialization implementation. Reviewers: mtomic, llugovic Reviewed By: mtomic Subscribers: pullbot Differential Revision: https://phabricator.memgraph.io/D1743
This commit is contained in:
parent
14c9044909
commit
7d01ba5178
@ -235,7 +235,7 @@ cpp<#
|
||||
query::LoadCapnpTypedValue(reader, &value, dba, data_manager);
|
||||
return value;
|
||||
}"))
|
||||
(worker-id :int :capnp-save :dont-save))
|
||||
(worker-id :int :dont-save t))
|
||||
(:serialize :capnp
|
||||
:load-args '((dba "database::GraphDbAccessor *")
|
||||
(data-manager "distributed::DataManager *"))))
|
||||
|
@ -43,9 +43,8 @@ cpp<#
|
||||
#>cpp
|
||||
self->vertex_output = storage::LoadVertex(${reader});
|
||||
cpp<#))
|
||||
(worker-id :int64_t :capnp-save :dont-save)
|
||||
(vertex-output "std::unique_ptr<Vertex>" :initarg nil
|
||||
:capnp-save :dont-save))))
|
||||
(worker-id :int64_t :dont-save t)
|
||||
(vertex-output "std::unique_ptr<Vertex>" :initarg nil :dont-save t))))
|
||||
|
||||
(lcp:define-rpc edge
|
||||
(:request ((member "TxGidPair")))
|
||||
@ -65,9 +64,8 @@ cpp<#
|
||||
#>cpp
|
||||
self->edge_output = storage::LoadEdge(${reader});
|
||||
cpp<#))
|
||||
(worker-id :int64_t :capnp-save :dont-save)
|
||||
(edge-output "std::unique_ptr<Edge>" :initarg nil
|
||||
:capnp-save :dont-save))))
|
||||
(worker-id :int64_t :dont-save t)
|
||||
(edge-output "std::unique_ptr<Edge>" :initarg nil :dont-save t))))
|
||||
|
||||
(lcp:define-rpc vertex-count
|
||||
(:request ((member "tx::TransactionId" :capnp-type "UInt64")))
|
||||
|
@ -48,7 +48,7 @@ cpp<#
|
||||
:capnp-type "Utils.SharedPtr(Plan.LogicalOperator)"
|
||||
:capnp-save #'save-plan :capnp-load #'load-plan)
|
||||
(symbol-table "query::SymbolTable" :capnp-type "Query.SymbolTable")
|
||||
(storage "query::AstStorage" :initarg nil :capnp-save :dont-save)))
|
||||
(storage "query::AstStorage" :initarg nil :dont-save t)))
|
||||
(:response ()))
|
||||
|
||||
(lcp:define-rpc remove-plan
|
||||
|
@ -101,17 +101,17 @@ the relevant parts of the response, ready for use."))
|
||||
${member}.emplace_back(current_frame);
|
||||
}
|
||||
cpp<#))
|
||||
(worker-id :int16_t :capnp-save :dont-save
|
||||
(worker-id :int16_t :dont-save t
|
||||
:documentation
|
||||
"Id of the worker on which the response is created, used for
|
||||
serializing vertices (converting local to global addresses). Indicates which
|
||||
of (old, new) records of a graph element should be sent.")
|
||||
(send-versions "storage::SendVersions" :capnp-save :dont-save)
|
||||
(send-versions "storage::SendVersions" :dont-save t)
|
||||
;; Temporary caches used between deserialization and post-processing
|
||||
;; (transfering the ownership of this data to a Cache).
|
||||
(vertices "std::vector<GraphElementData<Vertex>>" :capnp-save :dont-save)
|
||||
(edges "std::vector<GraphElementData<Edge>>" :capnp-save :dont-save)
|
||||
(paths "std::vector<PathData>" :capnp-save :dont-save))
|
||||
(vertices "std::vector<GraphElementData<Vertex>>" :dont-save t)
|
||||
(edges "std::vector<GraphElementData<Edge>>" :dont-save t)
|
||||
(paths "std::vector<PathData>" :dont-save t))
|
||||
(:documentation
|
||||
"The data of the remote pull response. Post-processing is required after
|
||||
deserialization to initialize Vertex/Edge typed values in the frames (possibly
|
||||
|
@ -394,10 +394,6 @@ encoded as union inheritance in Cap'n Proto."
|
||||
(string-downcase (cpp-type-name val) :end 1)
|
||||
field-number)))))
|
||||
|
||||
(defun cpp-class-members-for-capnp-save (cpp-class)
|
||||
(remove-if (lambda (m) (eq :dont-save (cpp-member-capnp-save m)))
|
||||
(cpp-class-members cpp-class)))
|
||||
|
||||
(defun capnp-schema (cpp-class)
|
||||
"Generate Cap'n Proto serialiation schema for CPP-CLASS"
|
||||
(declare (type (or cpp-class cpp-enum symbol) cpp-class))
|
||||
@ -407,7 +403,7 @@ encoded as union inheritance in Cap'n Proto."
|
||||
(return-from capnp-schema (capnp-schema-for-enum cpp-class)))
|
||||
(let ((class-name (if (symbolp cpp-class) cpp-class (cpp-type-base-name cpp-class)))
|
||||
(members (when (typep cpp-class 'cpp-class)
|
||||
(cpp-class-members-for-capnp-save cpp-class)))
|
||||
(cpp-class-members-for-save cpp-class)))
|
||||
(inner-types (when (typep cpp-class 'cpp-class) (cpp-class-inner-types cpp-class)))
|
||||
(union-subclasses (capnp-union-subclasses cpp-class))
|
||||
(type-params (when (typep cpp-class 'cpp-class) (cpp-type-type-params cpp-class)))
|
||||
@ -739,7 +735,7 @@ Proto schema."
|
||||
(declare (type cpp-class cpp-class))
|
||||
(declare (type string instance-access))
|
||||
(with-output-to-string (s)
|
||||
(dolist (member (cpp-class-members-for-capnp-save cpp-class))
|
||||
(dolist (member (cpp-class-members-for-save cpp-class))
|
||||
(let ((member-access
|
||||
(concatenate 'string instance-access
|
||||
(if (eq :public (cpp-member-scope member))
|
||||
@ -788,7 +784,7 @@ Proto schema."
|
||||
;; Initialize CPP-CLASS builder
|
||||
(when parents
|
||||
(if (or force-builder compose-parents
|
||||
(cpp-class-members-for-capnp-save cpp-class))
|
||||
(cpp-class-members-for-save cpp-class))
|
||||
(progn
|
||||
(format cpp-out "auto ~A_builder = ~A->~{get~A().~}init~A();~%"
|
||||
(cpp-variable-name (cpp-type-base-name cpp-class))
|
||||
@ -901,7 +897,7 @@ Proto schema."
|
||||
;;; the ownership of the concrete type.
|
||||
|
||||
(defun cpp-class-members-for-capnp-load (cpp-class)
|
||||
(remove-if (lambda (m) (and (eq :dont-save (cpp-member-capnp-save m))
|
||||
(remove-if (lambda (m) (and (cpp-member-dont-save m)
|
||||
(not (cpp-member-capnp-load m))))
|
||||
(cpp-class-members cpp-class)))
|
||||
|
||||
|
@ -792,7 +792,7 @@ cpp<#
|
||||
(function-name "std::string" :scope :public)
|
||||
(function "std::function<TypedValue(TypedValue *, int64_t, const EvaluationContext &, database::GraphDbAccessor *)>"
|
||||
:scope :public :capnp-init nil
|
||||
:capnp-save :dont-save
|
||||
:dont-save t
|
||||
:capnp-load (lambda (reader member capnp-name)
|
||||
#>cpp
|
||||
${member} = NameToFunction(self->get()->function_name_);
|
||||
|
@ -651,10 +651,10 @@ property value.
|
||||
(
|
||||
;; info on what's getting expanded
|
||||
(node-symbol "Symbol"
|
||||
:documentation "Symbol pointing to the node to be expanded.
|
||||
:documentation "Symbol pointing to the node to be expanded.
|
||||
This is where the new node will be stored.")
|
||||
(edge-symbol "Symbol"
|
||||
:documentation "Symbol for the edges to be expanded.
|
||||
:documentation "Symbol for the edges to be expanded.
|
||||
This is where a TypedValue containing a list of expanded edges will be stored.")
|
||||
(direction "EdgeAtom::Direction"
|
||||
:documentation "EdgeAtom::Direction determining the direction of edge
|
||||
@ -667,8 +667,8 @@ expansion. The direction is relative to the starting vertex for each expansion."
|
||||
"EdgeAtom::Direction"
|
||||
'(in out both)))
|
||||
(edge-types "std::vector<storage::EdgeType>"
|
||||
:documentation "storage::EdgeType specifying which edges we want
|
||||
to expand. If empty, all edges are valid. If not empty, only edges with one of
|
||||
:documentation "storage::EdgeType specifying which edges we want
|
||||
to expand. If empty, all edges are valid. If not empty, only edges with one of
|
||||
the given types are valid."
|
||||
:capnp-save (lcp:capnp-save-vector "::storage::capnp::Common"
|
||||
"storage::EdgeType")
|
||||
@ -713,7 +713,7 @@ pulled.")
|
||||
#>cpp
|
||||
/**
|
||||
* Creates an expansion. All parameters except input and input_symbol are
|
||||
* forwarded to @c ExpandCommon and are documented there.
|
||||
* forwarded to @c ExpandCommon and are documented there.
|
||||
*
|
||||
* @param input Optional logical operator that preceeds this one.
|
||||
* @param input_symbol Symbol that points to a VertexAccessor in the frame
|
||||
@ -2161,11 +2161,9 @@ vectors of symbols used by each of the inputs.")
|
||||
(:serialize :capnp))
|
||||
|
||||
(lcp:define-class output-table (logical-operator)
|
||||
((output-symbols "std::vector<Symbol>" :scope :public
|
||||
:capnp-save :dont-save)
|
||||
((output-symbols "std::vector<Symbol>" :scope :public :dont-save t)
|
||||
(callback "std::function<std::vector<std::vector<TypedValue>>()>"
|
||||
:scope :public
|
||||
:capnp-save :dont-save))
|
||||
:scope :public :dont-save t))
|
||||
(:documentation "An operator that outputs a table, producing a single row on each pull")
|
||||
(:public
|
||||
#>cpp
|
||||
|
Loading…
Reference in New Issue
Block a user