@ethereumjs/verkle / 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 |
• _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 |
• Readonly
cacheSize: number
• checkpoints: Checkpoint
[]
• db: DB
<Uint8Array
, Uint8Array
>
▸ batch(opStack
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
opStack |
BatchDBOp <Uint8Array , Uint8Array >[] |
Promise
<void
>
DB.batch
▸ checkpoint(root
): void
Adds a new checkpoint to the stack
Name | Type |
---|---|
root |
Uint8Array |
void
▸ commit(): Promise
<void
>
Commits the latest checkpoint
Promise
<void
>
▸ del(key
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
Promise
<void
>
DB.del
▸ get(key
): Promise
<undefined
| Uint8Array
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
Promise
<undefined
| Uint8Array
>
DB.get
▸ hasCheckpoints(): boolean
Is the DB during a checkpoint phase?
boolean
▸ open(): Promise
<void
>
Promise
<void
>
DB.open
▸ put(key
, value
): Promise
<void
>
Inherit Doc
Name | Type |
---|---|
key |
Uint8Array |
value |
Uint8Array |
Promise
<void
>
DB.put
▸ revert(): Promise
<Uint8Array
>
Reverts the latest checkpoint
Promise
<Uint8Array
>
▸ setCheckpoints(checkpoints
): void
Flush the checkpoints and use the given checkpoints instead.
Name | Type |
---|---|
checkpoints |
Checkpoint [] |
void
▸ shallowCopy(): CheckpointDB
Inherit Doc
DB.shallowCopy
▸ 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 |