Skip to content

Skipping empty write requests #74

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

Merged
merged 14 commits into from
Nov 22, 2017
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Nov 18, 2017

This is required for a full pass of the conformance test.

This adds fromObject and fromUpdateMap to DocumentTransform, DocumentMask, and DocumentSnapshot and moves some of the existing logic to expand objects into these functions.

This also adds the ability to delete nested fields via merge. set({a : { b: delete}}, merge) was previously not supported, but I needed it for the system test.

@ghost ghost added the cla: yes This human has signed the Contributor License Agreement. label Nov 18, 2017
@codecov
Copy link

codecov bot commented Nov 18, 2017

Codecov Report

Merging #74 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master    #74   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          12     12           
  Lines        1547   1596   +49     
=====================================
+ Hits         1547   1596   +49
Impacted Files Coverage Δ
src/document.js 100% <100%> (ø) ⬆️
src/reference.js 100% <100%> (ø) ⬆️
src/write-batch.js 100% <100%> (ø) ⬆️
src/transaction.js 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c44a42...de84552. Read the comment docs.

Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

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

This is a lot of code churn for slightly questionable benefit, but I guess it's worth it to increase our test coverage... in that name though, I'm going slightly light on code review and trusting that our tests are covering this code sufficiently well. I did flag a few things though.

resolve();
try {
assert.deepEqual(request, expected);
resolve();

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

src/document.js Outdated
* turns { foo.bar : foobar } into { foo { bar : foobar }}
*
* @private
* @param {firestore/DocumentReference} ref - The reference to the documen.t

This comment was marked as spam.

This comment was marked as spam.

src/document.js Outdated
return true;
}

return isEmptyObject(this._fieldsProto);

This comment was marked as spam.

This comment was marked as spam.

);

if (explicitTransaction) {
request.transaction = explicitTransaction;
}

// We store the number of operations that we sent as part of this commit
// as the user is able to add additional operations afterwards.

This comment was marked as spam.

This comment was marked as spam.

@schmidt-sebastian
Copy link
Contributor Author

Addressed comments. I agree that this PR brings very little benefit to Node, but I think the benefit that it brings to the GCloud SDKs as a whole far outweighs the work that has gone into this.

@schmidt-sebastian schmidt-sebastian removed their assignment Nov 22, 2017
Copy link
Contributor

@mikelehen mikelehen left a comment

Choose a reason for hiding this comment

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

Couple minor requests, but overall looks good. Thanks!

// We store the number of operations that we sent as part of this commit
// as the user is able to add additional operations afterwards.
let opCount = this._writes.length;
this._committed = true;

This comment was marked as spam.

This comment was marked as spam.

@@ -294,6 +294,21 @@ describe('batch support', function() {
});
});

it('cannot append to committed batch', function() {

This comment was marked as spam.

This comment was marked as spam.

@schmidt-sebastian schmidt-sebastian merged commit 8541ed4 into master Nov 22, 2017
@ghost ghost removed the cla: yes This human has signed the Contributor License Agreement. label Nov 22, 2017
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt-onetimestamp branch January 30, 2018 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants