rename AbstractRef to AbstractStructRef
This commit is contained in:
parent
2ef11a5344
commit
9c29d820c8
@ -5,7 +5,7 @@ import {
|
|||||||
writeID,
|
writeID,
|
||||||
GC,
|
GC,
|
||||||
nextID,
|
nextID,
|
||||||
AbstractRef,
|
AbstractStructRef,
|
||||||
AbstractStruct,
|
AbstractStruct,
|
||||||
replaceStruct,
|
replaceStruct,
|
||||||
addStruct,
|
addStruct,
|
||||||
@ -487,7 +487,7 @@ export class AbstractItem extends AbstractStruct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AbstractItemRef extends AbstractRef {
|
export class AbstractItemRef extends AbstractStructRef {
|
||||||
/**
|
/**
|
||||||
* @param {decoding.Decoder} decoder
|
* @param {decoding.Decoder} decoder
|
||||||
* @param {ID} id
|
* @param {ID} id
|
||||||
|
@ -53,7 +53,7 @@ export class AbstractStruct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class AbstractRef {
|
export class AbstractStructRef {
|
||||||
/**
|
/**
|
||||||
* @param {ID} id
|
* @param {ID} id
|
||||||
*/
|
*/
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
* @module structs
|
* @module structs
|
||||||
*/
|
*/
|
||||||
import {
|
import {
|
||||||
AbstractRef,
|
AbstractStructRef,
|
||||||
AbstractStruct,
|
AbstractStruct,
|
||||||
createID,
|
createID,
|
||||||
addStruct,
|
addStruct,
|
||||||
@ -60,7 +60,7 @@ export class GC extends AbstractStruct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class GCRef extends AbstractRef {
|
export class GCRef extends AbstractStructRef {
|
||||||
/**
|
/**
|
||||||
* @param {decoding.Decoder} decoder
|
* @param {decoding.Decoder} decoder
|
||||||
* @param {ID} id
|
* @param {ID} id
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
// todo rename AbstractRef to abstractStructRef
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
GC,
|
GC,
|
||||||
Transaction, AbstractRef, ID, ItemType, AbstractItem, AbstractStruct // eslint-disable-line
|
Transaction, AbstractStructRef, ID, ItemType, AbstractItem, AbstractStruct // eslint-disable-line
|
||||||
} from '../internals.js'
|
} from '../internals.js'
|
||||||
|
|
||||||
import * as math from 'lib0/math.js'
|
import * as math from 'lib0/math.js'
|
||||||
@ -22,13 +21,13 @@ export class StructStore {
|
|||||||
* We could shift the array of refs instead, but shift is incredible
|
* We could shift the array of refs instead, but shift is incredible
|
||||||
* slow in Chrome for arrays with more than 100k elements
|
* slow in Chrome for arrays with more than 100k elements
|
||||||
* @see tryResumePendingStructRefs
|
* @see tryResumePendingStructRefs
|
||||||
* @type {Map<number,{i:number,refs:Array<AbstractRef>}>}
|
* @type {Map<number,{i:number,refs:Array<AbstractStructRef>}>}
|
||||||
*/
|
*/
|
||||||
this.pendingClientsStructRefs = new Map()
|
this.pendingClientsStructRefs = new Map()
|
||||||
/**
|
/**
|
||||||
* Stack of pending structs waiting for struct dependencies
|
* Stack of pending structs waiting for struct dependencies
|
||||||
* Maximum length of stack is structReaders.size
|
* Maximum length of stack is structReaders.size
|
||||||
* @type {Array<AbstractRef>}
|
* @type {Array<AbstractStructRef>}
|
||||||
*/
|
*/
|
||||||
this.pendingStack = []
|
this.pendingStack = []
|
||||||
/**
|
/**
|
||||||
|
@ -18,7 +18,7 @@ import {
|
|||||||
readDeleteSet,
|
readDeleteSet,
|
||||||
writeDeleteSet,
|
writeDeleteSet,
|
||||||
createDeleteSetFromStructStore,
|
createDeleteSetFromStructStore,
|
||||||
Transaction, AbstractStruct, AbstractRef, StructStore, ID // eslint-disable-line
|
Transaction, AbstractStruct, AbstractStructRef, StructStore, ID // eslint-disable-line
|
||||||
} from '../internals.js'
|
} from '../internals.js'
|
||||||
|
|
||||||
import * as encoding from 'lib0/encoding.js'
|
import * as encoding from 'lib0/encoding.js'
|
||||||
@ -64,11 +64,11 @@ const writeStructs = (encoder, structs, client, clock) => {
|
|||||||
* @param {decoding.Decoder} decoder
|
* @param {decoding.Decoder} decoder
|
||||||
* @param {number} numOfStructs
|
* @param {number} numOfStructs
|
||||||
* @param {ID} nextID
|
* @param {ID} nextID
|
||||||
* @return {Array<AbstractRef>}
|
* @return {Array<AbstractStructRef>}
|
||||||
*/
|
*/
|
||||||
const readStructRefs = (decoder, numOfStructs, nextID) => {
|
const readStructRefs = (decoder, numOfStructs, nextID) => {
|
||||||
/**
|
/**
|
||||||
* @type {Array<AbstractRef>}
|
* @type {Array<AbstractStructRef>}
|
||||||
*/
|
*/
|
||||||
const refs = []
|
const refs = []
|
||||||
for (let i = 0; i < numOfStructs; i++) {
|
for (let i = 0; i < numOfStructs; i++) {
|
||||||
@ -109,11 +109,11 @@ export const writeClientsStructs = (encoder, store, _sm) => {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {decoding.Decoder} decoder The decoder object to read data from.
|
* @param {decoding.Decoder} decoder The decoder object to read data from.
|
||||||
* @return {Map<number,Array<AbstractRef>>}
|
* @return {Map<number,Array<AbstractStructRef>>}
|
||||||
*/
|
*/
|
||||||
export const readClientsStructRefs = decoder => {
|
export const readClientsStructRefs = decoder => {
|
||||||
/**
|
/**
|
||||||
* @type {Map<number,Array<AbstractRef>>}
|
* @type {Map<number,Array<AbstractStructRef>>}
|
||||||
*/
|
*/
|
||||||
const clientRefs = new Map()
|
const clientRefs = new Map()
|
||||||
const numOfStateUpdates = decoding.readVarUint(decoder)
|
const numOfStateUpdates = decoding.readVarUint(decoder)
|
||||||
@ -227,9 +227,9 @@ export const tryResumePendingDeleteReaders = (transaction, store) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Map<number,{refs:Array<AbstractRef>,i:number}>} pendingClientsStructRefs
|
* @param {Map<number,{refs:Array<AbstractStructRef>,i:number}>} pendingClientsStructRefs
|
||||||
* @param {number} client
|
* @param {number} client
|
||||||
* @param {Array<AbstractRef>} refs
|
* @param {Array<AbstractStructRef>} refs
|
||||||
*/
|
*/
|
||||||
const setPendingClientsStructRefs = (pendingClientsStructRefs, client, refs) => {
|
const setPendingClientsStructRefs = (pendingClientsStructRefs, client, refs) => {
|
||||||
pendingClientsStructRefs.set(client, { refs, i: 0 })
|
pendingClientsStructRefs.set(client, { refs, i: 0 })
|
||||||
@ -243,7 +243,7 @@ export const writeStructsFromTransaction = (encoder, transaction) => writeClient
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {StructStore} store
|
* @param {StructStore} store
|
||||||
* @param {Map<number, Array<AbstractRef>>} clientsStructsRefs
|
* @param {Map<number, Array<AbstractStructRef>>} clientsStructsRefs
|
||||||
*/
|
*/
|
||||||
const mergeReadStructsIntoPendingReads = (store, clientsStructsRefs) => {
|
const mergeReadStructsIntoPendingReads = (store, clientsStructsRefs) => {
|
||||||
const pendingClientsStructRefs = store.pendingClientsStructRefs
|
const pendingClientsStructRefs = store.pendingClientsStructRefs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user