@latticexyz/network / SyncWorker
#
Class: SyncWorker<C>
#
Type parameters
#
Implements
DoWork<Input,NetworkEvent<C>[]>
#
Table of contents
#
Constructors
constructor
#
Properties
input$ output$ syncState
#
Methods
init setLoadingState work
#
Constructors
#
constructor
• new SyncWorker<C>()
#
Type parameters
#
Defined in
#
Properties
#
input$
• Private input$: Subject<Input>
#
Defined in
#
output$
• Private output$: Subject<NetworkEvent<C>>
#
Defined in
#
syncState
• Private syncState: SyncStateStruct
#
Defined in
#
Methods
#
init
▸ Private init(): Promise<void>
Start the sync process.
- Get config
- Load initial state 2.1 Get cache block number 2.2 Get snapshot block number 2.3 Load from more recent source
- Cach up to current block number by requesting events from RPC ( -> TODO: Replace with own service)
- Keep in sync 4.1 If available keep in sync with streaming service 4.2 Else keep in sync with RPC
#
Returns
Promise<void>
#
Defined in
#
setLoadingState
▸ Private setLoadingState(loadingState, blockNumber?): void
Pass a loading state component update to the main thread. Can be used to indicate the initial loading state on a loading screen.
#
Parameters
#
Returns
void
#
Defined in
#
work
▸ work(input$): Observable<NetworkEvent<C>[]>
#
Parameters
#
Returns
Observable<NetworkEvent<C>[]>
#
Implementation of
DoWork.work