Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feature: startSync with performance increase
Closes #30 Adds a function to handle the sync setup, including request pipelining to optimize performance. The default is 100 requests, but it's a configurable argument. The `ChainSyncClient` no longer exposes `findIntersect`, and the awkward 'initial intersection' logic removed.
- Loading branch information
Showing
4 changed files
with
126 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export * from './ChainSyncClient' | ||
export * from './findIntersect' | ||
export * from './requestNext' |
15 changes: 15 additions & 0 deletions
15
clients/TypeScript/packages/client/src/ChainSync/requestNext.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { Ogmios } from '@cardano-ogmios/schema' | ||
import { baseRequest } from '../Request' | ||
import { Mirror } from '../Connection' | ||
import WebSocket from 'isomorphic-ws' | ||
|
||
export const requestNext = ( | ||
socket: WebSocket, | ||
options?: { mirror?: Mirror } | ||
): void => { | ||
socket.send(JSON.stringify({ | ||
...baseRequest, | ||
methodname: 'RequestNext', | ||
mirror: options?.mirror | ||
} as Ogmios['RequestNext'])) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters