Skip to content

API reference / @jsprismarine/leveldb / WriteBatch

Class: WriteBatch ​

Defined in: format/WriteBatch.ts:20

A set of writes applied together.

On disk a batch is the unit the write-ahead log stores: an 8 byte sequence number, a 4 byte count, then the operations. The sequence belongs to the first operation and the rest follow it, which is why the batch is also the unit sequence numbers are handed out in.

Constructors ​

Constructor ​

new WriteBatch(): WriteBatch

Returns ​

WriteBatch

Accessors ​

approximateSize ​

Get Signature ​

get approximateSize(): number

Defined in: format/WriteBatch.ts:40

Returns ​

number


count ​

Get Signature ​

get count(): number

Defined in: format/WriteBatch.ts:36

Returns ​

number

Methods ​

clear() ​

clear(): void

Defined in: format/WriteBatch.ts:48

Returns ​

void


del() ​

del(key): this

Defined in: format/WriteBatch.ts:30

Parameters ​

key ​

Buffer

Returns ​

this


encode() ​

encode(sequence): Buffer

Defined in: format/WriteBatch.ts:53

Parameters ​

sequence ​

bigint

Returns ​

Buffer


entries() ​

entries(): readonly BatchOperation[]

Defined in: format/WriteBatch.ts:44

Returns ​

readonly BatchOperation[]


put() ​

put(key, value): this

Defined in: format/WriteBatch.ts:24

Parameters ​

key ​

Buffer

value ​

Buffer

Returns ​

this


decode() ​

static decode(encoded): object

Defined in: format/WriteBatch.ts:65

Parameters ​

encoded ​

Buffer

Returns ​

object

batch ​

batch: WriteBatch

sequence ​

sequence: bigint