Skip to content

Commit

Permalink
Instructions for optimising repetitive datasources in project manifest (
Browse files Browse the repository at this point in the history
#572)

* Instructions for optimising repetitive datasources in project manifest

* Add references

---------

Co-authored-by: James Bayly <[email protected]>
  • Loading branch information
stwiname and jamesbayly authored Nov 21, 2024
1 parent 5b6ce7b commit 62b78cc
Show file tree
Hide file tree
Showing 15 changed files with 569 additions and 0 deletions.
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/algorand.md
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```

The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Bypass Blocks

Bypass Blocks allows you to skip the stated blocks, this is useful when there are erroneous blocks in the chain or when a chain skips a block after an outage or a hard fork. It accepts both a `range` or single `integer` entry in the array.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/arbitrum.md
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```
The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Real-time indexing (Block Confirmations)

As indexers are an additional layer in your data processing pipeline, they can introduce a massive delay between when an on-chain event occurs and when the data is processed and able to be queried from the indexer.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/avalanche.md
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```
The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Real-time indexing (Block Confirmations)

As indexers are an additional layer in your data processing pipeline, they can introduce a massive delay between when an on-chain event occurs and when the data is processed and able to be queried from the indexer.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/bsc.md
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```
The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Real-time indexing (Block Confirmations)

As indexers are an additional layer in your data processing pipeline, they can introduce a massive delay between when an on-chain event occurs and when the data is processed and able to be queried from the indexer.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/concordium.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```
The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Bypass Blocks

Bypass Blocks allows you to skip the stated blocks, this is useful when there are erroneous blocks in the chain or when a chain skips a block after an outage or a hard fork. It accepts both a `range` or single `integer` entry in the array.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/cosmos.md
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```

The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Chain Types

We can load protobuf message definitions to allow support for specific Cosmos zones under `network.chaintypes`. Any protobuf files that are required for the network (these end in `.proto`) should be imported. For example, you can find Osmosis' protobuf definitions [here](https://buf.build/osmosis-labs/osmosis/tree/main:osmosis)
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/ethereum.md
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,34 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```
The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Note
When executing `subql codegen`, it will check if topics and functions are valid.
:::
Expand All @@ -337,6 +365,14 @@ When declaring a `range` use an string in the format of `"start - end"`. Both st
}
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Endpoint Config

This allows you to set specific options relevant to each specific RPC endpoint that you are indexing from. This is very useful when endpoints have unique authentication requirements, or they operate with different rate limits.
Expand Down
36 changes: 36 additions & 0 deletions docs/indexer/build/manifest/flare.md
Original file line number Diff line number Diff line change
Expand Up @@ -310,6 +310,42 @@ filter:
modulo: 50 # Index every 50 blocks: 0, 50, 100, 150....
```

The `timestamp` filter is very useful when indexing block data with specific time intervals between them. It can be used in cases where you are aggregating data on a hourly/daily basis. It can be also used to set a delay between calls to `blockHandler` functions to reduce the computational costs of this handler.

The `timestamp` filter accepts a valid cron expression and runs on schedule against the timestamps of the blocks being indexed. Times are considered on UTC dates and times. The block handler will run on the first block that is after the next iteration of the cron expression.

```yml
filter:
# This cron expression will index blocks with at least 5 minutes interval
# between their timestamps starting at startBlock given under the datasource.
timestamp: "*/5 * * * *"
```

::: tip Note
We use the [cron-converter](https://github.com/roccivic/cron-converter) package to generate unix timestamps for iterations out of the given cron expression. So, make sure the format of the cron expression given in the `timestamp` filter is compatible with the package.
:::

Some common examples

```yml
# Every minute
timestamp: "* * * * *"
# Every hour on the hour (UTC)
timestamp: "0 * * * *"
# Every day at 1am UTC
timestamp: "0 1 * * *"
# Every Sunday (weekly) at 0:00 UTC
timestamp: "0 0 * * 0"
```

::: info Simplifying your Project Manifest for a large number contract addresses

If your project has the same handlers for multiple versions of the same type of contract your project manifest can get quite repetitive. e.g you want to index the transfers for many similar ERC20 contracts, there are [ways to better handle a large static list of contract addresses](../optimisation.md#simplifying-the-project-manifest).

Note that there is also [dynamic datasources](./dynamicdatasources.md) for when your list of addresses is dynamic (e.g. you use a factory contract).

:::

## Real-time indexing (Block Confirmations)

As indexers are an additional layer in your data processing pipeline, they can introduce a massive delay between when an on-chain event occurs and when the data is processed and able to be queried from the indexer.
Expand Down
Loading

0 comments on commit 62b78cc

Please sign in to comment.