fixed some cases that lead to inconsistencies
This commit is contained in:
parent
82025c5de9
commit
f46c8df605
@ -342,10 +342,24 @@ module.exports = function (Y /* :any */) {
|
||||
this.store.addToDebug('yield* this.store.tryExecute.call(this, ', JSON.stringify(op), ')')
|
||||
if (op.struct === 'Delete') {
|
||||
yield* Y.Struct.Delete.execute.call(this, op)
|
||||
// the following is now called in Transaction.deleteOperation!
|
||||
// this is now called in Transaction.deleteOperation!
|
||||
// yield* this.store.operationAdded(this, op)
|
||||
} else {
|
||||
// check if this op was defined
|
||||
var defined = yield* this.getOperation(op.id)
|
||||
while (defined != null && defined.content != null) {
|
||||
// check if this op has a longer content in the case it is defined
|
||||
if (defined.content.length < op.content.length) {
|
||||
var diff = op.content.length - defined.content.length
|
||||
op.content.splice(0, diff)
|
||||
op.id = [op.id[0], op.id[1] + diff]
|
||||
op.left = defined.id
|
||||
op.origin = defined.id
|
||||
defined = yield* this.getOperation(op.id)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
}
|
||||
if (defined == null) {
|
||||
var isGarbageCollected = yield* this.isGarbageCollected(op.id)
|
||||
if (!isGarbageCollected) {
|
||||
|
@ -434,12 +434,6 @@ module.exports = function (Y/* :any */) {
|
||||
op.deleted = true
|
||||
if (op.opContent != null) {
|
||||
yield* this.deleteOperation(op.opContent)
|
||||
/*
|
||||
var opContent = yield* this.getOperation(op.opContent)
|
||||
opContent.gc = true
|
||||
yield* this.setOperation(opContent)
|
||||
this.store.gc1.push(opContent.id)
|
||||
*/
|
||||
}
|
||||
if (op.requires != null) {
|
||||
for (var i = 0; i < op.requires.length; i++) {
|
||||
@ -995,9 +989,12 @@ module.exports = function (Y/* :any */) {
|
||||
}
|
||||
var startPos = startSS[user] || 0
|
||||
if (startPos > 0) {
|
||||
// There is a change that [user, startPos] is in a composed Insertion (with a smaller counter)
|
||||
// find out if that is the case
|
||||
var firstMissing = yield* this.getInsertion([user, startPos])
|
||||
if (firstMissing != null) {
|
||||
// TODO: Send missing depending on content! Also try to recognize this on the receiving end!
|
||||
// update startPos
|
||||
startPos = firstMissing.id[1]
|
||||
}
|
||||
}
|
||||
yield* this.os.iterate(this, [user, startPos], [user, Number.MAX_VALUE], function * (op) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user