-
Notifications
You must be signed in to change notification settings - Fork 938
Firestore: testing_hooks.ts: move some logic into testing_hooks_spi.ts #7543
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
Changes from 10 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
9a63921
Firestore: testing_hooks.ts: move some logic into testing_hooks_spi.ts
dconeybe f3489a6
api fixes
dconeybe 6caf745
add testing_hooks.ts to externs.json so that _TestingHooksExistenceFi…
dconeybe dc3f741
Merge remote-tracking branch 'origin/master' into TestingHooksSpi
dconeybe 0b4eb3b
doc minor fix
dconeybe 168d922
minor tweaks
dconeybe c681d3d
run_tests_in_ci.js rewrite
dconeybe c4822ce
run_tests_in_ci.js: set `process.exitCode=1` instead of calling `proc…
dconeybe 526b561
run_tests_in_ci.js: revert local modifications
dconeybe 78bbbc0
Merge remote-tracking branch 'remotes/origin/dconeybe/RunTestsInCiJsT…
dconeybe 24dc0fa
undo changes to run_tests_in_ci.js because they aren't part of this PR
dconeybe 92c698d
Merge remote-tracking branch 'origin/master' into TestingHooksSpi
dconeybe e550a5c
empty commit to trigger github actions
dconeybe 037fc58
Merge remote-tracking branch 'origin/master' into TestingHooksSpi
dconeybe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
/** | ||
* @license | ||
* Copyright 2023 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
/** | ||
* The global, singleton instance of TestingHooksSpi. | ||
* | ||
* This variable will be `null` in all cases _except_ when running from | ||
* integration tests that have registered callbacks to be notified of events | ||
* that happen during the test execution. | ||
*/ | ||
export let testingHooksSpi: TestingHooksSpi | null = null; | ||
|
||
/** | ||
* Sets the value of the `testingHooksSpi` object. | ||
* @param instance the instance to set. | ||
*/ | ||
export function setTestingHooksSpi(instance: TestingHooksSpi): void { | ||
if (testingHooksSpi) { | ||
throw new Error('a TestingHooksSpi instance is already set'); | ||
} | ||
testingHooksSpi = instance; | ||
} | ||
|
||
/** | ||
* The "service provider interface" for the testing hooks. | ||
* | ||
* The implementation of this object will handle the callbacks made by the SDK | ||
* to be handled by the integration tests. | ||
* | ||
* This "SPI" is separated from the implementation to avoid import cycles and | ||
* to enable production builds to fully tree-shake away the testing hooks logic. | ||
*/ | ||
export interface TestingHooksSpi { | ||
/** | ||
* Invokes all callbacks registered with | ||
* `TestingHooks.onExistenceFilterMismatch()` with the given info. | ||
*/ | ||
notifyOnExistenceFilterMismatch(info: ExistenceFilterMismatchInfo): void; | ||
} | ||
|
||
/** | ||
* Information about an existence filter mismatch. | ||
* @internal | ||
*/ | ||
export interface ExistenceFilterMismatchInfo { | ||
/** The number of documents that matched the query in the local cache. */ | ||
localCacheCount: number; | ||
|
||
/** | ||
* The number of documents that matched the query on the server, as specified | ||
* in the ExistenceFilter message's `count` field. | ||
*/ | ||
existenceFilterCount: number; | ||
|
||
/** | ||
* The projectId used when checking documents for membership in the bloom | ||
* filter. | ||
*/ | ||
projectId: string; | ||
|
||
/** | ||
* The databaseId used when checking documents for membership in the bloom | ||
* filter. | ||
*/ | ||
databaseId: string; | ||
|
||
/** | ||
* Information about the bloom filter provided by Watch in the ExistenceFilter | ||
* message's `unchangedNames` field. If this property is omitted or undefined | ||
* then that means that Watch did _not_ provide a bloom filter. | ||
*/ | ||
bloomFilter?: { | ||
/** | ||
* Whether a full requery was averted by using the bloom filter. If false, | ||
* then something happened, such as a false positive, to prevent using the | ||
* bloom filter to avoid a full requery. | ||
*/ | ||
applied: boolean; | ||
|
||
/** The number of hash functions used in the bloom filter. */ | ||
hashCount: number; | ||
|
||
/** The number of bytes in the bloom filter's bitmask. */ | ||
bitmapLength: number; | ||
|
||
/** The number of bits of padding in the last byte of the bloom filter. */ | ||
padding: number; | ||
|
||
/** | ||
* Tests the given string for membership in the bloom filter created from | ||
* the existence filter; will be undefined if creating the bloom filter | ||
* failed. | ||
*/ | ||
mightContain?: (value: string) => boolean; | ||
}; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.