Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
officejs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
officejs
Commits
76e021e1
Commit
76e021e1
authored
Jul 31, 2012
by
Tristan Cavelier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating Index Storage
parent
0c0dbc06
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
27 deletions
+24
-27
OfficeJS/src/jio.storage/indexstorage.js
OfficeJS/src/jio.storage/indexstorage.js
+24
-27
No files found.
OfficeJS/src/jio.storage/indexstorage.js
View file @
76e021e1
...
@@ -159,7 +159,7 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -159,7 +159,7 @@ var newIndexStorage = function ( spec, my ) {
*/
*/
priv
.
update
=
function
()
{
priv
.
update
=
function
()
{
// retreive list before, and then retreive all files
// retreive list before, and then retreive all files
var
getlist_on
Done
=
function
(
result
)
{
var
getlist_on
Success
=
function
(
result
)
{
if
(
!
priv
.
isAnIndexedStorage
(
priv
.
secondstorage_string
))
{
if
(
!
priv
.
isAnIndexedStorage
(
priv
.
secondstorage_string
))
{
priv
.
indexStorage
(
priv
.
secondstorage_string
);
priv
.
indexStorage
(
priv
.
secondstorage_string
);
}
}
...
@@ -168,7 +168,7 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -168,7 +168,7 @@ var newIndexStorage = function ( spec, my ) {
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
newCommand
(
'
getDocumentList
'
,
that
.
newCommand
(
'
getDocumentList
'
,
{
path
:
'
.
'
,
{
path
:
'
.
'
,
option
:{
onDone
:
getlist_onDone
,
option
:{
success
:
getlist_onSuccess
,
max_retry
:
3
}})
);
max_retry
:
3
}})
);
};
};
...
@@ -178,17 +178,16 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -178,17 +178,16 @@ var newIndexStorage = function ( spec, my ) {
*/
*/
that
.
saveDocument
=
function
(
command
)
{
that
.
saveDocument
=
function
(
command
)
{
var
newcommand
=
command
.
clone
();
var
newcommand
=
command
.
clone
();
newcommand
.
onResponseDo
(
function
(){});
newcommand
.
onSuccessDo
(
function
(
result
)
{
newcommand
.
onDoneDo
(
function
(
result
)
{
if
(
!
priv
.
isFileIndexed
(
command
.
getPath
()))
{
if
(
!
priv
.
isFileIndexed
(
command
.
getPath
()))
{
priv
.
addFile
({
name
:
command
.
getPath
(),
priv
.
addFile
({
name
:
command
.
getPath
(),
last_modified
:
0
,
creation_date
:
0
});
last_modified
:
0
,
creation_date
:
0
});
}
}
priv
.
update
();
priv
.
update
();
that
.
done
();
that
.
success
();
});
});
newcommand
.
on
Fail
Do
(
function
(
result
)
{
newcommand
.
on
Error
Do
(
function
(
result
)
{
that
.
fail
(
result
);
that
.
error
(
result
);
});
});
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
newcommand
);
newcommand
);
...
@@ -200,7 +199,7 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -200,7 +199,7 @@ var newIndexStorage = function ( spec, my ) {
*/
*/
that
.
loadDocument
=
function
(
command
)
{
that
.
loadDocument
=
function
(
command
)
{
var
file_array
,
i
,
l
,
new_job
,
var
file_array
,
i
,
l
,
new_job
,
loadOn
Done
=
function
(
result
)
{
loadOn
Success
=
function
(
result
)
{
// if (file_array[i].last_modified !==
// if (file_array[i].last_modified !==
// result.return_value.last_modified ||
// result.return_value.last_modified ||
// file_array[i].creation_date !==
// file_array[i].creation_date !==
...
@@ -209,16 +208,15 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -209,16 +208,15 @@ var newIndexStorage = function ( spec, my ) {
// // the one in the second storage. priv.update will
// // the one in the second storage. priv.update will
// // take care of refresh the indexed storage
// // take care of refresh the indexed storage
// }
// }
that
.
done
(
result
);
that
.
success
(
result
);
},
},
loadOn
Fail
=
function
(
result
)
{
loadOn
Error
=
function
(
result
)
{
that
.
fail
(
result
);
that
.
error
(
result
);
},
},
secondLoadDocument
=
function
()
{
secondLoadDocument
=
function
()
{
var
newcommand
=
command
.
clone
();
var
newcommand
=
command
.
clone
();
newcommand
.
onResponseDo
(
function
(){});
newcommand
.
onErrorDo
(
loadOnError
);
newcommand
.
onFailDo
(
loadOnFail
);
newcommand
.
onSuccessDo
(
loadOnSuccess
);
newcommand
.
onDoneDo
(
loadOnDone
);
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
newcommand
);
newcommand
);
};
};
...
@@ -229,7 +227,7 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -229,7 +227,7 @@ var newIndexStorage = function ( spec, my ) {
file_array
=
priv
.
getFileArray
();
file_array
=
priv
.
getFileArray
();
for
(
i
=
0
,
l
=
file_array
.
length
;
i
<
l
;
i
+=
1
)
{
for
(
i
=
0
,
l
=
file_array
.
length
;
i
<
l
;
i
+=
1
)
{
if
(
file_array
[
i
].
name
===
command
.
getPath
())
{
if
(
file_array
[
i
].
name
===
command
.
getPath
())
{
return
that
.
done
(
file_array
[
i
]);
return
that
.
success
(
file_array
[
i
]);
}
}
}
}
}
else
{
}
else
{
...
@@ -251,12 +249,12 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -251,12 +249,12 @@ var newIndexStorage = function ( spec, my ) {
if
(
command
.
getOption
(
'
metadata_only
'
))
{
if
(
command
.
getOption
(
'
metadata_only
'
))
{
id
=
setInterval
(
function
()
{
id
=
setInterval
(
function
()
{
if
(
timeout
)
{
if
(
timeout
)
{
that
.
fail
({
status
:
0
,
statusText
:
'
Timeout
'
,
that
.
error
({
status
:
0
,
statusText
:
'
Timeout
'
,
message
:
'
The request has timed out.
'
});
message
:
'
The request has timed out.
'
});
clearInterval
(
id
);
clearInterval
(
id
);
}
}
if
(
priv
.
fileArrayExists
())
{
if
(
priv
.
fileArrayExists
())
{
that
.
done
(
priv
.
getFileArray
());
that
.
success
(
priv
.
getFileArray
());
clearInterval
(
id
);
clearInterval
(
id
);
}
}
},
100
);
},
100
);
...
@@ -265,11 +263,11 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -265,11 +263,11 @@ var newIndexStorage = function ( spec, my ) {
},
10000
);
// 10 sec
},
10000
);
// 10 sec
}
else
{
}
else
{
newcommand
=
command
.
clone
();
newcommand
=
command
.
clone
();
newcommand
.
on
Done
Do
(
function
(
result
)
{
newcommand
.
on
Success
Do
(
function
(
result
)
{
that
.
done
(
result
);
that
.
success
(
result
);
});
});
newcommand
.
on
Fail
Do
(
function
(
result
)
{
newcommand
.
on
Error
Do
(
function
(
result
)
{
that
.
fail
(
result
);
that
.
error
(
result
);
});
});
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
newcommand
);
newcommand
);
...
@@ -282,14 +280,13 @@ var newIndexStorage = function ( spec, my ) {
...
@@ -282,14 +280,13 @@ var newIndexStorage = function ( spec, my ) {
*/
*/
that
.
removeDocument
=
function
(
command
)
{
that
.
removeDocument
=
function
(
command
)
{
var
newcommand
=
command
.
clone
();
var
newcommand
=
command
.
clone
();
newcommand
.
onResponseDo
(
function
(){});
newcommand
.
onSuccessDo
(
function
(
result
)
{
newcommand
.
onDoneDo
(
function
(
result
)
{
priv
.
removeFile
(
command
.
getPath
());
priv
.
removeFile
(
command
.
getPath
());
priv
.
update
();
priv
.
update
();
that
.
done
();
that
.
success
();
});
});
newcommand
.
on
Fail
Do
(
function
(
result
)
{
newcommand
.
on
Error
Do
(
function
(
result
)
{
that
.
fail
(
result
);
that
.
error
(
result
);
});
});
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
that
.
addJob
(
that
.
newStorage
(
priv
.
secondstorage_spec
),
newcommand
);
newcommand
);
...
...
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