-
Notifications
You must be signed in to change notification settings - Fork 1.7k
[realppl 7] realppl integration with remote/local and unit tests #14853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cheryllin/ppl
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -19,6 +19,7 @@ | |
| #include <memory> | ||
| #include <utility> | ||
|
|
||
| #include "Firestore/core/src/core/pipeline_util.h" | ||
| #include "Firestore/core/src/remote/serializer.h" | ||
|
|
||
| namespace firebase { | ||
|
|
@@ -27,16 +28,35 @@ namespace api { | |
|
|
||
| RealtimePipeline::RealtimePipeline( | ||
| std::vector<std::shared_ptr<EvaluableStage>> stages, | ||
| remote::Serializer serializer) | ||
| std::unique_ptr<remote::Serializer> serializer) | ||
| : stages_(std::move(stages)), serializer_(std::move(serializer)) { | ||
| this->rewritten_stages_ = core::RewriteStages(this->stages()); | ||
| } | ||
|
|
||
| RealtimePipeline::RealtimePipeline(const RealtimePipeline& other) | ||
| : stages_(other.stages_), | ||
| rewritten_stages_(other.rewritten_stages_), | ||
| serializer_(std::make_unique<remote::Serializer>( | ||
| other.serializer_->database_id())) { | ||
| } | ||
|
|
||
| RealtimePipeline& RealtimePipeline::operator=(const RealtimePipeline& other) { | ||
| if (this != &other) { | ||
| stages_ = other.stages_; | ||
| rewritten_stages_ = other.rewritten_stages_; | ||
| serializer_ = | ||
| std::make_unique<remote::Serializer>(other.serializer_->database_id()); | ||
|
Comment on lines
+47
to
+48
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. should
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Curious why this is a unique_ptr. RealtimePipeline::operator= might not be called often, but in the AddStage function below, using a shared_ptr could improve efficiency. |
||
| } | ||
| return *this; | ||
| } | ||
|
|
||
| RealtimePipeline RealtimePipeline::AddingStage( | ||
| std::shared_ptr<EvaluableStage> stage) { | ||
| auto copy = std::vector<std::shared_ptr<EvaluableStage>>(this->stages_); | ||
| copy.push_back(stage); | ||
|
|
||
| return {copy, serializer_}; | ||
| return {copy, | ||
| std::make_unique<remote::Serializer>(serializer_->database_id())}; | ||
| } | ||
|
|
||
| const std::vector<std::shared_ptr<EvaluableStage>>& RealtimePipeline::stages() | ||
|
|
@@ -49,13 +69,8 @@ RealtimePipeline::rewritten_stages() const { | |
| return this->rewritten_stages_; | ||
| } | ||
|
|
||
| void RealtimePipeline::SetRewrittenStages( | ||
| std::vector<std::shared_ptr<EvaluableStage>> stages) { | ||
| this->rewritten_stages_ = std::move(stages); | ||
| } | ||
|
|
||
| EvaluateContext RealtimePipeline::evaluate_context() { | ||
| return EvaluateContext(&serializer_); | ||
| EvaluateContext RealtimePipeline::evaluate_context() const { | ||
| return EvaluateContext(serializer_.get()); | ||
| } | ||
|
|
||
| } // namespace api | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I feel it would be better to call it
QueryOrRealtimePipelinesince pipeline is not a part of it.