forked from cerc-io/ipld-eth-server
update readme and cmd usage comments
This commit is contained in:
parent
84aa0a7eba
commit
b3ce1ecd78
12
README.md
12
README.md
@ -286,21 +286,25 @@ The config provides information for composing a set of transformers:
|
|||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer2]
|
[exporter.transformer2]
|
||||||
path = "path/to/transformer2"
|
path = "path/to/transformer2"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "2"
|
||||||
[exporter.transformer3]
|
[exporter.transformer3]
|
||||||
path = "path/to/transformer3"
|
path = "path/to/transformer3"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer4]
|
[exporter.transformer4]
|
||||||
path = "path/to/transformer4"
|
path = "path/to/transformer4"
|
||||||
type = "eth_storage"
|
type = "eth_storage"
|
||||||
repository = "github.com/account2/repo2"
|
repository = "github.com/account2/repo2"
|
||||||
migrations = "to/db/migrations"
|
migrations = "to/db/migrations"
|
||||||
|
rank = "1"
|
||||||
```
|
```
|
||||||
- `home` is the name of the package you are building the plugin for, in most cases this is github.com/vulcanize/vulcanizedb
|
- `home` is the name of the package you are building the plugin for, in most cases this is github.com/vulcanize/vulcanizedb
|
||||||
- `name` is the name used for the plugin files (.so and .go)
|
- `name` is the name used for the plugin files (.so and .go)
|
||||||
@ -316,7 +320,13 @@ The config provides information for composing a set of transformers:
|
|||||||
- `eth_event` indicates the transformer works with the [event watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/staging/libraries/shared/watcher/event_watcher.go)
|
- `eth_event` indicates the transformer works with the [event watcher](https://github.com/vulcanize/maker-vulcanizedb/blob/staging/libraries/shared/watcher/event_watcher.go)
|
||||||
that fetches event logs from an ETH node
|
that fetches event logs from an ETH node
|
||||||
- `migrations` is the relative path from `repository` to the db migrations directory for the transformer
|
- `migrations` is the relative path from `repository` to the db migrations directory for the transformer
|
||||||
- Note: If any of the imported transformers need additional config variables those need to be included as well
|
- `rank` determines the order that migrations are ran, with lower ranked migrations running first
|
||||||
|
- this is to help isolate any potential conflicts between transformer migrations
|
||||||
|
- start at "0"
|
||||||
|
- use strings
|
||||||
|
- don't leave gaps
|
||||||
|
- transformers with identical migrations/migration paths should share the same rank
|
||||||
|
- Note: If any of the imported transformers need additional config variables those need to be included as well
|
||||||
|
|
||||||
This information is used to write and build a Go plugin which exports the configured transformers.
|
This information is used to write and build a Go plugin which exports the configured transformers.
|
||||||
These transformers are loaded onto their specified watchers and executed.
|
These transformers are loaded onto their specified watchers and executed.
|
||||||
|
@ -59,21 +59,25 @@ var composeCmd = &cobra.Command{
|
|||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer2]
|
[exporter.transformer2]
|
||||||
path = "path/to/transformer2"
|
path = "path/to/transformer2"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "2"
|
||||||
[exporter.transformer3]
|
[exporter.transformer3]
|
||||||
path = "path/to/transformer3"
|
path = "path/to/transformer3"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer4]
|
[exporter.transformer4]
|
||||||
path = "path/to/transformer4"
|
path = "path/to/transformer4"
|
||||||
type = "eth_storage"
|
type = "eth_storage"
|
||||||
repository = "github.com/account2/repo2"
|
repository = "github.com/account2/repo2"
|
||||||
migrations = "to/db/migrations"
|
migrations = "to/db/migrations"
|
||||||
|
rank = "1"
|
||||||
|
|
||||||
|
|
||||||
Note: If any of the plugin transformer need additional
|
Note: If any of the plugin transformer need additional
|
||||||
@ -149,6 +153,10 @@ func prepConfig() {
|
|||||||
if !mrOK || mr == "" {
|
if !mrOK || mr == "" {
|
||||||
log.Fatal(name, "transformer config is missing `rank` value")
|
log.Fatal(name, "transformer config is missing `rank` value")
|
||||||
}
|
}
|
||||||
|
rank, err := strconv.Atoi(mr)
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal(name, "migration `rank` can't be converted to an integer")
|
||||||
|
}
|
||||||
t, tOK := transformer["type"]
|
t, tOK := transformer["type"]
|
||||||
if !tOK {
|
if !tOK {
|
||||||
log.Fatal(name, "transformer config is missing `type` value")
|
log.Fatal(name, "transformer config is missing `type` value")
|
||||||
@ -157,10 +165,6 @@ func prepConfig() {
|
|||||||
if transformerType == config.UnknownTransformerType {
|
if transformerType == config.UnknownTransformerType {
|
||||||
log.Fatal(errors.New(`unknown transformer type in exporter config accepted types are "eth_event", "eth_storage"`))
|
log.Fatal(errors.New(`unknown transformer type in exporter config accepted types are "eth_event", "eth_storage"`))
|
||||||
}
|
}
|
||||||
rank, err := strconv.Atoi(mr)
|
|
||||||
if err != nil {
|
|
||||||
log.Fatal(name, "migration `rank` can't be converted to an integer")
|
|
||||||
}
|
|
||||||
|
|
||||||
transformers[name] = config.Transformer{
|
transformers[name] = config.Transformer{
|
||||||
Path: p,
|
Path: p,
|
||||||
|
@ -59,21 +59,25 @@ var composeAndExecuteCmd = &cobra.Command{
|
|||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer2]
|
[exporter.transformer2]
|
||||||
path = "path/to/transformer2"
|
path = "path/to/transformer2"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "2"
|
||||||
[exporter.transformer3]
|
[exporter.transformer3]
|
||||||
path = "path/to/transformer3"
|
path = "path/to/transformer3"
|
||||||
type = "eth_event"
|
type = "eth_event"
|
||||||
repository = "github.com/account/repo"
|
repository = "github.com/account/repo"
|
||||||
migrations = "db/migrations"
|
migrations = "db/migrations"
|
||||||
|
rank = "0"
|
||||||
[exporter.transformer4]
|
[exporter.transformer4]
|
||||||
path = "path/to/transformer4"
|
path = "path/to/transformer4"
|
||||||
type = "eth_storage"
|
type = "eth_storage"
|
||||||
repository = "github.com/account2/repo2"
|
repository = "github.com/account2/repo2"
|
||||||
migrations = "to/db/migrations"
|
migrations = "to/db/migrations"
|
||||||
|
rank = "1"
|
||||||
|
|
||||||
|
|
||||||
Note: If any of the plugin transformer need additional
|
Note: If any of the plugin transformer need additional
|
||||||
|
Loading…
Reference in New Issue
Block a user