Use generic Item with typed content to reduce cache misses

This commit is contained in:
Kevin Jahns
2019-05-28 14:18:20 +02:00
parent 3fba4f25a5
commit 2192aa5821
42 changed files with 1958 additions and 3007 deletions

View File

@@ -12,14 +12,16 @@ import * as error from 'lib0/error.js'
export class AbstractStruct {
/**
* @param {ID} id
* @param {number} length
*/
constructor (id) {
constructor (id, length) {
/**
* The uniqe identifier of this struct.
* @type {ID}
* @readonly
*/
this.id = id
this.length = length
this.deleted = false
}
/**
@@ -32,12 +34,6 @@ export class AbstractStruct {
mergeWith (right) {
return false
}
/**
* @type {number}
*/
get length () {
throw error.methodUnimplemented()
}
/**
* @param {encoding.Encoder} encoder The encoder to write data to.
* @param {number} offset
@@ -89,10 +85,4 @@ export class AbstractStructRef {
toStruct (transaction, store, offset) {
throw error.methodUnimplemented()
}
/**
* @type {number}
*/
get length () {
return 1
}
}