Skip to content

Latest commit

 

History

History
215 lines (119 loc) · 4.18 KB

File metadata and controls

215 lines (119 loc) · 4.18 KB

@ethereumjs/util / MapDB

Class: MapDB<TKey, TValue>

Type parameters

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

Implements

  • DB<TKey, TValue>

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new MapDB<TKey, TValue>(database?)

Type parameters

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

Parameters

Name Type
database? Map<TKey, TValue>

Defined in

packages/util/src/mapDB.ts:12

Properties

_database

_database: Map<TKey, TValue>

Defined in

packages/util/src/mapDB.ts:10

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>

Implementation of

DB.batch

Defined in

packages/util/src/mapDB.ts:31


del

del(key): Promise<void>

Removes a raw value in the underlying db.

Parameters

Name Type
key TKey

Returns

Promise<void>

Implementation of

DB.del

Defined in

packages/util/src/mapDB.ts:26


get

get(key): Promise<undefined | TValue>

Retrieves a raw value from db.

Parameters

Name Type
key TKey

Returns

Promise<undefined | TValue>

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

Implementation of

DB.get

Defined in

packages/util/src/mapDB.ts:16


open

open(): Promise<void>

Opens the database -- if applicable

Returns

Promise<void>

Implementation of

DB.open

Defined in

packages/util/src/mapDB.ts:52


put

put(key, val): Promise<void>

Writes a value directly to db.

Parameters

Name Type Description
key TKey The key as a TValue
val TValue -

Returns

Promise<void>

Implementation of

DB.put

Defined in

packages/util/src/mapDB.ts:21


shallowCopy

shallowCopy(): DB<TKey, TValue>

Note that the returned shallow copy will share the underlying database with the original

Returns

DB<TKey, TValue>

DB

Implementation of

DB.shallowCopy

Defined in

packages/util/src/mapDB.ts:48