|
1 | 1 | --- |
2 | 2 | title: "Documentation" |
3 | 3 | --- |
4 | | -import { Callout } from 'nextra/components' |
5 | | -import { IndexerBetaNotice } from '@components/index'; |
| 4 | +import { ThemedImage } from '@components/index'; |
6 | 5 |
|
7 | 6 | # Documentation |
8 | 7 |
|
9 | 8 | ## Architecture of the Indexer SDK |
10 | 9 |
|
11 | | -In the Aptos indexing stack, a processor indexes a specific subset of data from the blockchain and ingests the data into an external database. |
| 10 | +In the Aptos indexing stack, a processor indexes a specific subset of data from the blockchain and writes the data into an external database. |
12 | 11 |
|
13 | 12 | Each processor follows this general flow: |
14 | 13 |
|
15 | | -1. Receive a stream of Aptos transactions |
16 | | -2. Extract the relevant data from the transactions |
17 | | -3. Transform and merge the extracted data into a coherent, standardized schema |
18 | | -4. Store the transformed data into a database |
19 | | - |
20 | | -The Aptos Indexer SDK allows you to write and model each of your processor as a graph of independent `Step`'s'. |
21 | | -Each `Step` has an input and an output, and the output of one `Step` is connected to the input of another `Step` by a channel. |
22 | | -The flow above can be modeled as a graph of `Step`'s connected by channels. |
23 | | - |
| 14 | +1. Receive a stream of transactions from [Transaction Stream](../txn-stream.mdx) |
| 15 | +2. Extract the relevant data from the transactions and transform it into a standardized schema |
| 16 | +3. Store the transformed data into a database |
| 17 | +4. Keep track of the transaction versions that have been processed |
| 18 | + |
| 19 | +The Indexer SDK allows you to write a processor as a directed graph of independent steps. |
| 20 | +Each `Step` has an input and output, and the output of each `Step` is connected to the input of the next `Step` by a [Kanal channel](https://github.com/fereidani/kanal). |
| 21 | + |
| 22 | +<center> |
| 23 | + <ThemedImage |
| 24 | + alt="Indexer SDK Custom Processor Architecture" |
| 25 | + sources={{ |
| 26 | + light: '/docs/indexer-custom-processor-light.svg', |
| 27 | + dark: '/docs/indexer-custom-processor-dark.svg', |
| 28 | + }} |
| 29 | + /> |
| 30 | +</center> |
| 31 | + |
| 32 | +## When to use the Indexer SDK |
| 33 | +The Indexer SDK is useful when you want to index a custom contract or you realize you need a new kind of data that isn't available in the [Indexer API](../aptos-hosted.mdx). |
| 34 | + |
| 35 | +The general flow to write a custom processor with the Indexer SDK is: |
| 36 | +1. Define your database schema |
| 37 | +2. Create a new processor |
| 38 | +3. Create `Step`s that extract and transform data into your storage schema |
| 39 | +2. Customize your processor by adding and connecting steps |
| 40 | +3. Run your processor and see the data indexed into your database |
| 41 | + |
| 42 | +## Benefits of the Indexer SDK |
24 | 43 | The Indexer SDK's architecture simplifies writing custom processors in several ways: |
25 | 44 |
|
26 | 45 | 1. You can reuse `Step` implementations across processors which reduces duplication of common data extraction logic. |
|
0 commit comments