-
Notifications
You must be signed in to change notification settings - Fork 1.5k
indexeddb: improve allDocs() perf with skip & key ranges #8603
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 23 commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
c361764
indexeddb: improve allDocs() perf with skip & key ranges
e0dfb7a
Rename index
6c9f86d
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn dbe2405
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn 44a0a15
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn 6eb3972
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn 9bc7927
fix eol-last
42cc853
add migration
dd6ed4c
Use isLocalId()
796e1e4
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn f470aa7
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn 8d72af6
rename META_STORE to META_LOCAL_STORE
7f3e980
get(): use isLocalId()
8b95c7f
Implement getLocal()
7d468da
Revert "Implement getLocal()"
e2ea6ee
Implement getLocal()
1cde95c
Merge branch 'master' into indexeddb-faster-alldocs
alxndrsn 2187822
mocha v10: fix failure handling
d50645d
mocha v10: fix failure handling
85fbca8
indexeddb._getLocal(): process attachments
dec066a
Merge branch 'master' into indexeddb-faster-alldocs
02a837c
more comment
ad652f8
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
1ec03cd
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
9d518e8
Resolve REVIEW comment
81ed8d5
getRevisionTree(): only open DOC_STORE
06c2b26
fetchResults() batch
b9992fc
Add a big test
32ab14a
add some more to the test
9f3399c
lint
f86dd92
getLocal(): remove use strict & attachment support
f889598
lint
dd62ea2
Revert "getLocal(): remove use strict & attachment support"
213d8c4
Revert "lint"
aed6f98
remove use strict
56a17f4
use const
18f706f
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
f9a5ba3
delete seq index; don't create other index
cb90ef3
don't delete seq - seems to be required somewhere
179cc49
delete seq; maintain _isDeleted_id
a8b0c63
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
4fd2f51
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
8c0b977
allDocs: don't recurse
063c725
rename deleted,id db index
0b06fbc
Merge remote-tracking branch 'upstream/master' into indexeddb-faster-…
569557d
new test: make more robust in CI
1412422
Update/add tests for local doc attachments
d8d9f42
update github issue link
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
39 changes: 39 additions & 0 deletions
39
packages/node_modules/pouchdb-adapter-indexeddb/src/getLocal.js
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,39 @@ | ||
| 'use strict'; | ||
|
|
||
alxndrsn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| import { createError, MISSING_DOC } from 'pouchdb-errors'; | ||
|
|
||
| import { META_LOCAL_STORE, processAttachment } from './util'; | ||
|
|
||
| // _getLocal() doesn't know if opts.binary is set or not, so assume it's not. | ||
| const BINARY_ATTACHMENTS = false; | ||
|
|
||
| export default function (txn, id, api, callback) { | ||
| if (txn.error) { | ||
| return callback(txn.error); | ||
| } | ||
|
|
||
| txn.txn.objectStore(META_LOCAL_STORE).get(id).onsuccess = function (e) { | ||
| const doc = e.target.result; | ||
|
|
||
| if (!doc) { | ||
| callback(createError(MISSING_DOC, 'missing')); | ||
| return; | ||
| } | ||
|
|
||
| const result = doc.revs[doc.rev].data; | ||
| result._id = doc.id; | ||
| result._rev = doc.rev; | ||
|
|
||
| if (result._attachments) { | ||
| const processing = []; | ||
| for (var name in result._attachments) { | ||
alxndrsn marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| processing.push(processAttachment(name, doc, result, BINARY_ATTACHMENTS, api.blobSupport)); | ||
| } | ||
| Promise.all(processing) | ||
| .then(() => callback(null, result)) | ||
| .catch(callback); | ||
| } else { | ||
| callback(null, result); | ||
| } | ||
| }; | ||
| } | ||
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.