-
Notifications
You must be signed in to change notification settings - Fork 625
Expose Firestore Bundles #2369
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
Expose Firestore Bundles #2369
Conversation
This moves the Bundle files to the their own package and deletes the duplicate Bundle class (the same class exists as BundleMetadata, but was merged incorrecly). BundleCache stays in local along with the other persistence classes.
BundleLoader is a port from Web, the tests are new since BundleLoader on Web only has integration tests. To make testing possible, I also added BundleListener
…e-android-sdk into mrschmidt/bundle/reader
Coverage ReportAffected SDKs
Test Logs
NotesHTML coverage reports can be produced locally with Head commit (eb792adb) is created by Prow via merging commits: b9d0318 11936cc. |
Binary Size ReportAffected SDKs
Test Logs
NotesHead commit (eb792adb) is created by Prow via merging commits: b9d0318 11936cc. |
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.
Very close to finish!
@@ -51,7 +51,7 @@ | |||
import org.json.JSONObject; | |||
|
|||
/** A JSON serializer to deserialize Firestore Bundles. */ | |||
class BundleSerializer { | |||
public class BundleSerializer { |
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.
Not related to this line, in decodeDocument
createTime
is omitted..I think we don't use it in our SDK, but maybe we should include? Or is this intentional?
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.
We don't use createTime
in the Mobile SDKs. The version we use is derived from updateTime
.
+ "schema_version INTEGER)"); | ||
+ "schema_version INTEGER, " | ||
+ "total_documents INTEGER, " | ||
+ "total_bytes INTEGER)"); |
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.
total_documents and total_bytes are only used during loading, they are not of much use after it is loaded, and we should not persist them.
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 have added and removed these fields quite a few times now. Unfortunately, it seems easier to just include them in BundleMetadata, as the combined state can then be passed around in one object. Note that unlike JS, the BundleLoader cannot just grab these values from the JSON stream since they need to be deserialized first. If we want to omit these values from persistence, I think they are only two strategies:
- We create a BundleMetadata and a BundleMetadataDuringLoading and only use BundleMetadata in Storage
- We don't write these values to persistence and use -1 or similar values to populate BundleMetadata when we deserialize
Both of these options seems much less clean to me.
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.
SG.
@@ -501,6 +506,20 @@ private void doUnlisten(JSONArray unlistenSpec) throws Exception { | |||
queue.runSync(() -> eventManager.removeQueryListener(listener)); | |||
} | |||
|
|||
private void doLoadBundle(String json) throws Exception { |
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.
This confuses me, how did spec tests run before this PR?
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.
They have "no-android" tags and didn't run before they were removed in this PR.
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 see, thanks.
/retest |
1 similar comment
/retest |
@schmidt-sebastian: The following tests failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
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.
LGTM
WE HAVE REACHED THE END!
This PR adds the API endpoints, the SyncEngine logic and the integration tests for Bundles.
Some notable changes:
I rewrote EventAccumulator to support assertNoAdditionalEvents().
I added totalBytes/totalDocuments back to BundleMetadata as it made plumbing these values through much easier.