Skip to content

Latest commit

 

History

History
363 lines (205 loc) · 6.98 KB

File metadata and controls

363 lines (205 loc) · 6.98 KB

@ethereumjs/statemanager / AccountCache

Class: AccountCache

Hierarchy

  • Cache

    AccountCache

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new AccountCache(opts)

Parameters

Name Type
opts CacheOpts

Overrides

Cache.constructor

Defined in

cache/account.ts:36

Properties

_checkpoints

_checkpoints: number = 0

Inherited from

Cache._checkpoints

Defined in

cache/cache.ts:9


_debug

_debug: Debugger

Inherited from

Cache._debug

Defined in

cache/cache.ts:7


_diffCache

_diffCache: Map<string, undefined | AccountCacheElement>[] = []

Diff cache collecting the state of the cache at the beginning of checkpoint height (respectively: before a first modification)

If the whole cache element is undefined (in contrast to the account), the element didn't exist in the cache before.

Defined in

cache/account.ts:35


_lruCache

_lruCache: undefined | LRUCache<string, AccountCacheElement, unknown>

Defined in

cache/account.ts:23


_orderedMapCache

_orderedMapCache: undefined | OrderedMap<string, AccountCacheElement>

Defined in

cache/account.ts:24


_stats

_stats: Object

Type declaration

Name Type
dels number
hits number
reads number
size number
writes number

Inherited from

Cache._stats

Defined in

cache/cache.ts:11

Methods

_saveCachePreState

_saveCachePreState(cacheKeyHex): void

Parameters

Name Type
cacheKeyHex string

Returns

void

Defined in

cache/account.ts:51


checkpoint

checkpoint(): void

Marks current state of cache as checkpoint, which can later on be reverted or committed.

Returns

void

Defined in

cache/account.ts:214


clear

clear(): void

Clears cache.

Returns

void

Defined in

cache/account.ts:256


commit

commit(): void

Commits to current state of cache (no effect on trie).

Returns

void

Defined in

cache/account.ts:194


del

del(address): void

Marks address as deleted in cache.

Parameters

Name Type Description
address Address Address

Returns

void

Defined in

cache/account.ts:114


flush

flush(): [string, AccountCacheElement][]

Flushes cache by returning accounts that have been modified or deleted and resetting the diff cache (at checkpoint height).

Returns

[string, AccountCacheElement][]

Defined in

cache/account.ts:137


get

get(address): undefined | AccountCacheElement

Returns the queried account or undefined if account doesn't exist

Parameters

Name Type Description
address Address Address of account

Returns

undefined | AccountCacheElement

Defined in

cache/account.ts:91


put

put(address, account): void

Puts account to cache under its address.

Parameters

Name Type Description
address Address Address of account
account undefined | Account Account or undefined if account doesn't exist in the trie

Returns

void

Defined in

cache/account.ts:69


revert

revert(): void

Revert changes to cache last checkpoint (no effect on trie).

Returns

void

Defined in

cache/account.ts:166


size

size(): number

Returns the size of the cache

Returns

number

Defined in

cache/account.ts:226


stats

stats(reset?): Object

Returns a dict with cache stats

Parameters

Name Type Default value
reset boolean true

Returns

Object

Name Type
dels number
hits number
reads number
size number
writes number

Defined in

cache/account.ts:238