@ethereumjs/trie / CheckpointDB
DB is a thin wrapper around the underlying levelup db, which validates inputs and sets encoding type.
DB
• new CheckpointDB(opts
)
Initialize a DB instance.
Name | Type |
---|---|
opts |
CheckpointDBOpts |
packages/trie/src/db/checkpoint.ts:50
• _stats: Object
Name | Type |
---|---|
cache |
{ hits : number = 0; reads : number = 0; writes : number = 0 } |
cache.hits |
number |
cache.reads |
number |
cache.writes |
number |
db |
{ hits : number = 0; reads : number = 0; writes : number = 0 } |
db.hits |
number |
db.reads |
number |
db.writes |
number |
packages/trie/src/db/checkpoint.ts:34
• Readonly
cacheSize: number
packages/trie/src/db/checkpoint.ts:19
• checkpoints: Checkpoint
[]
packages/trie/src/db/checkpoint.ts:17
• db: DB
<string
, string
| Uint8Array
>
packages/trie/src/db/checkpoint.ts:18
▸ batch(opStack
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
opStack |
BatchDBOp <Uint8Array , Uint8Array >[] |
Promise
<void
>
DB.batch
packages/trie/src/db/checkpoint.ts:230
▸ checkpoint(root
): void
Adds a new checkpoint to the stack
Name | Type |
---|---|
root |
Uint8Array |
void
packages/trie/src/db/checkpoint.ts:92
▸ commit(): Promise
<void
>
Commits the latest checkpoint
Promise
<void
>
packages/trie/src/db/checkpoint.ts:99
▸ del(key
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
Promise
<void
>
DB.del
packages/trie/src/db/checkpoint.ts:208
▸ get(key
): Promise
<undefined
| Uint8Array
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
Promise
<undefined
| Uint8Array
>
DB.get
packages/trie/src/db/checkpoint.ts:139
▸ hasCheckpoints(): boolean
Is the DB during a checkpoint phase?
boolean
packages/trie/src/db/checkpoint.ts:84
▸ open(): Promise
<void
>
Promise
<void
>
DB.open
packages/trie/src/db/checkpoint.ts:291
▸ put(key
, value
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
value |
Uint8Array |
Promise
<void
>
DB.put
packages/trie/src/db/checkpoint.ts:184
▸ revert(): Promise
<Uint8Array
>
Reverts the latest checkpoint
Promise
<Uint8Array
>
packages/trie/src/db/checkpoint.ts:131
▸ setCheckpoints(checkpoints
): void
Flush the checkpoints and use the given checkpoints instead.
Name | Type |
---|---|
checkpoints |
Checkpoint [] |
void
packages/trie/src/db/checkpoint.ts:70
▸ shallowCopy(): CheckpointDB
Inherit Doc
DB.shallowCopy
packages/trie/src/db/checkpoint.ts:283
▸ stats(reset?
): Object
Name | Type | Default value |
---|---|---|
reset |
boolean |
true |
Object
Name | Type |
---|---|
cache |
{ hits : number = 0; reads : number = 0; writes : number = 0 } |
cache.hits |
number |
cache.reads |
number |
cache.writes |
number |
db |
{ hits : number = 0; reads : number = 0; writes : number = 0 } |
db.hits |
number |
db.reads |
number |
db.writes |
number |
size |
number |