Skip to content

Add IndexManager CRUD operations #5970

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 7 commits into from
Feb 10, 2022
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

@schmidt-sebastian schmidt-sebastian commented Feb 3, 2022

Ports the IndexManager from Android. Web doesn't have in-memory backing b/c of Multi-Tab. Some of the tests are not present on Android (yet).

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2022

⚠️ No Changeset found

Latest commit: df5edb3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@schmidt-sebastian schmidt-sebastian changed the title Mrschmidt/indexmanager Add IndexManager CRUD operations Feb 3, 2022
@schmidt-sebastian schmidt-sebastian marked this pull request as ready for review February 3, 2022 22:27
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 3, 2022

Size Report 1

Affected Products

  • @firebase/firestore

    TypeBase (00916e7)Merge (c9cff76)Diff
    browser231 kB233 kB+2.16 kB (+0.9%)
    esm5288 kB291 kB+2.53 kB (+0.9%)
    main460 kB463 kB+3.65 kB (+0.8%)
    module231 kB233 kB+2.16 kB (+0.9%)
    react-native231 kB233 kB+2.16 kB (+0.9%)
  • bundle

    TypeBase (00916e7)Merge (c9cff76)Diff
    firestore (Persistence)232 kB234 kB+2.58 kB (+1.1%)
    firestore (Query Cursors)190 kB190 kB+91 B (+0.0%)
    firestore (Query)191 kB191 kB+91 B (+0.0%)
    firestore (Read data once)180 kB180 kB+91 B (+0.1%)
    firestore (Realtime updates)182 kB182 kB+91 B (+0.1%)
    firestore (Transaction)164 kB164 kB+85 B (+0.1%)
    firestore (Write data)163 kB163 kB+85 B (+0.1%)
  • firebase

    TypeBase (00916e7)Merge (c9cff76)Diff
    firebase-compat.js755 kB758 kB+2.52 kB (+0.3%)
    firebase-firestore-compat.js283 kB285 kB+2.52 kB (+0.9%)
    firebase-firestore.js780 kB784 kB+4.01 kB (+0.5%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/ncOw0tT7Cl.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Feb 3, 2022

Size Analysis Report 1

This report is too large (445,136 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/2RBlJBYC2Y.html

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2022

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

Copy link
Contributor

@wu-hui wu-hui left a comment

Choose a reason for hiding this comment

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

Sorry for the delay.

@@ -708,13 +708,20 @@ export class DbIndexConfiguration {

static keyPath = 'indexId';

static collectionGroupIndex = 'collectionGroupIndex';
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not exist in Android?

Copy link
Contributor

Choose a reason for hiding this comment

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

I see why now. Please add comment like you did below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* An index that provides access to documents in a collection sorted by last
* update time. Used by the backfiller.
*
* PORTING NOTE: iOS and Android maintain this index in-memory.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe also explain why JS is different here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


setIndexManager(indexManager: IndexManager): void {
this.indexManager = indexManager;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Empty line after here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

IDBKeyRange.bound(collectionGroup, collectionGroup)
)
: indexes.loadAll()
).next(indexEntries => {
Copy link
Contributor

Choose a reason for hiding this comment

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

indexEntry has different meaning..maybe indexConfig?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Done.


let fieldIndexes = await indexManager.getFieldIndexes();
expect(fieldIndexes[0].indexState).to.deep.equal(
new IndexState(0, IndexOffset.min())
Copy link
Contributor

Choose a reason for hiding this comment

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

Perhaps explain what 0 and 1 means here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@wu-hui wu-hui assigned schmidt-sebastian and unassigned wu-hui Feb 9, 2022
Copy link
Contributor Author

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

Thanks for the review

IDBKeyRange.bound(collectionGroup, collectionGroup)
)
: indexes.loadAll()
).next(indexEntries => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Makes sense. Done.


setIndexManager(indexManager: IndexManager): void {
this.indexManager = indexManager;
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -708,13 +708,20 @@ export class DbIndexConfiguration {

static keyPath = 'indexId';

static collectionGroupIndex = 'collectionGroupIndex';
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

* An index that provides access to documents in a collection sorted by last
* update time. Used by the backfiller.
*
* PORTING NOTE: iOS and Android maintain this index in-memory.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done


let fieldIndexes = await indexManager.getFieldIndexes();
expect(fieldIndexes[0].indexState).to.deep.equal(
new IndexState(0, IndexOffset.min())
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@schmidt-sebastian schmidt-sebastian merged commit 434d87e into master Feb 10, 2022
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/indexmanager branch February 10, 2022 16:29
@firebase firebase locked and limited conversation to collaborators Mar 13, 2022
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.

3 participants