|
1 | 1 | /* ###################################################### System Architecture #######################################################
|
2 | 2 |
|
3 |
| -+-----------------------------+ +----------------------------+ |
4 |
| -| Primary Network | | Secondary Network | |
5 |
| -| | | | |
6 |
| -| +--------------------+ | | +--------------------+ | |
7 |
| -| | RPC Node | | | | RPC Node | | |
8 |
| -| +--------------------+ | | +--------------------+ | |
9 |
| -| | ^ | | ^ | | |
10 |
| -| | | | | | | | |
11 |
| -| v | | | | v | |
12 |
| -| +----------+ +----------+ | | +----------+ +----------+ | |
13 |
| -| | Oracle | | Exporter | | | | Exporter | | Oracle | | |
14 |
| -| +----------+ +----------+ | | +----------+ +----------+ | +---------------------------------+ |
15 |
| -| | ^ | | ^ | | | | |
16 |
| -+-------|--------------|------+ +------|--------------|------+ | Pythd Websocket API | +--------+ |
17 |
| - | | | | | | | | |
18 |
| - | +--------------------------------+ | | +---------+ +----------+ | | | |
19 |
| - | | Local Store |<----------------------------| |<---| |<----------| | |
20 |
| - | +--------------------------------+ | | | | | JRPC | | | | |
21 |
| - v v | | Adapter | | WS | | | User | |
22 |
| - +------------------------------------------------------------+ | | | | Server | | | | |
23 |
| - | Global Store |------------->| |--->| |---------->| | |
24 |
| - +------------------------------------------------------------+ | +---------+ +----------+ | | | |
25 |
| - | | | | |
26 |
| - +---------------------------------+ +--------+ |
| 3 | ++--------------------------------+ +--------------------------------+ |
| 4 | +| RPC Node, e.g. Pythnet | | RPC Node, e.g. Solana Mainnet | |
| 5 | ++--------------------------------+ +--------------------------------+ |
| 6 | + | ^ ^ | |
| 7 | ++---|---------------------|------+ +---|---------------------|------+ |
| 8 | +| | Primary Network | | | Secondary Network | | |
| 9 | +| v | | | | v | |
| 10 | +| +--------+ +----------+ | | +----------+ +--------+ | |
| 11 | +| | Oracle | | Exporter | | | | Exporter | | Oracle | | |
| 12 | +| +--------+ +----------+ | | +----------+ +--------+ | |
| 13 | +| | ^ ^ | | ^ ^ | | |
| 14 | ++------|--------------|--|-------+ +-----|--|-------------|---------+ |
| 15 | + | | | | | | +------------------------+ |
| 16 | + | +--------|---------------|---------+ | | Pythd Websocket API | |
| 17 | + | | Local Store | |<---------------+-------+ +------+ | |
| 18 | + | +--------|---------------|---------+ | | | |<--|JRPC | | |
| 19 | + v | | | v | |Adapter| | WS | | |
| 20 | + +--------------------|---------------|--------|-----------+ | | |-->|Server| | |
| 21 | + | | Global Store | | |---->+-------+ +------+ | |
| 22 | + +--------------------|---------------|--------|-----------+ | ^ | | |
| 23 | + | | | | +---------------|----|---+ |
| 24 | + | | v v | | |
| 25 | + +---------------------+ +--------------+ | | |
| 26 | + |Remote Keypair Loader| |Metrics Server| | | |
| 27 | + +---------------------+ +--------------+ | | |
| 28 | + ^ | | | |
| 29 | + | v | v |
| 30 | + +-------------------------------------------------------------------+ |
| 31 | + | User | |
| 32 | + +-------------------------------------------------------------------+ |
| 33 | +Generated with textik.com on 2023-04-03 |
27 | 34 |
|
28 | 35 | The arrows on the diagram above represent the direction of data flow.
|
29 | 36 |
|
30 |
| -Write path: |
| 37 | +Publisher data write path: |
31 | 38 | - The user submits fresh price data to the system using the Pythd JRPC Websocket API.
|
32 | 39 | - The Adapter then transforms this into the Pyth SDK data structures and sends it to the Local Store.
|
33 | 40 | - The Local Store holds the latest price data the user has submitted for each price feed.
|
34 | 41 | - The Exporters periodically query the Local Store for the latest user-submitted data,
|
35 | 42 | and send it to the RPC node.
|
36 | 43 |
|
37 |
| -Read path: |
| 44 | +Publisher data read path: |
38 | 45 | - The Oracles continually fetch data from the RPC node, and pass this to the Global Store.
|
39 | 46 | - The Global Store holds a unified view of the latest observed data from both networks, in the Pyth SDK data structures.
|
40 | 47 | - When a user queries for this data using the Pythd JRPC Websocket API, the Adapter fetches
|
41 | 48 | the latest data from the Global Store. It transforms this from the Pyth SDK data structures into the
|
42 | 49 | Pythd JRPC Websocket API data structures.
|
43 | 50 | - The Pythd JRPC Websocket API then sends this data to the user.
|
44 | 51 |
|
| 52 | +Remote Keypair Loading: |
| 53 | +- If no keypair is found at startup, Exporters poll the Remote Keypair Loader for a signing keypair |
| 54 | +- When the keypair is uploaded, it is given to the Exporters |
| 55 | +
|
| 56 | +Metrics Server: |
| 57 | +- Every update in global and local store is reflected in the metrics |
| 58 | +- Metrics are served using Prometheus |
| 59 | +
|
45 | 60 | Note that there is an Oracle and Exporter for each network, but only one Local Store and Global Store.
|
46 | 61 |
|
47 | 62 | ################################################################################################################################## */
|
48 | 63 |
|
| 64 | +pub mod dashboard; |
49 | 65 | pub mod metrics;
|
50 | 66 | pub mod pythd;
|
51 | 67 | pub mod remote_keypair_loader;
|
|
0 commit comments