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