Delegate log chunks to respective transformers
This commit is contained in:
parent
8bebcdc064
commit
9789648cc2
@ -71,9 +71,7 @@ func (watcher *Watcher) Execute() error {
|
||||
chunkedLogs := watcher.Chunker.ChunkLogs(logs)
|
||||
|
||||
for _, transformer := range watcher.Transformers {
|
||||
// TODO delegate log chunks to respective transformers
|
||||
// Need to get the transformer name... :/
|
||||
logChunk := chunkedLogs["transformerName"]
|
||||
logChunk := chunkedLogs[transformer.Name()]
|
||||
err = transformer.Execute(logChunk, header)
|
||||
}
|
||||
}
|
||||
|
@ -59,3 +59,7 @@ func (transformer LogNoteTransformer) Execute(logs []types.Log, header core.Head
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (transformer LogNoteTransformer) Name() string {
|
||||
return transformer.Config.TransformerName
|
||||
}
|
||||
|
@ -66,3 +66,7 @@ func (transformer Transformer) Execute(logs []types.Log, header core.Header) err
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (transformer Transformer) Name() string {
|
||||
return transformer.Config.TransformerName
|
||||
}
|
||||
|
@ -26,7 +26,6 @@ func MarkHeaderCheckedInTransaction(headerID int64, tx *sql.Tx, checkedHeadersCo
|
||||
}
|
||||
|
||||
// Treats a header as missing if it's not in the headers table, or not checked for some log type
|
||||
// TODO Revisit definition of "checked header
|
||||
func MissingHeaders(startingBlockNumber, endingBlockNumber int64, db *postgres.DB, notCheckedSQL string) ([]core.Header, error) {
|
||||
var result []core.Header
|
||||
var query string
|
||||
|
@ -24,6 +24,7 @@ import (
|
||||
|
||||
type Transformer interface {
|
||||
Execute(logs []types.Log, header core.Header) error
|
||||
Name() string
|
||||
}
|
||||
|
||||
type TransformerInitializer func(db *postgres.DB) Transformer
|
||||
|
Loading…
Reference in New Issue
Block a user