forked from cerc-io/ipld-eth-server
2.8 KiB
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:
- Create a package that exports a variable
TransformerInitializer,StorageTransformerInitializer, orContractTransformerInitializerthat are of type TransformerInitializer or StorageTransformerInitializer, or ContractTransformerInitializer, respectively - Design the transformers to work in the context of their event, storage, or contract watcher execution modes
- Create db migrations to run against vulcanizeDB so that we can store the transformer output
- Do not
goose fixthe 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.migrationsfields - If the base vDB migrations occupy this path as well, they need to be in their
goose fixed form as they are here
- Do not
To update a plugin repository with changes to the core vulcanizedb repository, run dep ensure to update its dependencies.