node-inspector
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
/* global Struct, RBTree, Y, compareIds */
|
||||
'use strict'
|
||||
|
||||
function copyObject (o) {
|
||||
var c = {}
|
||||
@@ -8,7 +9,7 @@ function copyObject (o) {
|
||||
return c
|
||||
}
|
||||
|
||||
class DeleteStore extends RBTree { // eslint-disable-line
|
||||
class DeleteStore extends Y.RBTree {
|
||||
constructor () {
|
||||
super()
|
||||
}
|
||||
@@ -116,8 +117,10 @@ class DeleteStore extends RBTree { // eslint-disable-line
|
||||
}
|
||||
}
|
||||
|
||||
Y.DeleteStore = DeleteStore
|
||||
|
||||
Y.Memory = (function () { // eslint-disable-line no-unused-vars
|
||||
class Transaction extends AbstractTransaction { // eslint-disable-line
|
||||
class Transaction extends Y.AbstractTransaction { // eslint-disable-line
|
||||
|
||||
constructor (store) {
|
||||
super(store)
|
||||
@@ -130,7 +133,7 @@ Y.Memory = (function () { // eslint-disable-line no-unused-vars
|
||||
if (n !== null && n.val.id[0] === state.user) {
|
||||
state.clock = Math.max(state.clock, n.val.id[1] + n.val.len)
|
||||
}
|
||||
}
|
||||
}
|
||||
* getDeleteSet (id) {
|
||||
return this.ds.toDeleteSet(id)
|
||||
}
|
||||
@@ -245,7 +248,7 @@ Y.Memory = (function () { // eslint-disable-line no-unused-vars
|
||||
return op
|
||||
}
|
||||
}
|
||||
class OperationStore extends AbstractOperationStore { // eslint-disable-line no-undef
|
||||
class OperationStore extends Y.AbstractOperationStore { // eslint-disable-line no-undef
|
||||
constructor (y, opts) {
|
||||
super(y, opts)
|
||||
this.os = new RBTree()
|
||||
@@ -257,10 +260,11 @@ Y.Memory = (function () { // eslint-disable-line no-unused-vars
|
||||
logTable () {
|
||||
this.os.logTable()
|
||||
}
|
||||
requestTransaction (_makeGen, requestNow = false) {
|
||||
requestTransaction (_makeGen, requestNow) {
|
||||
if (requestNow == null) { requestNow = false }
|
||||
if (!this.transactionInProgress) {
|
||||
this.transactionInProgress = true
|
||||
var transact = () => {
|
||||
var transact = (xxxx) => {
|
||||
var makeGen = _makeGen
|
||||
while (makeGen != null) {
|
||||
var t = new Transaction(this)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
/* global DeleteStore */
|
||||
/* global Y */
|
||||
/* eslint-env browser,jasmine,console */
|
||||
|
||||
var DeleteStore = Y.DeleteStore
|
||||
|
||||
describe('Memory', function () {
|
||||
describe('DeleteStore', function () {
|
||||
var ds
|
||||
|
||||
@@ -1,4 +1,8 @@
|
||||
/* global compareIds, copyObject */
|
||||
/* global Y, copyObject */
|
||||
'use strict'
|
||||
|
||||
var compareIds = Y.compareIds
|
||||
|
||||
function smaller (a, b) {
|
||||
return a[0] < b[0] || (a[0] === b[0] && a[1] < b[1])
|
||||
}
|
||||
@@ -26,8 +30,8 @@ class N {
|
||||
return this._parent
|
||||
}
|
||||
get sibling () {
|
||||
return (this === this.parent.left) ?
|
||||
this.parent.right : this.parent.left
|
||||
return (this === this.parent.left)
|
||||
? this.parent.right : this.parent.left
|
||||
}
|
||||
get left () {
|
||||
return this._left
|
||||
@@ -192,7 +196,9 @@ class RBTree { // eslint-disable-line no-unused-vars
|
||||
}
|
||||
return true
|
||||
}
|
||||
logTable (from = null, to = null) {
|
||||
logTable (from, to) {
|
||||
if (from == null) { from = null }
|
||||
if (to == null) { to = null }
|
||||
var os = []
|
||||
this.iterate(from, to, function (o) {
|
||||
var o_ = copyObject(o)
|
||||
@@ -453,3 +459,5 @@ class RBTree { // eslint-disable-line no-unused-vars
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Y.RBTree = RBTree
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
/* global RBTree, smaller, compareIds */
|
||||
/* global Y */
|
||||
/* eslint-env browser,jasmine,console */
|
||||
|
||||
var RBTree = Y.RBTree
|
||||
var compareIds = Y.compareIds
|
||||
var smaller = Y.smaller
|
||||
var numberOfRBTreeTests = 1000
|
||||
|
||||
function itRedNodesDoNotHaveBlackChildren (tree) {
|
||||
|
||||
Reference in New Issue
Block a user