fixed some consistency bugs. new method seems to work well, it still has problems though

This commit is contained in:
Kevin Jahns 2015-09-29 01:01:04 +02:00
parent acf8d37616
commit 638c575dfc
4 changed files with 9 additions and 4 deletions

View File

@ -87,7 +87,7 @@ var files = {
src: polyfills.concat(concatOrder.map(function (f) { src: polyfills.concat(concatOrder.map(function (f) {
return 'src/' + f return 'src/' + f
})), })),
test: ['Helper.spec.js'].concat(concatOrder.map(function (f) { test: ['build/Helper.spec.js'].concat(concatOrder.map(function (f) {
return 'build/' + f return 'build/' + f
}).concat(['build/**/*.spec.js'])) }).concat(['build/**/*.spec.js']))
} }

View File

@ -167,6 +167,11 @@ class AbstractTransaction {
} }
* garbageCollectOperation (id) { * garbageCollectOperation (id) {
var o = yield* this.getOperation(id) var o = yield* this.getOperation(id)
if (o == null) {
return
}
if (!o.deleted) { if (!o.deleted) {
yield* this.deleteOperation(id) yield* this.deleteOperation(id)
o = yield* this.getOperation(id) o = yield* this.getOperation(id)
@ -422,7 +427,7 @@ class AbstractOperationStore {
} else { } else {
while (op != null) { while (op != null) {
var state = yield* this.getState(op.id[0]) var state = yield* this.getState(op.id[0])
if (op.id[1] === state.clock || (op.id[1] < state.clock && (yield* this.getOperation(op.id)) == null)) { if (op.id[1] === state.clock) {
// either its a new operation (1. case), or it is an operation that was deleted, but is not yet in the OS // either its a new operation (1. case), or it is an operation that was deleted, but is not yet in the OS
if (op.id[1] === state.clock) { if (op.id[1] === state.clock) {
state.clock++ state.clock++

View File

@ -110,7 +110,7 @@ Y.Memory = (function () {
} }
* checkDeleteStoreForState (state) { * checkDeleteStoreForState (state) {
var n = this.ds.findNodeWithUpperBound([state.user, state.clock]) var n = this.ds.findNodeWithUpperBound([state.user, state.clock])
if (n !== null && n.val.id[0] === state.user) { if (n !== null && n.val.id[0] === state.user && n.val.gc) {
state.clock = Math.max(state.clock, n.val.id[1] + n.val.len) state.clock = Math.max(state.clock, n.val.id[1] + n.val.len)
} }
} }

View File

@ -1,7 +1,7 @@
/* global createUsers, wait, Y, compareAllUsers, getRandomNumber, applyRandomTransactions, async, garbageCollectAllUsers, describeManyTimes */ /* global createUsers, wait, Y, compareAllUsers, getRandomNumber, applyRandomTransactions, async, garbageCollectAllUsers, describeManyTimes */
/* eslint-env browser,jasmine */ /* eslint-env browser,jasmine */
var numberOfYArrayTests = 50 var numberOfYArrayTests = 10
var repeatArrayTests = 300 var repeatArrayTests = 300
describe('Array Type', function () { describe('Array Type', function () {