rename transaction._replacedItems to transaction._mergeStructs

This commit is contained in:
Kevin Jahns 2019-04-11 00:31:43 +02:00
parent 9c29d820c8
commit 759ecb21f7
5 changed files with 9 additions and 16 deletions

View File

@ -56,7 +56,7 @@ export const splitItem = (transaction, leftItem, diff) => {
rightItem.right.left = rightItem rightItem.right.left = rightItem
} }
// right is more specific. // right is more specific.
transaction._replacedItems.add(rightItem) transaction._mergeStructs.add(rightItem.id)
return rightItem return rightItem
} }
@ -430,7 +430,7 @@ export class AbstractItem extends AbstractStruct {
} }
} }
replaceStruct(store, this, r) replaceStruct(store, this, r)
transaction._replacedItems.add(r) transaction._mergeStructs.add(r.id)
} }
/** /**

View File

@ -2,8 +2,6 @@
* @module structs * @module structs
*/ */
// TODO: ItemBinary should be able to merge with right (similar to other items). Or the other items (ItemJSON) should not be able to merge - extra byte + consistency
import { import {
AbstractItem, AbstractItem,
AbstractItemRef, AbstractItemRef,

View File

@ -14,7 +14,7 @@ import {
callEventHandlerListeners, callEventHandlerListeners,
AbstractItem, AbstractItem,
ItemDeleted, ItemDeleted,
AbstractType, AbstractStruct, YEvent, Y // eslint-disable-line ID, AbstractType, AbstractStruct, YEvent, Y // eslint-disable-line
} from '../internals.js' } from '../internals.js'
import * as encoding from 'lib0/encoding.js' import * as encoding from 'lib0/encoding.js'
@ -86,9 +86,9 @@ export class Transaction {
*/ */
this._updateMessage = null this._updateMessage = null
/** /**
* @type {Set<AbstractStruct>} * @type {Set<ID>}
*/ */
this._replacedItems = new Set() this._mergeStructs = new Set()
} }
/** /**
* @type {encoding.Encoder|null} * @type {encoding.Encoder|null}
@ -213,12 +213,10 @@ export const transact = (y, f) => {
} }
} }
} }
// try to merge replacedItems // try to merge mergeStructs
// TODO: replacedItems should hold ids for (const mid of transaction._mergeStructs) {
for (const replacedItem of transaction._replacedItems) { const client = mid.client
const id = replacedItem.id const clock = mid.clock
const client = id.client
const clock = id.clock
/** /**
* @type {Array<AbstractStruct>} * @type {Array<AbstractStruct>}
*/ */

View File

@ -148,7 +148,6 @@ export const readClientsStructRefs = decoder => {
* @param {Transaction} transaction * @param {Transaction} transaction
* @param {StructStore} store * @param {StructStore} store
* *
* @todo reimplement without iterators - read everything in arrays instead
*/ */
const resumeStructIntegration = (transaction, store) => { const resumeStructIntegration = (transaction, store) => {
const stack = store.pendingStack const stack = store.pendingStack

View File

@ -306,8 +306,6 @@ const arrayTransactions = [
} }
] ]
// TODO: http://127.0.0.1:3443/?filter=\[22/&seed=1943600076
/** /**
* @param {t.TestCase} tc * @param {t.TestCase} tc
*/ */