Skip to content

Commit

Permalink
feat(reku): add storeKeyPrefix for auto ccer
Browse files Browse the repository at this point in the history
  • Loading branch information
nom4dv3 committed Aug 13, 2024
1 parent 6a64a83 commit 83cc70e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/reku/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ i.e. It starts with 'realtime' mode by default.

Options:
- `store`?: the Store used to cache the <txhash, logindex> that already processed.
- `storeKeyPrefix`?: set the prefix to all keys when set key-value to store (cache), e.g. key = prefix+'txHashList', prefix can be "project:app:" to form a "project:app:txHashList" redis key.
- `batchBlocksCount`?: how many blocks to get per `getLogs` check, in readtime mode it waits until the new block num >= `batchBlocksCount`.
- `pollingInterval`?: how long does it take between 2 block height check polling checks; mostly for limiting getLogs calling rate in catchup mode
- `blockInterval`?: the block interval (in ms) of the given chain, default: 12000 for eth
Expand Down
2 changes: 1 addition & 1 deletion packages/reku/event/crosschecker/autochecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export class AutoCrossChecker extends BaseCrossChecker {
options?: AutoCrossCheckParam,
) {
super(provider)
this.cache = new CrossCheckerCacheManager(options?.store)
this.cache = new CrossCheckerCacheManager(options?.store, { storeKeyPrefix: options?.storeKeyPrefix })
}

validate(options: AutoCrossCheckParam) {
Expand Down
2 changes: 1 addition & 1 deletion packages/reku/event/crosschecker/cache/manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { SimpleLog } from '../interface'
* Basic cache for cross checker
*/
export class CrossCheckerCacheManager extends SimpleStoreManager {
noLogIndex: boolean
noLogIndex: boolean // TODO: this is used no where for now, add when needed
storeKeyPrefix: string
addLog: any

Expand Down
1 change: 1 addition & 0 deletions packages/reku/event/crosschecker/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export interface CrossCheckRetroParam extends BaseCrossCheckParam {
// TODO: use rpc to calc blockInterval
export interface AutoCrossCheckParam extends BaseCrossCheckParam {
store?: Store
storeKeyPrefix?: string // set the prefix to all keys when set key-value to store (cache), e.g. key = prefix+txHashList
batchBlocksCount?: number // how many blocks at most to get per check
pollingInterval?: number // mostly for limiting getLogs calling rate in catchup mode; how long does it take at least between 2 checks
blockInterval?: number // the block interval of the given chain, default: eth
Expand Down

0 comments on commit 83cc70e

Please sign in to comment.