Commit ad4a0869 authored by Tristan Cavelier's avatar Tristan Cavelier Committed by Sebastien Robin

Improve Replicate storage

parent eb1e3767
......@@ -13,13 +13,16 @@
<script type="text/javascript" src="unhosted/base64.js"></script>
<script type="text/javascript" src="unhosted/jio.storage.js"></script>
<script type="text/javascript" >
var getXML = function (lol) {
var tmp = '';
$.ajax({url: lol,async:false,
dataType:'text',success:function(xml){tmp=xml}});
return tmp;
}
alert(getXML('responsexml/davlist'));
$.ajax ({
url: 'responsexml/davsave',
dataType: 'text',
success:function () {
console.log ('bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb');
}
});
for (var i = 0; i < 300; i++) {
console.log ('a');
}
</script>
</body>
</html>
......@@ -282,7 +282,8 @@
// Create a storage object and use it to save,load,...!
var t = this;
createStorageObject(
{'storage':job.storage,
{'queue':this,
'storage':job.storage,
'applicant':jioGlobalObj.applicant})[job.method](
job,function (endedjob){
t.ended(endedjob);
......
// Adds 3 storages for Jio
// type:
// - local
// - dav
// - replicate
;(function ( Jio ) {
// check dependencies
......@@ -698,4 +703,52 @@
// end DAVStorage
////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////
// ReplicateStorage
var ReplicateStorage = function ( options ) {
this.queue = options.queue;
this.id = null;
this.length = options.storage.list.length;
this.returnsValuesArray = [];
};
ReplicateStorage.prototype = {
checkNameAvailability: function ( job, jobendcallback ) {
var t = this;
for (var i in job.storage.list) {
var newjob = $.extend({},job);
newjob.storage = job.storage.list[i];
newjob.callback = function (result){
t.returnsValuesArray.push(result);
};
this.queue.addJob( newjob );
}
//// callback listener
this.id = setInterval(function() {
if (t.returnsValuesArray.length >= t.length) {
var res = {};
// TODO
jobendcallback(job);
job.callback(res);
clearInterval(t.id);
}
},100);
//// end call back listener
},
saveDocument: function ( job, jobendcallback ) {
},
loadDocument: function ( job, jobendcallback ) {
},
getDocumentList: function ( job, jobendcallback ) {
},
removeDocument: function ( job, jobendcallback ) {
}
};
// add key to storageObject
Jio.addStorageType('replicate', function (options) {
return new ReplicateStorage(options);
});
// end ReplicateStorage
////////////////////////////////////////////////////////////////////////////
})( JIO );
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment