Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
4c835354
Commit
4c835354
authored
Aug 01, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
IDB: reduce diff size
parent
e11ab351
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
268 additions
and
275 deletions
+268
-275
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+268
-275
No files found.
src/jio.storage/indexeddbstorage.js
View file @
4c835354
...
...
@@ -130,8 +130,11 @@
}
}
function
waitForOpenIndexedDB
(
db_name
,
version
,
index_keys
,
callback
)
{
var
request
;
function
waitForOpenIndexedDB
(
storage
,
callback
)
{
var
request
,
db_name
=
storage
.
_database_name
,
version
=
storage
.
_version
,
index_keys
=
storage
.
_index_keys
;
function
canceller
()
{
if
((
request
!==
undefined
)
&&
(
request
.
result
!==
undefined
))
{
...
...
@@ -293,8 +296,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
waitForOpenIndexedDB
(
context
.
_database_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
,
function
(
tx
)
{
key
=
"
_id
"
;
...
...
@@ -325,8 +327,7 @@
var
context
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
waitForOpenIndexedDB
(
context
.
_database_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
metadata
"
],
"
readonly
"
,
function
(
tx
)
{
return
waitForIDBRequest
(
tx
.
objectStore
(
"
metadata
"
).
get
(
id
));
...
...
@@ -354,8 +355,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
waitForOpenIndexedDB
(
context
.
_database_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
],
"
readonly
"
,
function
(
tx
)
{
return
RSVP
.
all
([
...
...
@@ -384,8 +384,7 @@
};
IndexedDBStorage
.
prototype
.
put
=
function
(
id
,
metadata
)
{
return
waitForOpenIndexedDB
(
this
.
_database_name
,
this
.
_version
,
this
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
this
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
metadata
"
],
"
readwrite
"
,
function
(
tx
)
{
return
waitForIDBRequest
(
tx
.
objectStore
(
"
metadata
"
).
put
({
...
...
@@ -397,8 +396,7 @@
};
IndexedDBStorage
.
prototype
.
remove
=
function
(
id
)
{
return
waitForOpenIndexedDB
(
this
.
_database_name
,
this
.
_version
,
this
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
this
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
metadata
"
,
"
attachment
"
,
"
blob
"
],
"
readwrite
"
,
function
(
tx
)
{
...
...
@@ -442,8 +440,7 @@
if
(
options
===
undefined
)
{
options
=
{};
}
var
db_name
=
this
.
_database_name
,
start
,
var
start
,
end
,
array_buffer_list
=
[],
context
=
this
;
...
...
@@ -467,8 +464,7 @@
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
waitForOpenIndexedDB
(
db_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
blob
"
],
"
readonly
"
,
function
(
tx
)
{
var
key_path
=
buildKeyPath
([
id
,
name
]),
...
...
@@ -553,8 +549,7 @@
// Request the full blob
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
return
waitForOpenIndexedDB
(
db_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readonly
"
,
function
(
tx
)
{
var
key_path
=
buildKeyPath
([
id
,
name
]),
...
...
@@ -626,7 +621,7 @@
};
IndexedDBStorage
.
prototype
.
putAttachment
=
function
(
id
,
name
,
blob
)
{
var
db_name
=
this
.
_database_name
,
context
=
this
;
var
context
=
this
;
return
new
RSVP
.
Queue
()
.
push
(
function
()
{
// Split the blob first
...
...
@@ -644,8 +639,7 @@
handled_size
+=
UNITE
;
}
return
waitForOpenIndexedDB
(
db_name
,
context
.
_version
,
context
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
context
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readwrite
"
,
function
(
tx
)
{
var
blob_store
,
...
...
@@ -712,8 +706,7 @@
};
IndexedDBStorage
.
prototype
.
removeAttachment
=
function
(
id
,
name
)
{
return
waitForOpenIndexedDB
(
this
.
_database_name
,
this
.
_version
,
this
.
_index_keys
,
function
(
db
)
{
return
waitForOpenIndexedDB
(
this
,
function
(
db
)
{
return
waitForTransaction
(
db
,
[
"
attachment
"
,
"
blob
"
],
"
readwrite
"
,
function
(
tx
)
{
var
promise_list
=
[],
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment