SingleBufferStoreV2
Defined in: src/backends/single_buffer/v2.ts:630
A store for version 2 of the single-buffer format.
Every change is a transaction that copies what it modifies. Readers never block, and an interrupted writer does not change the file system.
Extends
Section titled “Extends”DataView<ArrayBufferLike>
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SingleBufferStoreV2(
buffer,byteOffset?,byteLength?,options?):SingleBufferStore
Defined in: src/backends/single_buffer/v2.ts:671
Opens a file system, or creates one if format is set.
When creating one, byte ranges in used are kept, and the first transaction runs populate after making everything else free.
Parameters
Section titled “Parameters”buffer
Section titled “buffer”ArrayBufferLike | ArrayBufferView<ArrayBufferLike>
byteOffset?
Section titled “byteOffset?”number = 0
byteLength?
Section titled “byteLength?”number
options?
Section titled “options?”SingleBufferStoreOptions = {}
Returns
Section titled “Returns”SingleBufferStore
Overrides
Section titled “Overrides”DataView<ArrayBufferLike>.constructor
Properties
Section titled “Properties”Defined in: src/backends/single_buffer/v2.ts:898
[toStringTag]
Section titled “[toStringTag]”
readonly[toStringTag]:string
Defined in: ../../node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts:274
Inherited from
Section titled “Inherited from”DataView.[toStringTag]
blockSize
Section titled “blockSize”
readonlyblockSize:number
Defined in: src/backends/single_buffer/v2.ts:648
Internal
buffer
Section titled “buffer”
readonlybuffer:ArrayBufferLike
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1745
Inherited from
Section titled “Inherited from”DataView.buffer
byteLength
Section titled “byteLength”
readonlybyteLength:number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1746
Inherited from
Section titled “Inherited from”DataView.byteLength
byteOffset
Section titled “byteOffset”
readonlybyteOffset:number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1747
Inherited from
Section titled “Inherited from”DataView.byteOffset
readonlybytes:Uint8Array
Defined in: src/backends/single_buffer/v2.ts:645
Internal
The entire file system
commits
Section titled “commits”
protectedreadonlycommits: [Commit,Commit]
Defined in: src/backends/single_buffer/v2.ts:656
epochs
Section titled “epochs”
readonlyepochs:EpochTable
Defined in: src/backends/single_buffer/v2.ts:651
Internal
readonlyflags: readonly ["partial","atomic"]
Defined in: src/backends/single_buffer/v2.ts:631
Use for optimizations
Implementation of
Section titled “Implementation of”generation
Section titled “generation”
protectedreadonlygeneration:BigInt64Array
Defined in: src/backends/single_buffer/v2.ts:654
protectedreadonlyindex:BPlusTree<bigint,DataExtent>
Defined in: src/backends/single_buffer/v2.ts:662
The index of the version being read
protectedreadonlymutex:Mutex
Defined in: src/backends/single_buffer/v2.ts:653
readonlyname:"sbfs"='sbfs'
Defined in: src/backends/single_buffer/v2.ts:632
What the file system using this store should be called. For example, tmpfs for an in memory store
Implementation of
Section titled “Implementation of”nextId
Section titled “nextId”
protectedreadonlynextId:BigInt64Array
Defined in: src/backends/single_buffer/v2.ts:655
pinned?
Section titled “pinned?”
protectedoptionalpinned?:object
Defined in: src/backends/single_buffer/v2.ts:665
Pins the oldest version read by this thread’s unfinished reads
release
Section titled “release”release: () =>
void
Returns
Section titled “Returns”void
users:
number
readOnly
Section titled “readOnly”
readonlyreadOnly:BPlusTreeStorage
Defined in: src/backends/single_buffer/v2.ts:659
Internal
superblock
Section titled “superblock”
protectedreadonlysuperblock:SuperBlock
Defined in: src/backends/single_buffer/v2.ts:639
readonlytype:1935828595=0x73626673
Defined in: src/backends/single_buffer/v2.ts:633
FileSystem#id
Implementation of
Section titled “Implementation of”Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get uuid():
`${string}-${string}-${string}-${string}-${string}`
Defined in: src/backends/single_buffer/v2.ts:635
A UUID for this instance of the store.
Returns
Section titled “Returns”`${string}-${string}-${string}-${string}-${string}`
A UUID for this instance of the store.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”allocId()
Section titled “allocId()”allocId(): [
ino:number,data:number]
Defined in: src/backends/single_buffer/v2.ts:885
Allocate IDs for a new inode + data
Returns
Section titled “Returns”[ino: number, data: number]
Implementation of
Section titled “Implementation of”copy()
Section titled “copy()”copy(
extent,offset,end?):Uint8Array<ArrayBufferLike> |undefined
Defined in: src/backends/single_buffer/v2.ts:871
Internal
Copies the bytes of an extent from offset to end
Parameters
Section titled “Parameters”extent
Section titled “extent”Extent | undefined
offset
Section titled “offset”number
number
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
delete()
Section titled “delete()”delete(
id):void
Defined in: src/backends/single_buffer/v2.ts:881
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”get(
id,offset?,end?):Uint8Array<ArrayBufferLike> |undefined
Defined in: src/backends/single_buffer/v2.ts:863
Parameters
Section titled “Parameters”number
offset?
Section titled “offset?”number = 0
number
Returns
Section titled “Returns”Uint8Array<ArrayBufferLike> | undefined
Implementation of
Section titled “Implementation of”getBigInt64()
Section titled “getBigInt64()”getBigInt64(
byteOffset,littleEndian?):bigint
Defined in: ../../node_modules/typescript/lib/lib.es2020.bigint.d.ts:732
Gets the BigInt64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”bigint
Inherited from
Section titled “Inherited from”DataView.getBigInt64
getBigUint64()
Section titled “getBigUint64()”getBigUint64(
byteOffset,littleEndian?):bigint
Defined in: ../../node_modules/typescript/lib/lib.es2020.bigint.d.ts:740
Gets the BigUint64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”bigint
Inherited from
Section titled “Inherited from”DataView.getBigUint64
getFloat16()
Section titled “getFloat16()”getFloat16(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es2025.float16.d.ts:434
Gets the Float16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getFloat16
getFloat32()
Section titled “getFloat32()”getFloat32(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1754
Gets the Float32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getFloat32
getFloat64()
Section titled “getFloat64()”getFloat64(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1762
Gets the Float64 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getFloat64
getInt16()
Section titled “getInt16()”getInt16(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1777
Gets the Int16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getInt16
getInt32()
Section titled “getInt32()”getInt32(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1784
Gets the Int32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getInt32
getInt8()
Section titled “getInt8()”getInt8(
byteOffset):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1769
Gets the Int8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getInt8
getUint16()
Section titled “getUint16()”getUint16(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1799
Gets the Uint16 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getUint16
getUint32()
Section titled “getUint32()”getUint32(
byteOffset,littleEndian?):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1807
Gets the Uint32 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be read.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getUint32
getUint8()
Section titled “getUint8()”getUint8(
byteOffset):number
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1791
Gets the Uint8 value at the specified byte offset from the start of the view. There is no alignment constraint; multi-byte values may be fetched from any offset.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be retrieved.
Returns
Section titled “Returns”number
Inherited from
Section titled “Inherited from”DataView.getUint8
keys()
Section titled “keys()”keys():
number[]
Defined in: src/backends/single_buffer/v2.ts:859
Returns
Section titled “Returns”number[]
Implementation of
Section titled “Implementation of”read()
Section titled “read()”
protectedread<T>(read):T
Defined in: src/backends/single_buffer/v2.ts:827
Runs read against the current version
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”(index) => T
Returns
Section titled “Returns”T
set(
id,data,offset?):void
Defined in: src/backends/single_buffer/v2.ts:877
Parameters
Section titled “Parameters”number
Uint8Array
offset?
Section titled “offset?”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setBigInt64()
Section titled “setBigInt64()”setBigInt64(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es2020.bigint.d.ts:748
Stores a BigInt64 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
bigint
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setBigInt64
setBigUint64()
Section titled “setBigUint64()”setBigUint64(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es2020.bigint.d.ts:756
Stores a BigUint64 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
bigint
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setBigUint64
setFloat16()
Section titled “setFloat16()”setFloat16(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es2025.float16.d.ts:442
Stores an Float16 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setFloat16
setFloat32()
Section titled “setFloat32()”setFloat32(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1815
Stores an Float32 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setFloat32
setFloat64()
Section titled “setFloat64()”setFloat64(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1823
Stores an Float64 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setFloat64
setInt16()
Section titled “setInt16()”setInt16(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1838
Stores an Int16 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setInt16
setInt32()
Section titled “setInt32()”setInt32(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1846
Stores an Int32 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setInt32
setInt8()
Section titled “setInt8()”setInt8(
byteOffset,value):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1830
Stores an Int8 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setInt8
setUint16()
Section titled “setUint16()”setUint16(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1861
Stores an Uint16 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setUint16
setUint32()
Section titled “setUint32()”setUint32(
byteOffset,value,littleEndian?):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1869
Stores an Uint32 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
littleEndian?
Section titled “littleEndian?”boolean
If false or undefined, a big-endian value should be written.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setUint32
setUint8()
Section titled “setUint8()”setUint8(
byteOffset,value):void
Defined in: ../../node_modules/typescript/lib/lib.es5.d.ts:1853
Stores an Uint8 value at the specified byte offset from the start of the view.
Parameters
Section titled “Parameters”byteOffset
Section titled “byteOffset”number
The place in the buffer at which the value should be set.
number
The value to set.
Returns
Section titled “Returns”void
Inherited from
Section titled “Inherited from”DataView.setUint8
snapshot()
Section titled “snapshot()”snapshot():
Snapshot
Defined in: src/backends/single_buffer/v2.ts:797
Internal
Pins the current version, which stays readable until the snapshot is disposed. Snapshots in the same thread share one pin of the oldest version.
Returns
Section titled “Returns”Snapshot
sync()
Section titled “sync()”sync():
Promise<void>
Defined in: src/backends/single_buffer/v2.ts:909
Syncs the store
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”transaction()
Section titled “transaction()”transaction():
SingleBufferTransaction
Defined in: src/backends/single_buffer/v2.ts:913
Begins a new transaction.
Returns
Section titled “Returns”SingleBufferTransaction
Implementation of
Section titled “Implementation of”usage()
Section titled “usage()”usage():
UsageInfo
Defined in: src/backends/single_buffer/v2.ts:891
Usage information for the store
Returns
Section titled “Returns”Implementation of
Section titled “Implementation of”withCurrentCommit()
Section titled “withCurrentCommit()”
protectedwithCurrentCommit<T>(read):T
Defined in: src/backends/single_buffer/v2.ts:784
Reads the current commit, retrying if a writer replaces it while reading
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”(commit, generation) => T
Returns
Section titled “Returns”T
write()
Section titled “write()”write<
T>(change):T
Defined in: src/backends/single_buffer/v2.ts:834
Runs change in a write transaction, retrying with more spare blocks if the free trees run out of them
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”change
Section titled “change”(tx) => T
Returns
Section titled “Returns”T