ipld-eth-server/documentation/transformers.md
2019-04-19 14:49:09 -05:00

2.8 KiB

Custom transformers

When the capabilities of the generic contractWatcher are not sufficient, custom transformers tailored to a specific purpose can be leveraged.

Individual transformers can be composed together from any number of external repositories and executed as a single process using the compose and execute commands or the composeAndExecute command.

Writing custom transformers

For help with writing different types of custom transformers for the composeAndExecute set of commands, please see the below:

Storage Transformers

Event Transformers

Contract Transformers

Preparing custom transformers to work as part of a plugin

To plug in an external transformer we need to:

  1. Create a package that exports a variable TransformerInitializer, StorageTransformerInitializer, or ContractTransformerInitializer that are of type TransformerInitializer or StorageTransformerInitializer, or ContractTransformerInitializer, respectively
  2. Design the transformers to work in the context of their event, storage, or contract watcher execution modes
  3. Create db migrations to run against vulcanizeDB so that we can store the transformer output
    • Do not goose fix the transformer migrations, this is to ensure they are always ran after the core vulcanizedb migrations which are kept in their fixed form
    • Specify migration locations for each transformer in the config with the exporter.transformer.migrations fields
    • If the base vDB migrations occupy this path as well, they need to be in their goose fixed form as they are here

To update a plugin repository with changes to the core vulcanizedb repository, run dep ensure to update its dependencies.