experimenting with 'reserved uids'
This commit is contained in:
parent
efc4e502cf
commit
9e1d9e568f
@ -73,7 +73,7 @@ module.exports = (grunt) ->
|
||||
browserify:
|
||||
dest:
|
||||
files:
|
||||
'dest/browser/Yatta_test.js': ['test/**/*.coffee']
|
||||
'dest/browser/test/Yatta_test.js': ['test/**/*.coffee']
|
||||
options:
|
||||
transform: ['coffeeify']
|
||||
debug: true
|
||||
@ -128,7 +128,7 @@ module.exports = (grunt) ->
|
||||
grunt.loadNpmTasks "grunt-coffeelint"
|
||||
grunt.loadNpmTasks "grunt-codo"
|
||||
|
||||
grunt.registerTask "build", ["coffeelint", "codo", "test"]
|
||||
grunt.registerTask "build", ["coffeelint", "codo", "browserify", "test"]
|
||||
grunt.registerTask "production", ["test", "coffee","coffeelint", "literate", "browserify", "uglify", "codo"]
|
||||
grunt.registerTask "default", ["build", "watch"]
|
||||
grunt.registerTask "production", ["coffee"]
|
||||
|
21
README.md
21
README.md
@ -3,7 +3,7 @@
|
||||
|
||||
A real-time web framework that manages concurrency control for arbitrary data structures and is _not_ based on Operational Transformation.
|
||||
Yatta! provides similar functionality as [ShareJs](https://github.com/share/ShareJS) and [OpenCoweb](https://github.com/opencoweb/coweb)
|
||||
but does not require you to understand how the internals work. The predefined data structures provide a simple API to access your shared data types.
|
||||
but does not require you to understand how the internals work. The predefined data structures provide a simple API to access your shared data structures.
|
||||
|
||||
Predefined data structures:
|
||||
* Text
|
||||
@ -13,26 +13,27 @@ Predefined data structures:
|
||||
Unlike other frameworks, Yatta! supports P2P message propagation and is not bound to a specific communication protocol.
|
||||
|
||||
Currently supported communication protocols:
|
||||
* [IWC](dbis.rwth-aachen.de/gadgets/iwc/resources/iwc.manual.pdf) - Inter-widget Communication
|
||||
* [IWC](http://dbis.rwth-aachen.de/gadgets/iwc/resources/iwc.manual.pdf) - Inter-widget Communication
|
||||
|
||||
# About
|
||||
Find out more about the concurrent editing problem here
|
||||
([Cooperation, Concurrency, Conflicts, and Convergence](http://opencoweb.org/ocwdocs/intro/openg.html)) and here
|
||||
([Operational Transformation (OT)](http://en.wikipedia.org/wiki/Operational_transformation))
|
||||
[Cooperation, Concurrency, Conflicts, and Convergence](http://opencoweb.org/ocwdocs/intro/openg.html) and here
|
||||
[Operational Transformation (OT)](http://en.wikipedia.org/wiki/Operational_transformation)
|
||||
|
||||
My Bachelor Thesis project aim was to develop a P2P OT Framework that enables collaboration on XML documents and supports
|
||||
[Intention Preservation](http://www3.ntu.edu.sg/home/czsun/projects/otfaq/#intentionPreservation).
|
||||
After some time I realized that OT has significant drawbacks in P2P environments.
|
||||
|
||||
With my gained experiences I came up with a new approach. I named it Yata - Yet Another Transformation Approach.
|
||||
Very surprising is that my approach enables concurrent editing with the following space and time properties:
|
||||
It enables concurrent editing with the following space and time properties:
|
||||
* Time complexity: O(S), whereby S is the number of operations that are inserted concurrently at the same position. This means that my approach does not transform against operations that happen on other positions.
|
||||
* Space complexity = O(|Document|), whereby |Document| is the size of shared document. Depending on the used data structure, Yata may needs 4*|Document| of space.
|
||||
* Space complexity = O(|Document|), whereby |Document| is the size of the shared document. Depending on the used data structure, Yata may needs 4*|Document| of space.
|
||||
|
||||
This means that my approach beats all OT time complexities. Furthermore, it is possible to make a very strict definition of Intention Preservation, and I was able to
|
||||
show that it is never violated.
|
||||
|
||||
Another advantage of my approach is that propagated messages are very small.
|
||||
Background: In Real-Time P2P OT algorithms you have to send a state-vector with every message that defines the state of the History Buffer
|
||||
Background: In real-time P2P OT algorithms you have to send a state-vector with every message that defines the state of the History Buffer
|
||||
on which the operation was created. This is not necessary in Yata.
|
||||
|
||||
One downside is that the History Buffer holds at least as many operations as there are characters in the document.
|
||||
@ -42,6 +43,7 @@ So, how did I come up with the name for the implementation (Yatta! is not Yata)?
|
||||

|
||||
Yatta! means "I did it!" in Japanese. You scream it when you accomplish something (for proper application I refer to the Yatta-man in [Heroes](http://heroeswiki.com/Yatta!)).
|
||||
There is also this awesome video on the Internet that will change your life [Yatta](https://www.youtube.com/watch?v=kL5DDSglM_s).
|
||||
|
||||
# Status
|
||||
Yatta! is still in an early development phase.
|
||||
|
||||
@ -50,3 +52,8 @@ Please report any issues to the [Github issue page](https://github.com/DadaMonad
|
||||
|
||||
# License
|
||||
Yatta! is licensed under the [MIT License](./LICENSE.txt).
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -146,23 +146,25 @@ Engine = (function() {
|
||||
};
|
||||
|
||||
Engine.prototype.applyOps = function(ops_json) {
|
||||
var o, ops, _i, _j, _k, _len, _len1, _len2;
|
||||
ops = [];
|
||||
var o, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
|
||||
o = ops_json[_i];
|
||||
ops.push(this.parseOperation(o));
|
||||
_results.push(this.applyOp(o));
|
||||
}
|
||||
for (_j = 0, _len1 = ops.length; _j < _len1; _j++) {
|
||||
o = ops[_j];
|
||||
this.HB.addOperation(o);
|
||||
}
|
||||
for (_k = 0, _len2 = ops.length; _k < _len2; _k++) {
|
||||
o = ops[_k];
|
||||
if (!o.execute()) {
|
||||
this.unprocessed_ops.push(o);
|
||||
}
|
||||
}
|
||||
return this.tryUnprocessed();
|
||||
return _results;
|
||||
|
||||
/*
|
||||
ops = []
|
||||
for o in ops_json
|
||||
ops.push @parseOperation o
|
||||
for o in ops
|
||||
@HB.addOperation o
|
||||
for o in ops
|
||||
if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()
|
||||
*/
|
||||
};
|
||||
|
||||
Engine.prototype.applyOp = function(op_json) {
|
||||
@ -216,20 +218,14 @@ Engine = require("../Engine.coffee");
|
||||
|
||||
JsonYatta = (function() {
|
||||
function JsonYatta(user_id, Connector) {
|
||||
var first_word, json_types, root_elem;
|
||||
var first_word, json_types;
|
||||
this.HB = new HistoryBuffer(user_id);
|
||||
json_types = json_types_uninitialized(this.HB);
|
||||
this.engine = new Engine(this.HB, json_types.parser);
|
||||
this.connector = new Connector(this.engine, this.HB, json_types.execution_listener, this);
|
||||
root_elem = this.connector.getRootElement();
|
||||
if (root_elem == null) {
|
||||
first_word = new json_types.types.JsonType(this.HB.getNextOperationIdentifier());
|
||||
this.HB.addOperation(first_word);
|
||||
first_word.execute();
|
||||
this.root_element = first_word;
|
||||
} else {
|
||||
this.root_element = this.HB.getOperation(root_elem);
|
||||
}
|
||||
first_word = new json_types.types.JsonType(this.HB.getReservedUniqueIdentifier());
|
||||
this.HB.addOperation(first_word).execute();
|
||||
this.root_element = first_word;
|
||||
}
|
||||
|
||||
JsonYatta.prototype.getRootElement = function() {
|
||||
@ -305,6 +301,13 @@ HistoryBuffer = (function() {
|
||||
return this.user_id;
|
||||
};
|
||||
|
||||
HistoryBuffer.prototype.getReservedUniqueIdentifier = function() {
|
||||
return {
|
||||
creator: '_',
|
||||
op_number: '_'
|
||||
};
|
||||
};
|
||||
|
||||
HistoryBuffer.prototype.getOperationCounter = function() {
|
||||
var ctn, res, user, _ref;
|
||||
res = {};
|
||||
@ -608,7 +611,7 @@ module.exports = function(HB) {
|
||||
__extends(ImmutableObject, _super);
|
||||
|
||||
function ImmutableObject(uid, content, prev, next, origin) {
|
||||
this.content = content != null ? content : "";
|
||||
this.content = content;
|
||||
ImmutableObject.__super__.constructor.call(this, uid, prev, next, origin);
|
||||
}
|
||||
|
||||
@ -810,10 +813,11 @@ module.exports = function(HB) {
|
||||
return JsonType.__super__.val.call(this, name, obj);
|
||||
} else {
|
||||
if (typeof content === 'string') {
|
||||
word = HB.addOperation(new types.Word(HB.getNextOperationIdentifier(), content)).execute();
|
||||
word = HB.addOperation(new types.Word(void 0)).execute();
|
||||
word.insertText(0, content);
|
||||
return JsonType.__super__.val.call(this, name, word);
|
||||
} else if (content.constructor === Object) {
|
||||
json = HB.addOperation(new JsonType(HB.getNextOperationIdentifier(), content, mutable)).execute();
|
||||
json = HB.addOperation(new JsonType(void 0, content, mutable)).execute();
|
||||
return JsonType.__super__.val.call(this, name, json);
|
||||
} else {
|
||||
throw new Error("You must not set " + (typeof content) + "-types in collaborative Json-objects!");
|
||||
@ -887,7 +891,7 @@ module.exports = function(HB) {
|
||||
var o, obj, result, _ref, _ref1;
|
||||
if (content != null) {
|
||||
if (this.map[name] == null) {
|
||||
HB.addOperation(new AddName(HB.getNextOperationIdentifier(), this, name)).execute();
|
||||
HB.addOperation(new AddName(void 0, this, name)).execute();
|
||||
}
|
||||
this.map[name].replace(content);
|
||||
return this;
|
||||
@ -971,8 +975,8 @@ module.exports = function(HB) {
|
||||
this.saveOperation('beginning', beginning);
|
||||
this.saveOperation('end', end);
|
||||
} else {
|
||||
this.beginning = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), void 0, void 0));
|
||||
this.end = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), this.beginning, void 0));
|
||||
this.beginning = HB.addOperation(new types.Delimiter(void 0, void 0, void 0));
|
||||
this.end = HB.addOperation(new types.Delimiter(void 0, this.beginning, void 0));
|
||||
this.beginning.next_cl = this.end;
|
||||
this.beginning.execute();
|
||||
this.end.execute();
|
||||
@ -1035,7 +1039,7 @@ module.exports = function(HB) {
|
||||
ReplaceManager.prototype.replace = function(content) {
|
||||
var o, op;
|
||||
o = this.getLastOperation();
|
||||
op = new Replaceable(content, this, HB.getNextOperationIdentifier(), o, o.next_cl);
|
||||
op = new Replaceable(content, this, void 0, o, o.next_cl);
|
||||
return HB.addOperation(op).execute();
|
||||
};
|
||||
|
||||
@ -1215,11 +1219,8 @@ module.exports = function(HB) {
|
||||
Word = (function(_super) {
|
||||
__extends(Word, _super);
|
||||
|
||||
function Word(uid, initial_content, beginning, end, prev, next, origin) {
|
||||
function Word(uid, beginning, end, prev, next, origin) {
|
||||
Word.__super__.constructor.call(this, uid, beginning, end, prev, next, origin);
|
||||
if (initial_content != null) {
|
||||
this.insertText(0, initial_content);
|
||||
}
|
||||
}
|
||||
|
||||
Word.prototype.insertText = function(position, content) {
|
||||
@ -1228,7 +1229,7 @@ module.exports = function(HB) {
|
||||
_results = [];
|
||||
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
||||
c = content[_i];
|
||||
op = new TextInsert(c, HB.getNextOperationIdentifier(), o.prev_cl, o);
|
||||
op = new TextInsert(c, void 0, o.prev_cl, o);
|
||||
_results.push(HB.addOperation(op).execute());
|
||||
}
|
||||
return _results;
|
||||
@ -1313,7 +1314,7 @@ module.exports = function(HB) {
|
||||
parser['Word'] = function(json) {
|
||||
var beginning, end, next, origin, prev, uid;
|
||||
uid = json['uid'], beginning = json['beginning'], end = json['end'], prev = json['prev'], next = json['next'], origin = json['origin'];
|
||||
return new Word(uid, void 0, beginning, end, prev, next, origin);
|
||||
return new Word(uid, beginning, end, prev, next, origin);
|
||||
};
|
||||
types['TextInsert'] = TextInsert;
|
||||
types['TextDelete'] = TextDelete;
|
||||
|
File diff suppressed because one or more lines are too long
71
dest/browser/Yatta_test.min.js
vendored
71
dest/browser/Yatta_test.min.js
vendored
File diff suppressed because one or more lines are too long
@ -2,11 +2,11 @@
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test GOTOjs</title>
|
||||
<link rel="stylesheet" href="../../node_modules/mocha/mocha.css" />
|
||||
<link rel="stylesheet" href="../../../node_modules/mocha/mocha.css" />
|
||||
</head>
|
||||
<body>
|
||||
<div id="mocha"></div>
|
||||
<script src="../../node_modules/mocha/mocha.js"></script>
|
||||
<script src="../../../node_modules/mocha/mocha.js"></script>
|
||||
<script>mocha.setup('bdd')</script>
|
||||
<script src="Yatta_test.js"></script>
|
||||
<script>
|
@ -57,10 +57,10 @@ module.exports = function(user_list) {
|
||||
|
||||
TestConnector.prototype.receive = function(o) {
|
||||
var _base, _name;
|
||||
if ((_base = this.unexecuted)[_name = o.creator] == null) {
|
||||
if ((_base = this.unexecuted)[_name = o.uid.creator] == null) {
|
||||
_base[_name] = [];
|
||||
}
|
||||
return this.unexecuted[o.creator].push(o);
|
||||
return this.unexecuted[o.uid.creator].push(o);
|
||||
};
|
||||
|
||||
TestConnector.prototype.flushOne = function(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A,MAAA;kCAAA;WADF;AAAA;wBADF;OADI;IAAA,CArBN,CAAA;;AAAA,4BA2BA,OAAA,GAAS,SAAC,CAAD,GAAA;AACP,UAAA,YAAA;;uBAA8B;OAA9B;aACA,IAAC,CAAA,UAAW,CAAA,CAAC,CAAC,GAAG,CAAC,OAAN,CAAc,CAAC,IAA3B,CAAgC,CAAhC,EAFO;IAAA,CA3BT,CAAA;;AAAA,4BA+BA,QAAA,GAAU,SAAC,IAAD,GAAA;AACR,UAAA,IAAA;AAAA,MAAA,kDAAoB,CAAE,gBAAnB,GAA4B,CAA/B;eACE,IAAC,CAAA,MAAM,CAAC,OAAR,CAAgB,IAAC,CAAA,UAAW,CAAA,IAAA,CAAK,CAAC,KAAlB,CAAA,CAAhB,EADF;OADQ;IAAA,CA/BV,CAAA;;AAAA,4BAmCA,cAAA,GAAgB,SAAA,GAAA;aACd,IAAC,CAAA,QAAD,CAAW,CAAC,CAAC,MAAF,CAAS,CAAT,EAAa,SAAS,CAAC,MAAV,GAAiB,CAA9B,CAAX,EADc;IAAA,CAnChB,CAAA;;AAAA,4BAsCA,QAAA,GAAU,SAAA,GAAA;AACR,UAAA,YAAA;AAAA;AAAA,WAAA,SAAA;sBAAA;AACE,QAAA,IAAC,CAAA,MAAM,CAAC,QAAR,CAAiB,GAAjB,CAAA,CADF;AAAA,OAAA;aAEA,IAAC,CAAA,UAAD,GAAc,GAHN;IAAA,CAtCV,CAAA;;AAAA,4BA0CA,IAAA,GAAM,SAAA,GAAA;AACJ,YAAU,IAAA,KAAA,CAAM,uBAAN,CAAV,CADI;IAAA,CA1CN,CAAA;;yBAAA;;OANa;AAAA,CAFjB,CAAA"
|
||||
}
|
@ -18,23 +18,25 @@ Engine = (function() {
|
||||
};
|
||||
|
||||
Engine.prototype.applyOps = function(ops_json) {
|
||||
var o, ops, _i, _j, _k, _len, _len1, _len2;
|
||||
ops = [];
|
||||
var o, _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = ops_json.length; _i < _len; _i++) {
|
||||
o = ops_json[_i];
|
||||
ops.push(this.parseOperation(o));
|
||||
_results.push(this.applyOp(o));
|
||||
}
|
||||
for (_j = 0, _len1 = ops.length; _j < _len1; _j++) {
|
||||
o = ops[_j];
|
||||
this.HB.addOperation(o);
|
||||
}
|
||||
for (_k = 0, _len2 = ops.length; _k < _len2; _k++) {
|
||||
o = ops[_k];
|
||||
if (!o.execute()) {
|
||||
this.unprocessed_ops.push(o);
|
||||
}
|
||||
}
|
||||
return this.tryUnprocessed();
|
||||
return _results;
|
||||
|
||||
/*
|
||||
ops = []
|
||||
for o in ops_json
|
||||
ops.push @parseOperation o
|
||||
for o in ops
|
||||
@HB.addOperation o
|
||||
for o in ops
|
||||
if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()
|
||||
*/
|
||||
};
|
||||
|
||||
Engine.prototype.applyOp = function(op_json) {
|
||||
|
@ -6,5 +6,5 @@
|
||||
"Engine.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAIA,IAAA,MAAA;;AAAA;AACe,EAAA,gBAAE,EAAF,EAAO,MAAP,GAAA;AACX,IADY,IAAC,CAAA,KAAA,EACb,CAAA;AAAA,IADiB,IAAC,CAAA,SAAA,MAClB,CAAA;AAAA,IAAA,IAAC,CAAA,eAAD,GAAmB,EAAnB,CADW;EAAA,CAAb;;AAAA,mBAGA,cAAA,GAAgB,SAAC,IAAD,GAAA;AACd,QAAA,UAAA;AAAA,IAAA,UAAA,GAAa,IAAC,CAAA,MAAO,CAAA,IAAI,CAAC,IAAL,CAArB,CAAA;AACA,IAAA,IAAG,kBAAH;aACE,UAAA,CAAW,IAAX,EADF;KAAA,MAAA;AAGE,YAAU,IAAA,KAAA,CAAO,0CAAA,GAAyC,IAAI,CAAC,IAA9C,GAAoD,mBAApD,GAAsE,CAAA,IAAI,CAAC,SAAL,CAAe,IAAf,CAAA,CAAtE,GAA2F,GAAlG,CAAV,CAHF;KAFc;EAAA,CAHhB,C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CAAA;AAAA,IACA,IAAC,CAAA,EAAE,CAAC,YAAJ,CAAiB,CAAjB,CADA,CAAA;AAEA,IAAA,IAAG,CAAA,CAAK,CAAC,OAAF,CAAA,CAAP;AACE,MAAA,IAAC,CAAA,eAAe,CAAC,IAAjB,CAAsB,CAAtB,CAAA,CADF;KAFA;WAIA,IAAC,CAAA,cAAD,CAAA,EANO;EAAA,CAxBT,CAAA;;AAAA,mBAgCA,cAAA,GAAgB,SAAA,GAAA;AACd,QAAA,qDAAA;AAAA;WAAM,IAAN,GAAA;AACE,MAAA,UAAA,GAAa,IAAC,CAAA,eAAe,CAAC,MAA9B,CAAA;AAAA,MACA,WAAA,GAAc,EADd,CAAA;AAEA;AAAA,WAAA,2CAAA;sBAAA;AACE,QAAA,IAAG,CAAA,EAAM,CAAC,OAAH,CAAA,CAAP;AACE,UAAA,WAAW,CAAC,IAAZ,CAAiB,EAAjB,CAAA,CADF;SADF;AAAA,OAFA;AAAA,MAKA,IAAC,CAAA,eAAD,GAAmB,WALnB,CAAA;AAMA,MAAA,IAAG,IAAC,CAAA,eAAe,CAAC,MAAjB,KAA2B,UAA9B;AACE,cADF;OAAA,MAAA;8BAAA;OAPF;IAAA,CAAA;oBADc;EAAA,CAhChB,CAAA;;gBAAA;;IADF,CAAA;;AAAA,MA+CM,CAAC,OAAP,GAAiB,MA/CjB,CAAA"
|
||||
}
|
@ -8,20 +8,14 @@ Engine = require("../Engine.coffee");
|
||||
|
||||
JsonYatta = (function() {
|
||||
function JsonYatta(user_id, Connector) {
|
||||
var first_word, json_types, root_elem;
|
||||
var first_word, json_types;
|
||||
this.HB = new HistoryBuffer(user_id);
|
||||
json_types = json_types_uninitialized(this.HB);
|
||||
this.engine = new Engine(this.HB, json_types.parser);
|
||||
this.connector = new Connector(this.engine, this.HB, json_types.execution_listener, this);
|
||||
root_elem = this.connector.getRootElement();
|
||||
if (root_elem == null) {
|
||||
first_word = new json_types.types.JsonType(this.HB.getNextOperationIdentifier());
|
||||
this.HB.addOperation(first_word);
|
||||
first_word.execute();
|
||||
this.root_element = first_word;
|
||||
} else {
|
||||
this.root_element = this.HB.getOperation(root_elem);
|
||||
}
|
||||
first_word = new json_types.types.JsonType(this.HB.getReservedUniqueIdentifier());
|
||||
this.HB.addOperation(first_word).execute();
|
||||
this.root_element = first_word;
|
||||
}
|
||||
|
||||
JsonYatta.prototype.getRootElement = function() {
|
||||
|
@ -6,5 +6,5 @@
|
||||
"JsonYatta.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AACA,IAAA,0DAAA;;AAAA,wBAAA,GAA2B,OAAA,CAAQ,2BAAR,CAA3B,CAAA;;AAAA,aACA,GAAgB,OAAA,CAAQ,yBAAR,CADhB,CAAA;;AAAA,MAEA,GAAS,OAAA,CAAQ,kBAAR,CAFT,CAAA;;AAAA;AAYe,EAAA,mBAAC,OAAD,EAAU,SAAV,GAAA;AACX,QAAA,iCAAA;AAAA,IAAA,IAAC,CAAA,EAAD,GAAU,IAAA,aAAA,CAAc,OAAd,CAAV,CAAA;AAAA,IACA,UAAA,GAAa,wBAAA,CAAyB,IAAC,CAAA,EAA1B,CADb,CAAA;AAAA,IAEA,IAAC,CAAA,MAAD,GAAc,IAAA,MAAA,CAAO,IAAC,CAAA,EAAR,EAAY,UAAU,CAAC,MAAvB,CAFd,CAAA;AAAA,IAGA,IAAC,CAAA,SAAD,GAAiB,IAAA,SAAA,CAAU,IAAC,CAAA,MAAX,EAAmB,IAAC,CAAA,EAApB,EAAwB,UAAU,CAAC,kBAAnC,EAAuD,IAAvD,CAHjB,CAAA;AAAA,IAIA,SAAA,GAAY,IAAC,CAAA,SAAS,CAAC,cAAX,CAAA,CAJZ,CAAA;AAKA,IAAA,IAAO,iBAAP;AACE,MAAA,UAAA,GAAiB,IAAA,UAAU,CAAC,KAAK,CAAC,QAAjB,CAA0B,IAAC,CAAA,EAAE,CAAC,0BAAJ,CAAA,CAA1B,CAAjB,CAAA;AAAA,MACA,IAAC,CAAA,EAAE,CAA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A;AAIE,cAAU,IAAA,KAAA,CAAM,kCAAN,CAAV,CAJF;OADI;IAAA,CADN;GADF,CA1DA,CAAA;;mBAAA;;IAZF,CAAA;;;EA8EA,MAAM,CAAE,SAAR,GAAoB;CA9EpB;;AAAA,MA+EM,CAAC,OAAP,GAAiB,SA/EjB,CAAA"
|
||||
}
|
@ -12,6 +12,13 @@ HistoryBuffer = (function() {
|
||||
return this.user_id;
|
||||
};
|
||||
|
||||
HistoryBuffer.prototype.getReservedUniqueIdentifier = function() {
|
||||
return {
|
||||
creator: '_',
|
||||
op_number: '_'
|
||||
};
|
||||
};
|
||||
|
||||
HistoryBuffer.prototype.getOperationCounter = function() {
|
||||
var ctn, res, user, _ref;
|
||||
res = {};
|
||||
|
@ -6,5 +6,5 @@
|
||||
"HistoryBuffer.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAMA,IAAA,aAAA;;AAAA;AAMe,EAAA,uBAAE,OAAF,GAAA;AACX,IADY,IAAC,CAAA,UAAA,OACb,CAAA;AAAA,IAAA,IAAC,CAAA,iBAAD,GAAqB,EAArB,CAAA;AAAA,IACA,IAAC,CAAA,MAAD,GAAU,EADV,CAAA;AAAA,IAEA,IAAC,CAAA,gBAAD,GAAoB,EAFpB,CADW;EAAA,CAAb;;AAAA,0BAQA,SAAA,GAAW,SAAA,GAAA;WACT,IAAC,CAAA,QADQ;EAAA,CARX,CAAA;;AAAA,0BAcA,mBAAA,GAAqB,SAAA,GAAA;AACnB,QAAA,oBAAA;AAAA,IAAA,GAAA,GAAM,EAAN,CAAA;AACA;AAAA,SAAA,YAAA;uBAAA;AACE,MAAA,GAAI,CAAA,IAAA,CAAJ,GAAY,GAAZ,CADF;AAAA,KADA;WAGA,IAJmB;EAAA,CAdrB,CAAA;;AAAA,0BAoBA,OAAA,GAAS,SAAA,GAAA;AACP,QAAA,qCAAA;AAAA,IAAA,IAAA,GAAO,EAAP,CAAA;AACA;AAAA,SAAA,cAAA;0BAAA;AACE,WAAA,gBA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OAAF,CAAnB,GAAgC,CAAhC,CADF;KAFA;AAMA,IAAA,IAAG,2CAAH;AACE,YAAU,IAAA,KAAA,CAAM,oCAAN,CAAV,CADF;KANA;AAAA,IAQA,IAAC,CAAA,MAAO,CAAA,CAAC,CAAC,OAAF,CAAW,CAAA,CAAC,CAAC,SAAF,CAAnB,GAAkC,CARlC,CAAA;AASA,IAAA,IAAG,MAAA,CAAA,CAAQ,CAAC,SAAT,KAAsB,QAAtB,IAAmC,CAAC,CAAC,OAAF,KAAe,IAAC,CAAA,SAAD,CAAA,CAArD;AACE,MAAA,IAAC,CAAA,iBAAkB,CAAA,CAAC,CAAC,OAAF,CAAnB,EAAA,CADF;KATA;WAWA,EAZY;EAAA,CAnEd,CAAA;;uBAAA;;IANF,CAAA;;AAAA,MAuFM,CAAC,OAAP,GAAiB,aAvFjB,CAAA"
|
||||
}
|
@ -222,7 +222,7 @@ module.exports = function(HB) {
|
||||
__extends(ImmutableObject, _super);
|
||||
|
||||
function ImmutableObject(uid, content, prev, next, origin) {
|
||||
this.content = content != null ? content : "";
|
||||
this.content = content;
|
||||
ImmutableObject.__super__.constructor.call(this, uid, prev, next, origin);
|
||||
}
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -112,10 +112,11 @@ module.exports = function(HB) {
|
||||
return JsonType.__super__.val.call(this, name, obj);
|
||||
} else {
|
||||
if (typeof content === 'string') {
|
||||
word = HB.addOperation(new types.Word(HB.getNextOperationIdentifier(), content)).execute();
|
||||
word = HB.addOperation(new types.Word(void 0)).execute();
|
||||
word.insertText(0, content);
|
||||
return JsonType.__super__.val.call(this, name, word);
|
||||
} else if (content.constructor === Object) {
|
||||
json = HB.addOperation(new JsonType(HB.getNextOperationIdentifier(), content, mutable)).execute();
|
||||
json = HB.addOperation(new JsonType(void 0, content, mutable)).execute();
|
||||
return JsonType.__super__.val.call(this, name, json);
|
||||
} else {
|
||||
throw new Error("You must not set " + (typeof content) + "-types in collaborative Json-objects!");
|
||||
|
@ -6,5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A,UAAA,CAAP,GAAqB,SAAC,IAAD,GAAA;AACnB,QAAA,GAAA;AAAA,IACU,MACN,KADF,MADF,CAAA;WAGI,IAAA,QAAA,CAAS,GAAT,EAJe;EAAA,CAvLrB,CAAA;AAAA,EAgMA,KAAM,CAAA,UAAA,CAAN,GAAoB,QAhMpB,CAAA;SAkMA,WAnMe;AAAA,CAFjB,CAAA"
|
||||
}
|
@ -21,7 +21,7 @@ module.exports = function(HB) {
|
||||
var o, obj, result, _ref, _ref1;
|
||||
if (content != null) {
|
||||
if (this.map[name] == null) {
|
||||
HB.addOperation(new AddName(HB.getNextOperationIdentifier(), this, name)).execute();
|
||||
HB.addOperation(new AddName(void 0, this, name)).execute();
|
||||
}
|
||||
this.map[name].replace(content);
|
||||
return this;
|
||||
@ -105,8 +105,8 @@ module.exports = function(HB) {
|
||||
this.saveOperation('beginning', beginning);
|
||||
this.saveOperation('end', end);
|
||||
} else {
|
||||
this.beginning = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), void 0, void 0));
|
||||
this.end = HB.addOperation(new types.Delimiter(HB.getNextOperationIdentifier(), this.beginning, void 0));
|
||||
this.beginning = HB.addOperation(new types.Delimiter(void 0, void 0, void 0));
|
||||
this.end = HB.addOperation(new types.Delimiter(void 0, this.beginning, void 0));
|
||||
this.beginning.next_cl = this.end;
|
||||
this.beginning.execute();
|
||||
this.end.execute();
|
||||
@ -169,7 +169,7 @@ module.exports = function(HB) {
|
||||
ReplaceManager.prototype.replace = function(content) {
|
||||
var o, op;
|
||||
o = this.getLastOperation();
|
||||
op = new Replaceable(content, this, HB.getNextOperationIdentifier(), o, o.next_cl);
|
||||
op = new Replaceable(content, this, void 0, o, o.next_cl);
|
||||
return HB.addOperation(op).execute();
|
||||
};
|
||||
|
||||
|
File diff suppressed because one or more lines are too long
@ -73,11 +73,8 @@ module.exports = function(HB) {
|
||||
Word = (function(_super) {
|
||||
__extends(Word, _super);
|
||||
|
||||
function Word(uid, initial_content, beginning, end, prev, next, origin) {
|
||||
function Word(uid, beginning, end, prev, next, origin) {
|
||||
Word.__super__.constructor.call(this, uid, beginning, end, prev, next, origin);
|
||||
if (initial_content != null) {
|
||||
this.insertText(0, initial_content);
|
||||
}
|
||||
}
|
||||
|
||||
Word.prototype.insertText = function(position, content) {
|
||||
@ -86,7 +83,7 @@ module.exports = function(HB) {
|
||||
_results = [];
|
||||
for (_i = 0, _len = content.length; _i < _len; _i++) {
|
||||
c = content[_i];
|
||||
op = new TextInsert(c, HB.getNextOperationIdentifier(), o.prev_cl, o);
|
||||
op = new TextInsert(c, void 0, o.prev_cl, o);
|
||||
_results.push(HB.addOperation(op).execute());
|
||||
}
|
||||
return _results;
|
||||
@ -171,7 +168,7 @@ module.exports = function(HB) {
|
||||
parser['Word'] = function(json) {
|
||||
var beginning, end, next, origin, prev, uid;
|
||||
uid = json['uid'], beginning = json['beginning'], end = json['end'], prev = json['prev'], next = json['next'], origin = json['origin'];
|
||||
return new Word(uid, void 0, beginning, end, prev, next, origin);
|
||||
return new Word(uid, beginning, end, prev, next, origin);
|
||||
};
|
||||
types['TextInsert'] = TextInsert;
|
||||
types['TextDelete'] = TextDelete;
|
||||
|
@ -6,5 +6,5 @@
|
||||
"TextTypes.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AAAA,IAAA,8BAAA;EAAA;iSAAA;;AAAA,8BAAA,GAAiC,OAAA,CAAQ,0BAAR,CAAjC,CAAA;;AAAA,MAEM,CAAC,OAAP,GAAiB,SAAC,EAAD,GAAA;AACf,MAAA,6DAAA;AAAA,EAAA,gBAAA,GAAmB,8BAAA,CAA+B,EAA/B,CAAnB,CAAA;AAAA,EACA,KAAA,GAAQ,gBAAgB,CAAC,KADzB,CAAA;AAAA,EAEA,MAAA,GAAS,gBAAgB,CAAC,MAF1B,CAAA;AAAA,EAQM;AAAN,iCAAA,CAAA;;;;KAAA;;sBAAA;;KAAyB,KAAK,CAAC,OAR/B,CAAA;AAAA,EASA,MAAO,CAAA,YAAA,C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AG,oBAAH;AACE,QAAA,IAAK,CAAA,MAAA,CAAL,GAAe,IAAC,CAAA,OAAO,CAAC,MAAT,CAAA,CAAf,CADF;OANA;AAQA,MAAA,IAAG,oBAAH;AACE,QAAA,IAAK,CAAA,MAAA,CAAL,GAAe,IAAC,CAAA,OAAO,CAAC,MAAT,CAAA,CAAf,CADF;OARA;AAUA,MAAA,IAAG,qBAAA,IAAa,IAAC,CAAA,MAAD,KAAa,IAAC,CAAA,OAA9B;AACE,QAAA,IAAK,CAAA,QAAA,CAAL,GAAiB,IAAC,CAAA,MAAM,CAAC,MAAR,CAAA,CAAjB,CADF;OAVA;aAYA,KAbO;IAAA,CA7DT,CAAA;;gBAAA;;KALiB,KAAK,CAAC,YAzEzB,CAAA;AAAA,EA0JA,MAAO,CAAA,MAAA,CAAP,GAAiB,SAAC,IAAD,GAAA;AACf,QAAA,uCAAA;AAAA,IACU,WAAR,MADF,EAEgB,iBAAd,YAFF,EAGU,WAAR,MAHF,EAIU,YAAR,OAJF,EAKU,YAAR,OALF,EAMa,cAAX,SANF,CAAA;WAQI,IAAA,IAAA,CAAK,GAAL,EAAU,SAAV,EAAqB,GAArB,EAA0B,IAA1B,EAAgC,IAAhC,EAAsC,MAAtC,EATW;EAAA,CA1JjB,CAAA;AAAA,EAqKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UArKtB,CAAA;AAAA,EAsKA,KAAM,CAAA,YAAA,CAAN,GAAsB,UAtKtB,CAAA;AAAA,EAuKA,KAAM,CAAA,MAAA,CAAN,GAAgB,IAvKhB,CAAA;SAwKA,iBAzKe;AAAA,CAFjB,CAAA"
|
||||
}
|
@ -6,5 +6,5 @@
|
||||
"XmlTypes.coffee"
|
||||
],
|
||||
"names": [],
|
||||
"mappings": "AA6KkB"
|
||||
"mappings": "AA2KkB"
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
(function() {
|
||||
var Connector_uninitialized, Yatta, chai, expect, should, sinon, sinonChai, _;
|
||||
|
||||
chai = require('chai');
|
||||
|
||||
expect = chai.expect;
|
||||
|
||||
should = chai.should();
|
||||
|
||||
sinon = require('sinon');
|
||||
|
||||
sinonChai = require('sinon-chai');
|
||||
|
||||
_ = require("underscore");
|
||||
|
||||
chai.use(sinonChai);
|
||||
|
||||
Yatta = require("../lib/Frameworks/JsonYatta.coffee");
|
||||
|
||||
Connector_uninitialized = require("../lib/Connectors/TestConnector.coffee");
|
||||
|
||||
|
||||
/*
|
||||
describe "JsonYatta", ->
|
||||
beforeEach (done)->
|
||||
@last_user = 10
|
||||
@users = []
|
||||
@Connector = Connector_uninitialized @users
|
||||
for i in [0..(@last_user+1)]
|
||||
@users.push(new Yatta i, @Connector)
|
||||
|
||||
|
||||
done()
|
||||
|
||||
it "can handle many engines, many operations, concurrently (random)", ->
|
||||
number_of_test_cases_multiplier = 1
|
||||
repeat_this = 100 * number_of_test_cases_multiplier
|
||||
doSomething_amount = 200 * number_of_test_cases_multiplier
|
||||
number_of_engines = 12 + number_of_test_cases_multiplier - 1
|
||||
|
||||
@time = 0
|
||||
@ops = 0
|
||||
|
||||
users = []
|
||||
|
||||
generateInsertOp = (user_num)->
|
||||
chars = "1234567890"
|
||||
|
||||
pos = _.random 0, (users[user_num].val('name').length-1)
|
||||
length = 1 #_.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
|
||||
users[user_num].val('name').insertText pos, text
|
||||
null
|
||||
|
||||
generateReplaceOp = (user_num)->
|
||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||
length = _.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
users[user_num].val('name').replaceText text
|
||||
|
||||
generateDeleteOp = (user_num)->
|
||||
if users[user_num].val('name').val().length > 0
|
||||
pos = _.random 0, (users[user_num].val('name').val().length-1)
|
||||
length = 1 # _.random 0, ot.val('name').length - pos
|
||||
ops1 = users[user_num].val('name').deleteText pos, length
|
||||
undefined
|
||||
|
||||
generateRandomOp = (user_num)->
|
||||
op_gen = [generateDeleteOp, generateInsertOp, generateReplaceOp]
|
||||
i = _.random (op_gen.length - 1)
|
||||
op = op_gen[i](user_num)
|
||||
|
||||
applyRandomOp = (user_num)->
|
||||
user = users[user_num]
|
||||
user.getConnector().flushOneRandom()
|
||||
|
||||
doSomething = do ()->
|
||||
()->
|
||||
user_num = _.random (number_of_engines-1)
|
||||
choices = [applyRandomOp, generateRandomOp]
|
||||
*if (users[user_num].buffer[user_num].length < maximum_ops_per_engine)
|
||||
* choices = choices.concat generateRandomOp
|
||||
|
||||
choice = _.random (choices.length-1)
|
||||
|
||||
choices[choice](user_num)
|
||||
|
||||
console.log ""
|
||||
for times in [1..repeat_this]
|
||||
*console.log "repeated_this x #{times} times"
|
||||
users = []
|
||||
Connector = Connector_uninitialized users
|
||||
users.push(new Yatta 0, Connector)
|
||||
users[0].val('name',"initial")
|
||||
for i in [1...number_of_engines]
|
||||
users.push(new Yatta i, Connector)
|
||||
|
||||
found_error = false
|
||||
|
||||
*try
|
||||
time_now = (new Date).getTime()
|
||||
for i in [1..doSomething_amount]
|
||||
doSomething()
|
||||
|
||||
for user,user_number in users
|
||||
user.getConnector().flushAll()
|
||||
|
||||
@time += (new Date()).getTime() - time_now
|
||||
|
||||
number_of_created_operations = 0
|
||||
for i in [0...(users.length)]
|
||||
number_of_created_operations += users[i].getConnector().getOpsInExecutionOrder().length
|
||||
@ops += number_of_created_operations*users.length
|
||||
|
||||
ops_per_msek = Math.floor(@ops/@time)
|
||||
console.log "#{times}/#{repeat_this}: Every collaborator (#{users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
|
||||
|
||||
console.log users[0].val('name').val()
|
||||
for i in [0...(users.length-1)]
|
||||
if ((users[i].val('name').val() isnt users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)->
|
||||
ops = users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s in ops
|
||||
console.log JSON.stringify s
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{users[otherotnumber].val('name')}\")"
|
||||
ops
|
||||
console.log ""
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in users
|
||||
console.log "OT#{j}: "+u.val('name')
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
|
||||
console.log ""
|
||||
*/
|
||||
|
||||
}).call(this);
|
@ -1,163 +0,0 @@
|
||||
(function() {
|
||||
var Connector_uninitialized, Yatta, chai, expect, should, sinon, sinonChai, _;
|
||||
|
||||
chai = require('chai');
|
||||
|
||||
expect = chai.expect;
|
||||
|
||||
should = chai.should();
|
||||
|
||||
sinon = require('sinon');
|
||||
|
||||
sinonChai = require('sinon-chai');
|
||||
|
||||
_ = require("underscore");
|
||||
|
||||
chai.use(sinonChai);
|
||||
|
||||
Yatta = require("../lib/Frameworks/TextYatta.coffee");
|
||||
|
||||
Connector_uninitialized = require("../lib/Connectors/TestConnector.coffee");
|
||||
|
||||
|
||||
/*
|
||||
describe "TextYatta", ->
|
||||
beforeEach (done)->
|
||||
@last_user = 10
|
||||
@users = []
|
||||
@Connector = Connector_uninitialized @users
|
||||
for i in [0..(@last_user+1)]
|
||||
@users.push(new Yatta i, @Connector)
|
||||
done()
|
||||
|
||||
it "handles inserts correctly", ->
|
||||
|
||||
|
||||
it "can handle many engines, many operations, concurrently (random)", ->
|
||||
number_of_test_cases_multiplier = 1
|
||||
repeat_this = 1 * number_of_test_cases_multiplier
|
||||
doSomething_amount = 500 * number_of_test_cases_multiplier
|
||||
number_of_engines = 12 + number_of_test_cases_multiplier - 1
|
||||
*maximum_ops_per_engine = 20 * number_of_test_cases_multiplier
|
||||
|
||||
@time = 0
|
||||
@ops = 0
|
||||
users = []
|
||||
|
||||
generateInsertOp = (user_num)->
|
||||
chars = "1234567890"
|
||||
|
||||
pos = _.random 0, (users[user_num].val().length-1)
|
||||
length = 1 #_.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
|
||||
users[user_num].insertText pos, text
|
||||
null
|
||||
|
||||
generateReplaceOp = (user_num)->
|
||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||
length = _.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
users[user_num].replaceText text
|
||||
|
||||
generateDeleteOp = (user_num)->
|
||||
if users[user_num].val().length > 0
|
||||
pos = _.random 0, (users[user_num].val().length-1)
|
||||
length = 1 # _.random 0, ot.val().length - pos
|
||||
ops1 = users[user_num].deleteText pos, length
|
||||
undefined
|
||||
|
||||
generateRandomOp = (user_num)->
|
||||
op_gen = [generateDeleteOp, generateInsertOp, generateReplaceOp]
|
||||
i = _.random (op_gen.length - 1)
|
||||
op = op_gen[i](user_num)
|
||||
|
||||
applyRandomOp = (user_num)->
|
||||
user = users[user_num]
|
||||
user.getConnector().flushOneRandom()
|
||||
|
||||
doSomething = do ()->
|
||||
()->
|
||||
user_num = _.random (number_of_engines-1)
|
||||
choices = [applyRandomOp, generateRandomOp]
|
||||
*if (users[user_num].buffer[user_num].length < maximum_ops_per_engine)
|
||||
* choices = choices.concat generateRandomOp
|
||||
|
||||
choice = _.random (choices.length-1)
|
||||
|
||||
choices[choice](user_num)
|
||||
|
||||
console.log ""
|
||||
for times in [1..repeat_this]
|
||||
*console.log "repeated_this x #{times} times"
|
||||
users = []
|
||||
Connector = Connector_uninitialized users
|
||||
for i in [0..number_of_engines]
|
||||
users.push(new Yatta i, Connector)
|
||||
|
||||
found_error = false
|
||||
|
||||
*try
|
||||
time_now = (new Date).getTime()
|
||||
for i in [1..doSomething_amount]
|
||||
doSomething()
|
||||
|
||||
for user,user_number in users
|
||||
user.getConnector().flushAll()
|
||||
|
||||
@time += (new Date()).getTime() - time_now
|
||||
|
||||
number_of_created_operations = 0
|
||||
for i in [0...(users.length)]
|
||||
number_of_created_operations += users[i].getConnector().getOpsInExecutionOrder().length
|
||||
@ops += number_of_created_operations*users.length
|
||||
|
||||
ops_per_msek = Math.floor(@ops/@time)
|
||||
console.log "#{times}/#{repeat_this}: Every collaborator (#{users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
|
||||
|
||||
console.log users[0].val()
|
||||
found_inconsistency = false
|
||||
for i in [0...(users.length-1)]
|
||||
if ((users[i].val() isnt users[i+1].val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
found_inconsistency =true
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)->
|
||||
ops = users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s,j in ops
|
||||
console.log "op#{j} = #{JSON.stringify s}"
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].val()).to.equal(\"#{users[otherotnumber].val()}\")"
|
||||
ops
|
||||
console.log ""
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in users
|
||||
console.log "OT#{j}: "+u.val()
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
|
||||
console.log ""
|
||||
if found_inconsistency
|
||||
throw new Error "dtrn"
|
||||
|
||||
* expect(users[i].ot.val()).to.equal(users[i+1].ot.val())
|
||||
*/
|
||||
|
||||
}).call(this);
|
@ -34,6 +34,7 @@
|
||||
this.time = 0;
|
||||
this.ops = 0;
|
||||
this.time_now = 0;
|
||||
this.debug = false;
|
||||
this.reinitialize();
|
||||
}
|
||||
|
||||
@ -123,7 +124,7 @@
|
||||
};
|
||||
|
||||
Test.prototype.compareAll = function(test_number) {
|
||||
var i, j, number_of_created_operations, ops, ops_per_msek, printOpsInExecutionOrder, u, _i, _j, _k, _len, _ref, _ref1, _results;
|
||||
var i, j, number_of_created_operations, ops, ops_per_msek, printOpsInExecutionOrder, u, _i, _j, _k, _len, _ref, _ref1, _ref2, _results;
|
||||
this.flushAll();
|
||||
this.time += (new Date()).getTime() - this.time_now;
|
||||
number_of_created_operations = 0;
|
||||
@ -135,45 +136,53 @@
|
||||
if (test_number != null) {
|
||||
console.log(("" + test_number + "/" + this.repeat_this + ": Every collaborator (" + this.users.length + ") applied " + number_of_created_operations + " ops in a different order.") + (" Over all we consumed " + this.ops + " operations in " + (this.time / 1000) + " seconds (" + ops_per_msek + " ops/msek)."));
|
||||
}
|
||||
console.log(this.users.length);
|
||||
_results = [];
|
||||
for (i = _j = 0, _ref1 = this.users.length - 1; 0 <= _ref1 ? _j < _ref1 : _j > _ref1; i = 0 <= _ref1 ? ++_j : --_j) {
|
||||
if (this.users[i].val('name').val() !== this.users[i + 1].val('name').val()) {
|
||||
printOpsInExecutionOrder = function(otnumber, otherotnumber) {
|
||||
var j, o, ops, s, _k, _l, _len, _len1;
|
||||
ops = this.users[otnumber].getConnector().getOpsInExecutionOrder();
|
||||
for (_k = 0, _len = ops.length; _k < _len; _k++) {
|
||||
s = ops[_k];
|
||||
console.log(JSON.stringify(s));
|
||||
}
|
||||
console.log("");
|
||||
s = "ops = [";
|
||||
for (j = _l = 0, _len1 = ops.length; _l < _len1; j = ++_l) {
|
||||
o = ops[j];
|
||||
if (j !== 0) {
|
||||
s += ", ";
|
||||
}
|
||||
s += "op" + j;
|
||||
}
|
||||
s += "]";
|
||||
console.log(s);
|
||||
console.log("@users[@last_user].ot.applyOps ops");
|
||||
console.log("expect(@users[@last_user].ot.val('name')).to.equal(\"" + (users[otherotnumber].val('name')) + "\")");
|
||||
return ops;
|
||||
};
|
||||
console.log("");
|
||||
console.log("Found an OT Puzzle!");
|
||||
console.log("OT states:");
|
||||
for (j = _k = 0, _len = users.length; _k < _len; j = ++_k) {
|
||||
u = users[j];
|
||||
console.log(("OT" + j + ": ") + u.val('name'));
|
||||
}
|
||||
console.log("\nOT execution order (" + i + "," + (i + 1) + "):");
|
||||
printOpsInExecutionOrder(i, i + 1);
|
||||
console.log("");
|
||||
ops = printOpsInExecutionOrder(i + 1, i);
|
||||
_results.push(console.log(""));
|
||||
if (!this.debug) {
|
||||
_results.push(expect(this.users[i].val('name').val()).to.equal(this.users[i + 1].val('name').val()));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
if (this.users[i].val('name').val() !== this.users[i + 1].val('name').val()) {
|
||||
printOpsInExecutionOrder = (function(_this) {
|
||||
return function(otnumber, otherotnumber) {
|
||||
var j, o, ops, s, _k, _l, _len, _len1;
|
||||
ops = _this.users[otnumber].getConnector().getOpsInExecutionOrder();
|
||||
for (_k = 0, _len = ops.length; _k < _len; _k++) {
|
||||
s = ops[_k];
|
||||
console.log(JSON.stringify(s));
|
||||
}
|
||||
console.log("");
|
||||
s = "ops = [";
|
||||
for (j = _l = 0, _len1 = ops.length; _l < _len1; j = ++_l) {
|
||||
o = ops[j];
|
||||
if (j !== 0) {
|
||||
s += ", ";
|
||||
}
|
||||
s += "op" + j;
|
||||
}
|
||||
s += "]";
|
||||
console.log(s);
|
||||
console.log("@users[@last_user].ot.applyOps ops");
|
||||
console.log("expect(@users[@last_user].ot.val('name')).to.equal(\"" + (_this.users[otherotnumber].val('name')) + "\")");
|
||||
return ops;
|
||||
};
|
||||
})(this);
|
||||
console.log("");
|
||||
console.log("Found an OT Puzzle!");
|
||||
console.log("OT states:");
|
||||
_ref2 = this.users;
|
||||
for (j = _k = 0, _len = _ref2.length; _k < _len; j = ++_k) {
|
||||
u = _ref2[j];
|
||||
console.log(("OT" + j + ": ") + u.val('name'));
|
||||
}
|
||||
console.log("\nOT execution order (" + i + "," + (i + 1) + "):");
|
||||
printOpsInExecutionOrder(i, i + 1);
|
||||
console.log("");
|
||||
ops = printOpsInExecutionOrder(i + 1, i);
|
||||
_results.push(console.log(""));
|
||||
} else {
|
||||
_results.push(void 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
return _results;
|
||||
|
@ -342,7 +342,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -142,7 +142,7 @@ only one will AddName operation will be executed.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -157,7 +157,7 @@ This result can be sent to other clients.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -118,7 +118,7 @@ of the Engine is empty.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -72,6 +72,11 @@
|
||||
</a>
|
||||
</span>
|
||||
<span class='desc'>
|
||||
<p>ops = [] for o in ops_json ops.push @parseOperation o
|
||||
for o in ops @HB.addOperation o
|
||||
for o in ops if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()</p>
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
@ -125,7 +130,16 @@
|
||||
<b>applyOp</b><span>(op_json)</span>
|
||||
<br>
|
||||
</p>
|
||||
|
||||
<div class='docstring'>
|
||||
<p>ops = []
|
||||
for o in ops_json ops.push @parseOperation o
|
||||
for o in ops @HB.addOperation o
|
||||
for o in ops if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()</p>
|
||||
</div>
|
||||
<div class='tags'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='method_details'>
|
||||
<p class='signature' id='tryUnprocessed-dynamic'>
|
||||
@ -139,7 +153,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -57,6 +57,18 @@
|
||||
Get the user id with wich the History Buffer was initialized.
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class='signature'>
|
||||
<a href='#getReservedUniqueIdentifier-dynamic'>
|
||||
#
|
||||
(void)
|
||||
<b>getReservedUniqueIdentifier</b><span>()</span>
|
||||
</a>
|
||||
</span>
|
||||
<span class='desc'>
|
||||
There is only one reserved unique identifier (uid), so use it wisely.
|
||||
</span>
|
||||
</li>
|
||||
<li>
|
||||
<span class='signature'>
|
||||
<a href='#getOperationCounter-dynamic'>
|
||||
@ -159,6 +171,22 @@
|
||||
<p>Get the user id with wich the History Buffer was initialized.</p>
|
||||
</div>
|
||||
<div class='tags'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='method_details'>
|
||||
<p class='signature' id='getReservedUniqueIdentifier-dynamic'>
|
||||
#
|
||||
(void)
|
||||
<b>getReservedUniqueIdentifier</b><span>()</span>
|
||||
<br>
|
||||
</p>
|
||||
<div class='docstring'>
|
||||
<p>There is only one reserved unique identifier (uid), so use it wisely.
|
||||
I propose to use it in your Framework, to create something like a root element.
|
||||
An operation with this identifier is not propagated to other clients.
|
||||
This is why everybode must create the same operation with this uid.</p>
|
||||
</div>
|
||||
<div class='tags'>
|
||||
</div>
|
||||
</div>
|
||||
<div class='method_details'>
|
||||
@ -228,7 +256,7 @@ other operations (it wont executed)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -93,7 +93,7 @@
|
||||
<p class='signature' id='constructor-dynamic'>
|
||||
#
|
||||
(void)
|
||||
<b>constructor</b><span>(uid, content = "", prev, next, origin)</span>
|
||||
<b>constructor</b><span>(uid, content, prev, next, origin)</span>
|
||||
<br>
|
||||
</p>
|
||||
<div class='tags'>
|
||||
@ -156,7 +156,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -256,7 +256,7 @@ TODO (Unused)</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -168,7 +168,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -286,7 +286,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -121,7 +121,7 @@ console.log(w.newProperty == "Awesome") # true!</code></pre>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -250,7 +250,7 @@ JsonYatta was initialized (Depending on the HistoryBuffer implementation).</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -208,7 +208,7 @@ Doesn't return left-right delimiter.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -99,7 +99,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -284,7 +284,7 @@ an easy way to refer to these operations via an uid or object reference.</p><p>F
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -189,7 +189,7 @@ Each Replaceable holds a value that is now replaceable.</p><p>The Word-type has
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -191,7 +191,7 @@ This result can be send to other clients.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -219,7 +219,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -53,7 +53,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -173,7 +173,7 @@ This result can be send to other clients.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -239,7 +239,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -126,7 +126,7 @@
|
||||
<p class='signature' id='constructor-dynamic'>
|
||||
#
|
||||
(void)
|
||||
<b>constructor</b><span>(uid, initial_content, beginning, end, prev, next, origin)</span>
|
||||
<b>constructor</b><span>(uid, beginning, end, prev, next, origin)</span>
|
||||
<br>
|
||||
</p>
|
||||
<div class='tags'>
|
||||
@ -142,14 +142,6 @@
|
||||
—
|
||||
<span class='desc'>A unique identifier. If uid is undefined, a new uid will be created. </span>
|
||||
</li>
|
||||
<li>
|
||||
<span class='name'>initial_content</span>
|
||||
<span class='type'>
|
||||
(
|
||||
<tt>String</tt>
|
||||
)
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -241,7 +233,7 @@ to provide replace functionality.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -38,7 +38,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -34,11 +34,35 @@
|
||||
</p>
|
||||
</nav>
|
||||
<div id='filecontents'>
|
||||
<h1 id="-yatta-yatta-svg-raw-true-"><a href="./Yatta.svg?raw=true">Yatta!</a></h1><p>A Collaboration Framework for arbitrary data structures that is <em>not</em> based on Operational Transformation.</p><h1 id="license">License</h1><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT license</a>.</p>
|
||||
<h1 id="-yatta-extras-imgs-yatta_logo-png-raw-true-"><img src="./extras/imgs/Yatta_logo.png?raw=true" alt="Yatta!"></h1><p>A real-time web framework that manages concurrency control for arbitrary data structures and is <em>not</em> based on Operational Transformation.
|
||||
Yatta! provides similar functionality as <a href="https://github.com/share/ShareJS">ShareJs</a> and <a href="https://github.com/opencoweb/coweb">OpenCoweb</a>
|
||||
but does not require you to understand how the internals work. The predefined data structures provide a simple API to access your shared data structures.</p><p>Predefined data structures:</p><ul>
|
||||
<li>Text</li>
|
||||
<li>Json - <a href="./examples/IwcJson.md">example</a></li>
|
||||
<li>XML (coming soon)</li>
|
||||
</ul><p>Unlike other frameworks, Yatta! supports P2P message propagation and is not bound to a specific communication protocol.</p><p>Currently supported communication protocols:</p><ul>
|
||||
<li><a href="http://dbis.rwth-aachen.de/gadgets/iwc/resources/iwc.manual.pdf">IWC</a> - Inter-widget Communication</li>
|
||||
</ul>
|
||||
<h1 id="about">About</h1><p>Find out more about the concurrent editing problem here
|
||||
<a href="http://opencoweb.org/ocwdocs/intro/openg.html">Cooperation, Concurrency, Conflicts, and Convergence</a> and here
|
||||
<a href="http://en.wikipedia.org/wiki/Operational_transformation">Operational Transformation (OT)</a></p><p>My Bachelor Thesis project aim was to develop a P2P OT Framework that enables collaboration on XML documents and supports
|
||||
<a href="http://www3.ntu.edu.sg/home/czsun/projects/otfaq/#intentionPreservation">Intention Preservation</a>.
|
||||
After some time I realized that OT has significant drawbacks in P2P environments.</p><p>With my gained experiences I came up with a new approach. I named it Yata - Yet Another Transformation Approach.
|
||||
It enables concurrent editing with the following space and time properties:</p><ul>
|
||||
<li>Time complexity: O(S), whereby S is the number of operations that are inserted concurrently at the same position. This means that my approach does not transform against operations that happen on other positions.</li>
|
||||
<li>Space complexity = O(|Document|), whereby |Document| is the size of the shared document. Depending on the used data structure, Yata may needs 4*|Document| of space.</li>
|
||||
</ul><p>This means that my approach beats all OT time complexities. Furthermore, it is possible to make a very strict definition of Intention Preservation, and I was able to
|
||||
show that it is never violated.</p><p>Another advantage of my approach is that propagated messages are very small.
|
||||
Background: In real-time P2P OT algorithms you have to send a state-vector with every message that defines the state of the History Buffer
|
||||
on which the operation was created. This is not necessary in Yata.</p><p>One downside is that the History Buffer holds at least as many operations as there are characters in the document.
|
||||
In contrast, an OT algorithm can have an empty History Buffer while the document size is very big.</p><p>So, how did I come up with the name for the implementation (Yatta! is not Yata)?
|
||||
<img src="./extras/imgs/YATTA.png" alt="YATTA!">
|
||||
Yatta! means "I did it!" in Japanese. You scream it when you accomplish something (for proper application I refer to the Yatta-man in <a href="http://heroeswiki.com/Yatta!">Heroes</a>).
|
||||
There is also this awesome video on the Internet that will change your life <a href="https://www.youtube.com/watch?v=kL5DDSglM_s">Yatta</a>.</p><h1 id="status">Status</h1><p>Yatta! is still in an early development phase.</p><h1 id="support">Support</h1><p>Please report any issues to the <a href="https://github.com/DadaMonad/Yatta/issues">Github issue page</a>!</p><h1 id="license">License</h1><p>Yatta! is licensed under the <a href="./LICENSE.txt">MIT License</a>.</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -103,7 +103,7 @@ window.onload = init
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -84,7 +84,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -58,7 +58,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -68,7 +68,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -60,7 +60,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -58,7 +58,7 @@
|
||||
</dl>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
@ -39,7 +39,7 @@
|
||||
</table>
|
||||
</div>
|
||||
<div id='footer'>
|
||||
August 05, 14 20:37:47 by
|
||||
August 07, 14 21:48:38 by
|
||||
<a href='https://github.com/coffeedoc/codo' title='CoffeeScript API documentation generator'>
|
||||
Codo
|
||||
</a>
|
||||
|
File diff suppressed because one or more lines are too long
@ -301,14 +301,6 @@
|
||||
(lib/Connectors/IwcConnector.coffee)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/Word.html#deleteText-dynamic' target='main' title='deleteText'>
|
||||
#deleteText
|
||||
</a>
|
||||
<small>
|
||||
(Word)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TextYatta.html#deleteText-dynamic' target='main' title='deleteText'>
|
||||
#deleteText
|
||||
@ -317,6 +309,14 @@
|
||||
(TextYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/Word.html#deleteText-dynamic' target='main' title='deleteText'>
|
||||
#deleteText
|
||||
</a>
|
||||
<small>
|
||||
(Word)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/Operation.html#execute-dynamic' target='main' title='execute'>
|
||||
#execute
|
||||
@ -326,11 +326,11 @@
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/Delimiter.html#execute-dynamic' target='main' title='execute'>
|
||||
<a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
|
||||
#execute
|
||||
</a>
|
||||
<small>
|
||||
(Delimiter)
|
||||
(AddName)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
@ -350,11 +350,11 @@
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/AddName.html#execute-dynamic' target='main' title='execute'>
|
||||
<a href='class/Delimiter.html#execute-dynamic' target='main' title='execute'>
|
||||
#execute
|
||||
</a>
|
||||
<small>
|
||||
(AddName)
|
||||
(Delimiter)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
@ -510,11 +510,11 @@
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
|
||||
#getRootElement
|
||||
<a href='class/HistoryBuffer.html#getReservedUniqueIdentifier-dynamic' target='main' title='getReservedUniqueIdentifier'>
|
||||
#getReservedUniqueIdentifier
|
||||
</a>
|
||||
<small>
|
||||
(JsonYatta)
|
||||
(HistoryBuffer)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
@ -525,6 +525,14 @@
|
||||
(IwcConnector)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonYatta.html#getRootElement-dynamic' target='main' title='getRootElement'>
|
||||
#getRootElement
|
||||
</a>
|
||||
<small>
|
||||
(JsonYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TestConnector.html#getRootElement-dynamic' target='main' title='getRootElement'>
|
||||
#getRootElement
|
||||
@ -550,11 +558,11 @@
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TextYatta.html#getUserId-dynamic' target='main' title='getUserId'>
|
||||
<a href='class/JsonYatta.html#getUserId-dynamic' target='main' title='getUserId'>
|
||||
#getUserId
|
||||
</a>
|
||||
<small>
|
||||
(TextYatta)
|
||||
(JsonYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
@ -566,11 +574,11 @@
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonYatta.html#getUserId-dynamic' target='main' title='getUserId'>
|
||||
<a href='class/TextYatta.html#getUserId-dynamic' target='main' title='getUserId'>
|
||||
#getUserId
|
||||
</a>
|
||||
<small>
|
||||
(JsonYatta)
|
||||
(TextYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
@ -661,14 +669,6 @@
|
||||
(Operation)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TestConnector.html#send-dynamic' target='main' title='send'>
|
||||
#send
|
||||
</a>
|
||||
<small>
|
||||
(TestConnector)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/IwcConnector.html#send-dynamic' target='main' title='send'>
|
||||
#send
|
||||
@ -677,6 +677,14 @@
|
||||
(IwcConnector)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TestConnector.html#send-dynamic' target='main' title='send'>
|
||||
#send
|
||||
</a>
|
||||
<small>
|
||||
(TestConnector)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/IwcConnector.html#sendIwcIntent-dynamic' target='main' title='sendIwcIntent'>
|
||||
#sendIwcIntent
|
||||
@ -765,6 +773,22 @@
|
||||
(TextInsert)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
</a>
|
||||
<small>
|
||||
(JsonType)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
</a>
|
||||
<small>
|
||||
(TextYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/Replaceable.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
@ -781,22 +805,6 @@
|
||||
(MapManager)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/TextYatta.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
</a>
|
||||
<small>
|
||||
(TextYatta)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonType.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
</a>
|
||||
<small>
|
||||
(JsonType)
|
||||
</small>
|
||||
</li>
|
||||
<li>
|
||||
<a href='class/JsonYatta.html#val-dynamic' target='main' title='val'>
|
||||
#val
|
||||
|
@ -35,8 +35,8 @@ module.exports = (user_list)->
|
||||
user.getConnector().receive(o)
|
||||
|
||||
receive: (o)->
|
||||
@unexecuted[o.creator] ?= []
|
||||
@unexecuted[o.creator].push o
|
||||
@unexecuted[o.uid.creator] ?= []
|
||||
@unexecuted[o.uid.creator].push o
|
||||
|
||||
flushOne: (user)->
|
||||
if @unexecuted[user]?.length > 0
|
||||
|
@ -14,6 +14,9 @@ class Engine
|
||||
throw new Error "You forgot to specify a parser for type #{json.type}. The message is #{JSON.stringify json}."
|
||||
|
||||
applyOps: (ops_json)->
|
||||
for o in ops_json
|
||||
@applyOp o
|
||||
###
|
||||
ops = []
|
||||
for o in ops_json
|
||||
ops.push @parseOperation o
|
||||
@ -23,7 +26,7 @@ class Engine
|
||||
if not o.execute()
|
||||
@unprocessed_ops.push o
|
||||
@tryUnprocessed()
|
||||
|
||||
###
|
||||
applyOp: (op_json)->
|
||||
# $parse_and_execute will return false if $o_json was parsed and executed, otherwise the parsed operadion
|
||||
o = @parseOperation op_json
|
||||
|
@ -16,14 +16,11 @@ class JsonYatta
|
||||
json_types = json_types_uninitialized @HB
|
||||
@engine = new Engine @HB, json_types.parser
|
||||
@connector = new Connector @engine, @HB, json_types.execution_listener, @
|
||||
root_elem = @connector.getRootElement()
|
||||
if not root_elem?
|
||||
first_word = new json_types.types.JsonType @HB.getNextOperationIdentifier()
|
||||
@HB.addOperation(first_word)
|
||||
first_word.execute()
|
||||
@root_element = first_word
|
||||
else
|
||||
@root_element = @HB.getOperation(root_elem)
|
||||
|
||||
first_word = new json_types.types.JsonType @HB.getReservedUniqueIdentifier()
|
||||
@HB.addOperation(first_word).execute()
|
||||
@root_element = first_word
|
||||
|
||||
|
||||
#
|
||||
# @result JsonType
|
||||
|
@ -21,6 +21,18 @@ class HistoryBuffer
|
||||
getUserId: ()->
|
||||
@user_id
|
||||
|
||||
#
|
||||
# There is only one reserved unique identifier (uid), so use it wisely.
|
||||
# I propose to use it in your Framework, to create something like a root element.
|
||||
# An operation with this identifier is not propagated to other clients.
|
||||
# This is why everybode must create the same operation with this uid.
|
||||
#
|
||||
getReservedUniqueIdentifier: ()->
|
||||
{
|
||||
creator : '_'
|
||||
op_number : '_'
|
||||
}
|
||||
|
||||
#
|
||||
# Get the operation counter that describes the current state of the document.
|
||||
#
|
||||
|
@ -294,7 +294,7 @@ module.exports = (HB)->
|
||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||
# @param {Object} content
|
||||
#
|
||||
constructor: (uid, @content="", prev, next, origin)->
|
||||
constructor: (uid, @content, prev, next, origin)->
|
||||
super uid, prev, next, origin
|
||||
|
||||
#
|
||||
|
@ -155,10 +155,11 @@ module.exports = (HB)->
|
||||
super name, obj
|
||||
else
|
||||
if typeof content is 'string'
|
||||
word = HB.addOperation(new types.Word HB.getNextOperationIdentifier(), content).execute()
|
||||
word = HB.addOperation(new types.Word undefined).execute()
|
||||
word.insertText 0, content
|
||||
super name, word
|
||||
else if content.constructor is Object
|
||||
json = HB.addOperation(new JsonType HB.getNextOperationIdentifier(), content, mutable).execute()
|
||||
json = HB.addOperation(new JsonType undefined, content, mutable).execute()
|
||||
super name, json
|
||||
else
|
||||
throw new Error "You must not set #{typeof content}-types in collaborative Json-objects!"
|
||||
|
@ -20,7 +20,7 @@ module.exports = (HB)->
|
||||
val: (name, content)->
|
||||
if content?
|
||||
if not @map[name]?
|
||||
HB.addOperation(new AddName HB.getNextOperationIdentifier(), @, name).execute()
|
||||
HB.addOperation(new AddName undefined, @, name).execute()
|
||||
@map[name].replace content
|
||||
@
|
||||
else if name?
|
||||
@ -103,14 +103,14 @@ module.exports = (HB)->
|
||||
@saveOperation 'beginning', beginning
|
||||
@saveOperation 'end', end
|
||||
else
|
||||
@beginning = HB.addOperation new types.Delimiter HB.getNextOperationIdentifier(), undefined, undefined
|
||||
@end = HB.addOperation new types.Delimiter HB.getNextOperationIdentifier(), @beginning, undefined
|
||||
@beginning = HB.addOperation new types.Delimiter undefined, undefined, undefined
|
||||
@end = HB.addOperation new types.Delimiter undefined, @beginning, undefined
|
||||
@beginning.next_cl = @end
|
||||
@beginning.execute()
|
||||
@end.execute()
|
||||
|
||||
super uid, prev, next, origin
|
||||
|
||||
|
||||
# Get the element previous to the delemiter at the end
|
||||
getLastOperation: ()->
|
||||
@end.prev_cl
|
||||
@ -165,7 +165,7 @@ module.exports = (HB)->
|
||||
|
||||
replace: (content)->
|
||||
o = @getLastOperation()
|
||||
op = new Replaceable content, @, HB.getNextOperationIdentifier(), o, o.next_cl
|
||||
op = new Replaceable content, @, undefined, o, o.next_cl
|
||||
HB.addOperation(op).execute()
|
||||
|
||||
val: ()->
|
||||
|
@ -78,19 +78,17 @@ module.exports = (HB)->
|
||||
|
||||
#
|
||||
# @param {Object} uid A unique identifier. If uid is undefined, a new uid will be created.
|
||||
# @param {String} initial_content
|
||||
#
|
||||
constructor: (uid, initial_content, beginning, end, prev, next, origin)->
|
||||
constructor: (uid, beginning, end, prev, next, origin)->
|
||||
super uid, beginning, end, prev, next, origin
|
||||
if initial_content?
|
||||
@insertText 0, initial_content
|
||||
|
||||
#
|
||||
# Inserts a string into the word
|
||||
#
|
||||
insertText: (position, content)->
|
||||
o = @getOperationByPosition position
|
||||
for c in content
|
||||
op = new TextInsert c, HB.getNextOperationIdentifier(), o.prev_cl, o
|
||||
op = new TextInsert c, undefined, o.prev_cl, o
|
||||
HB.addOperation(op).execute()
|
||||
|
||||
#
|
||||
@ -166,7 +164,7 @@ module.exports = (HB)->
|
||||
'next': next
|
||||
'origin' : origin
|
||||
} = json
|
||||
new Word uid, undefined, beginning, end, prev, next, origin
|
||||
new Word uid, beginning, end, prev, next, origin
|
||||
|
||||
types['TextInsert'] = TextInsert
|
||||
types['TextDelete'] = TextDelete
|
||||
|
@ -25,6 +25,7 @@
|
||||
"homepage": "https://github.com/DadaMonad/Yatta",
|
||||
"dependencies": {},
|
||||
"devDependencies": {
|
||||
"chai": "^1.9.1",
|
||||
"coffeeify": "^0.6.0",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-browserify": "^2.1.3",
|
||||
@ -36,9 +37,9 @@
|
||||
"grunt-contrib-watch": "^0.6.1",
|
||||
"grunt-literate": "^0.2.0",
|
||||
"grunt-simple-mocha": "^0.4.0",
|
||||
"mocha": "^1.21.4",
|
||||
"sinon": "^1.10.2",
|
||||
"sinon-chai": "^2.5.0",
|
||||
"chai": "^1.9.1",
|
||||
"underscore": "^1.6.0"
|
||||
}
|
||||
}
|
||||
|
@ -1,146 +0,0 @@
|
||||
chai = require('chai')
|
||||
expect = chai.expect
|
||||
should = chai.should()
|
||||
sinon = require('sinon')
|
||||
sinonChai = require('sinon-chai')
|
||||
_ = require "underscore"
|
||||
|
||||
chai.use(sinonChai)
|
||||
|
||||
Yatta = require "../lib/Frameworks/JsonYatta.coffee"
|
||||
Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee"
|
||||
###
|
||||
describe "JsonYatta", ->
|
||||
beforeEach (done)->
|
||||
@last_user = 10
|
||||
@users = []
|
||||
@Connector = Connector_uninitialized @users
|
||||
for i in [0..(@last_user+1)]
|
||||
@users.push(new Yatta i, @Connector)
|
||||
|
||||
|
||||
done()
|
||||
|
||||
it "can handle many engines, many operations, concurrently (random)", ->
|
||||
number_of_test_cases_multiplier = 1
|
||||
repeat_this = 100 * number_of_test_cases_multiplier
|
||||
doSomething_amount = 200 * number_of_test_cases_multiplier
|
||||
number_of_engines = 12 + number_of_test_cases_multiplier - 1
|
||||
|
||||
@time = 0
|
||||
@ops = 0
|
||||
|
||||
users = []
|
||||
|
||||
generateInsertOp = (user_num)->
|
||||
chars = "1234567890"
|
||||
|
||||
pos = _.random 0, (users[user_num].val('name').length-1)
|
||||
length = 1 #_.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
|
||||
users[user_num].val('name').insertText pos, text
|
||||
null
|
||||
|
||||
generateReplaceOp = (user_num)->
|
||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||
length = _.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
users[user_num].val('name').replaceText text
|
||||
|
||||
generateDeleteOp = (user_num)->
|
||||
if users[user_num].val('name').val().length > 0
|
||||
pos = _.random 0, (users[user_num].val('name').val().length-1)
|
||||
length = 1 # _.random 0, ot.val('name').length - pos
|
||||
ops1 = users[user_num].val('name').deleteText pos, length
|
||||
undefined
|
||||
|
||||
generateRandomOp = (user_num)->
|
||||
op_gen = [generateDeleteOp, generateInsertOp, generateReplaceOp]
|
||||
i = _.random (op_gen.length - 1)
|
||||
op = op_gen[i](user_num)
|
||||
|
||||
applyRandomOp = (user_num)->
|
||||
user = users[user_num]
|
||||
user.getConnector().flushOneRandom()
|
||||
|
||||
doSomething = do ()->
|
||||
()->
|
||||
user_num = _.random (number_of_engines-1)
|
||||
choices = [applyRandomOp, generateRandomOp]
|
||||
#if (users[user_num].buffer[user_num].length < maximum_ops_per_engine)
|
||||
# choices = choices.concat generateRandomOp
|
||||
|
||||
choice = _.random (choices.length-1)
|
||||
|
||||
choices[choice](user_num)
|
||||
|
||||
console.log ""
|
||||
for times in [1..repeat_this]
|
||||
#console.log "repeated_this x #{times} times"
|
||||
users = []
|
||||
Connector = Connector_uninitialized users
|
||||
users.push(new Yatta 0, Connector)
|
||||
users[0].val('name',"initial")
|
||||
for i in [1...number_of_engines]
|
||||
users.push(new Yatta i, Connector)
|
||||
|
||||
found_error = false
|
||||
|
||||
#try
|
||||
time_now = (new Date).getTime()
|
||||
for i in [1..doSomething_amount]
|
||||
doSomething()
|
||||
|
||||
for user,user_number in users
|
||||
user.getConnector().flushAll()
|
||||
|
||||
@time += (new Date()).getTime() - time_now
|
||||
|
||||
number_of_created_operations = 0
|
||||
for i in [0...(users.length)]
|
||||
number_of_created_operations += users[i].getConnector().getOpsInExecutionOrder().length
|
||||
@ops += number_of_created_operations*users.length
|
||||
|
||||
ops_per_msek = Math.floor(@ops/@time)
|
||||
console.log "#{times}/#{repeat_this}: Every collaborator (#{users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
|
||||
|
||||
console.log users[0].val('name').val()
|
||||
for i in [0...(users.length-1)]
|
||||
if ((users[i].val('name').val() isnt users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)->
|
||||
ops = users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s in ops
|
||||
console.log JSON.stringify s
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{users[otherotnumber].val('name')}\")"
|
||||
ops
|
||||
console.log ""
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in users
|
||||
console.log "OT#{j}: "+u.val('name')
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
|
||||
console.log ""
|
||||
###
|
@ -1,152 +0,0 @@
|
||||
chai = require('chai')
|
||||
expect = chai.expect
|
||||
should = chai.should()
|
||||
sinon = require('sinon')
|
||||
sinonChai = require('sinon-chai')
|
||||
_ = require "underscore"
|
||||
|
||||
chai.use(sinonChai)
|
||||
|
||||
Yatta = require "../lib/Frameworks/TextYatta.coffee"
|
||||
Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee"
|
||||
###
|
||||
describe "TextYatta", ->
|
||||
beforeEach (done)->
|
||||
@last_user = 10
|
||||
@users = []
|
||||
@Connector = Connector_uninitialized @users
|
||||
for i in [0..(@last_user+1)]
|
||||
@users.push(new Yatta i, @Connector)
|
||||
done()
|
||||
|
||||
it "handles inserts correctly", ->
|
||||
|
||||
|
||||
it "can handle many engines, many operations, concurrently (random)", ->
|
||||
number_of_test_cases_multiplier = 1
|
||||
repeat_this = 1 * number_of_test_cases_multiplier
|
||||
doSomething_amount = 500 * number_of_test_cases_multiplier
|
||||
number_of_engines = 12 + number_of_test_cases_multiplier - 1
|
||||
#maximum_ops_per_engine = 20 * number_of_test_cases_multiplier
|
||||
|
||||
@time = 0
|
||||
@ops = 0
|
||||
users = []
|
||||
|
||||
generateInsertOp = (user_num)->
|
||||
chars = "1234567890"
|
||||
|
||||
pos = _.random 0, (users[user_num].val().length-1)
|
||||
length = 1 #_.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
|
||||
users[user_num].insertText pos, text
|
||||
null
|
||||
|
||||
generateReplaceOp = (user_num)->
|
||||
chars = "abcdefghijklmnopqrstuvwxyz"
|
||||
length = _.random 0, 10
|
||||
|
||||
nextchar = chars[(_.random 0, (chars.length-1))]
|
||||
|
||||
text = ""
|
||||
_(length).times ()-> text += nextchar
|
||||
users[user_num].replaceText text
|
||||
|
||||
generateDeleteOp = (user_num)->
|
||||
if users[user_num].val().length > 0
|
||||
pos = _.random 0, (users[user_num].val().length-1)
|
||||
length = 1 # _.random 0, ot.val().length - pos
|
||||
ops1 = users[user_num].deleteText pos, length
|
||||
undefined
|
||||
|
||||
generateRandomOp = (user_num)->
|
||||
op_gen = [generateDeleteOp, generateInsertOp, generateReplaceOp]
|
||||
i = _.random (op_gen.length - 1)
|
||||
op = op_gen[i](user_num)
|
||||
|
||||
applyRandomOp = (user_num)->
|
||||
user = users[user_num]
|
||||
user.getConnector().flushOneRandom()
|
||||
|
||||
doSomething = do ()->
|
||||
()->
|
||||
user_num = _.random (number_of_engines-1)
|
||||
choices = [applyRandomOp, generateRandomOp]
|
||||
#if (users[user_num].buffer[user_num].length < maximum_ops_per_engine)
|
||||
# choices = choices.concat generateRandomOp
|
||||
|
||||
choice = _.random (choices.length-1)
|
||||
|
||||
choices[choice](user_num)
|
||||
|
||||
console.log ""
|
||||
for times in [1..repeat_this]
|
||||
#console.log "repeated_this x #{times} times"
|
||||
users = []
|
||||
Connector = Connector_uninitialized users
|
||||
for i in [0..number_of_engines]
|
||||
users.push(new Yatta i, Connector)
|
||||
|
||||
found_error = false
|
||||
|
||||
#try
|
||||
time_now = (new Date).getTime()
|
||||
for i in [1..doSomething_amount]
|
||||
doSomething()
|
||||
|
||||
for user,user_number in users
|
||||
user.getConnector().flushAll()
|
||||
|
||||
@time += (new Date()).getTime() - time_now
|
||||
|
||||
number_of_created_operations = 0
|
||||
for i in [0...(users.length)]
|
||||
number_of_created_operations += users[i].getConnector().getOpsInExecutionOrder().length
|
||||
@ops += number_of_created_operations*users.length
|
||||
|
||||
ops_per_msek = Math.floor(@ops/@time)
|
||||
console.log "#{times}/#{repeat_this}: Every collaborator (#{users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
|
||||
|
||||
console.log users[0].val()
|
||||
found_inconsistency = false
|
||||
for i in [0...(users.length-1)]
|
||||
if ((users[i].val() isnt users[i+1].val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
found_inconsistency =true
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)->
|
||||
ops = users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s,j in ops
|
||||
console.log "op#{j} = #{JSON.stringify s}"
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].val()).to.equal(\"#{users[otherotnumber].val()}\")"
|
||||
ops
|
||||
console.log ""
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in users
|
||||
console.log "OT#{j}: "+u.val()
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
|
||||
console.log ""
|
||||
if found_inconsistency
|
||||
throw new Error "dtrn"
|
||||
|
||||
# expect(users[i].ot.val()).to.equal(users[i+1].ot.val())
|
||||
|
||||
|
||||
###
|
@ -13,7 +13,7 @@ Connector_uninitialized = require "../lib/Connectors/TestConnector.coffee"
|
||||
class Test
|
||||
constructor: ()->
|
||||
@number_of_test_cases_multiplier = 1
|
||||
@repeat_this = 1 * @number_of_test_cases_multiplier
|
||||
@repeat_this = 1000 * @number_of_test_cases_multiplier
|
||||
@doSomething_amount = 5000 * @number_of_test_cases_multiplier
|
||||
@number_of_engines = 10 + @number_of_test_cases_multiplier - 1
|
||||
|
||||
@ -21,16 +21,18 @@ class Test
|
||||
@ops = 0
|
||||
@time_now = 0
|
||||
|
||||
@debug = false
|
||||
|
||||
@reinitialize()
|
||||
|
||||
reinitialize: ()->
|
||||
|
||||
@users = []
|
||||
@Connector = Connector_uninitialized @users
|
||||
@users.push(new Yatta 0, @Connector)
|
||||
@users[0].val('name',"initial")
|
||||
for i in [1...@number_of_engines]
|
||||
for i in [0...@number_of_engines]
|
||||
@users.push(new Yatta i, @Connector)
|
||||
@users[0].val('name',"initial")
|
||||
@flushAll()
|
||||
|
||||
getSomeUser: ()->
|
||||
i = _.random 0, (@users.length-1)
|
||||
@ -61,7 +63,7 @@ class Test
|
||||
undefined
|
||||
|
||||
generateRandomOp: (user_num)=>
|
||||
op_gen = [@generateDeleteOp, @generateInsertOp, @generateReplaceOp]
|
||||
op_gen = [@generateDeleteOp, @generateInsertOp]#, @generateReplaceOp]
|
||||
i = _.random (op_gen.length - 1)
|
||||
op = op_gen[i](user_num)
|
||||
|
||||
@ -92,37 +94,41 @@ class Test
|
||||
ops_per_msek = Math.floor(@ops/@time)
|
||||
if test_number?
|
||||
console.log "#{test_number}/#{@repeat_this}: Every collaborator (#{@users.length}) applied #{number_of_created_operations} ops in a different order." + " Over all we consumed #{@ops} operations in #{@time/1000} seconds (#{ops_per_msek} ops/msek)."
|
||||
|
||||
console.log @users.length
|
||||
#console.log users[0].val('name').val()
|
||||
for i in [0...(@users.length-1)]
|
||||
if ((@users[i].val('name').val() isnt @users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)->
|
||||
ops = @users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s in ops
|
||||
console.log JSON.stringify s
|
||||
if not @debug
|
||||
if (@users[i].val('name').val() isnt @users[i+1].val('name').val())
|
||||
console.log "found error"
|
||||
expect(@users[i].val('name').val()).to.equal(@users[i+1].val('name').val())
|
||||
else
|
||||
if ((@users[i].val('name').val() isnt @users[i+1].val('name').val()) )# and (number_of_created_operations <= 6 or true)) or found_error
|
||||
printOpsInExecutionOrder = (otnumber, otherotnumber)=>
|
||||
ops = @users[otnumber].getConnector().getOpsInExecutionOrder()
|
||||
for s in ops
|
||||
console.log JSON.stringify s
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{@users[otherotnumber].val('name')}\")"
|
||||
ops
|
||||
console.log ""
|
||||
s = "ops = ["
|
||||
for o,j in ops
|
||||
if j isnt 0
|
||||
s += ", "
|
||||
s += "op#{j}"
|
||||
s += "]"
|
||||
console.log s
|
||||
console.log "@users[@last_user].ot.applyOps ops"
|
||||
console.log "expect(@users[@last_user].ot.val('name')).to.equal(\"#{users[otherotnumber].val('name')}\")"
|
||||
ops
|
||||
console.log ""
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in users
|
||||
console.log "OT#{j}: "+u.val('name')
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
console.log "Found an OT Puzzle!"
|
||||
console.log "OT states:"
|
||||
for u,j in @users
|
||||
console.log "OT#{j}: "+u.val('name')
|
||||
console.log "\nOT execution order (#{i},#{i+1}):"
|
||||
printOpsInExecutionOrder i, i+1
|
||||
console.log ""
|
||||
ops = printOpsInExecutionOrder i+1, i
|
||||
|
||||
console.log ""
|
||||
console.log ""
|
||||
|
||||
run: ()->
|
||||
console.log ''
|
||||
@ -136,6 +142,7 @@ class Test
|
||||
|
||||
describe "JsonYatta", ->
|
||||
beforeEach (done)->
|
||||
@timeout 50000
|
||||
@yTest = new Test()
|
||||
done()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user