ethereumjs-monorepo

@ethereumjs/util / DB

Interface: DB<TKey, TValue>

Type parameters

Name Type
TKey extends Uint8Array | string | number = Uint8Array
TValue extends Uint8Array | string | DBObject = Uint8Array

Implemented by

Table of contents

Methods

Methods

batch

batch(opStack): Promise<void>

Performs a batch operation on db.

Parameters

Name Type Description
opStack BatchDBOp<TKey, TValue>[] A stack of levelup operations

Returns

Promise<void>

Defined in

packages/util/src/db.ts:69


del

del(key, opts?): Promise<void>

Removes a raw value in the underlying db.

Parameters

Name Type
key TKey
opts? EncodingOpts

Returns

Promise<void>

Defined in

packages/util/src/db.ts:63


get

get(key, opts?): Promise<undefined | TValue>

Retrieves a raw value from db.

Parameters

Name Type
key TKey
opts? EncodingOpts

Returns

Promise<undefined | TValue>

A Promise that resolves to Uint8Array if a value is found or undefined if no value is found.

Defined in

packages/util/src/db.ts:50


open

open(): Promise<void>

Opens the database – if applicable

Returns

Promise<void>

Defined in

packages/util/src/db.ts:80


put

put(key, val, opts?): Promise<void>

Writes a value directly to db.

Parameters

Name Type Description
key TKey The key as a TValue
val TValue -
opts? EncodingOpts -

Returns

Promise<void>

Defined in

packages/util/src/db.ts:57


shallowCopy

shallowCopy(): DB<TKey, TValue>

Returns a copy of the DB instance, with a reference to the same underlying db instance.

Returns

DB<TKey, TValue>

Defined in

packages/util/src/db.ts:75