Skip to content
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

Pass FSTMutations* using a vector #2357

Merged
merged 7 commits into from
Feb 8, 2019
Merged

Conversation

var-const
Copy link
Contributor

This came up while porting FSTTransaction. The general idea:

  • all code paths that eventually lead to creation of an FSTMutationBatch take the vector by rvalue reference, so that the vector is moved into the batch;
  • Datastore::Commit and WriteStream::WriteMutations take the vector by const reference.

@var-const var-const requested review from rsgowman and zxu123 February 6, 2019 23:39
@var-const var-const changed the title Pass FSTMutations* using a vector Pass FSTMutations* using a vector Feb 6, 2019

for (NSUInteger i = 0; i < self.mutations.count; i++) {
FSTMutation *mutation = self.mutations[i];
for (int i = 0; i < _mutations.size(); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, i should be unsigned. (More precisely, size_t). This will eventually become a compiler error once compiled as c++ under certain systems with the warnings that we have enabled (at least linux/gcc)

NSArray<FSTMutation *> *mutations = batch.mutations;
for (NSUInteger i = 0; i < mutations.count; i++) {
std::vector<FSTMutation *> mutations = batch.mutations;
for (int i = 0; i < mutations.size(); i++) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(again)

#define FSTAssertEqualVectors(v1, v2) \
do { \
XCTAssertEqual(v1.size(), v2.size(), @"Vector length mismatch"); \
for (int i = 0; i < v1.size(); i++) { \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(again)

@var-const var-const merged commit a22b4cd into master Feb 8, 2019
bstpierr added a commit that referenced this pull request Feb 8, 2019
* master: (27 commits)
  Pass FSTMutations using a vector (#2357)
  Update CI to use CocoaPods 1.6.0 (#2360)
  Add NS_ASSUME_NONNULL_NOTATION for game center sign in (#2359)
  C++ migration: make all methods of `FSTRemoteStore` delegate to C++ (#2337)
  C++ migration: port write stream-related part of `FSTRemoteStore` (#2335)
  Resolve hard dependency of GameKit (#2355)
  Update gRPC certificate bundles locations for Firebase 5.16 (#2353)
  Start pod lib lint CI for IAM (#2347)
  Update library name to `fire-fiam`. (#2352)
  Bump FirebaseAnalyticsInterop version  (#2315)
  Add IAM headless to CI (#2341)
  C++ migration: port watch stream-related part of `FSTRemoteStore` (#2331)
  Open source FIAM headless SDK (#2312)
  Port flaky test fix from web. (#2332)
  Make scripts/style.sh compatible with newer swiftformat versions (0.38) (#2334)
  C++ migration: port `FSTOnlineStateTracker` (#2325)
  Don't build fuzz tests target on Travis (#2330)
  Remove FSTMutationQueue (#2319)
  C++ migration: port `FSTRemoteEvent` (#2320)
  C++ migration: port `FSTTargetChange` (#2318)
  ...
@paulb777 paulb777 deleted the varconst/vector-of-fst-mutations branch April 13, 2019 16:00
@firebase firebase locked and limited conversation to collaborators Oct 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants