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)
|
chunkedLogs := watcher.Chunker.ChunkLogs(logs)
|
||||||
|
|
||||||
for _, transformer := range watcher.Transformers {
|
for _, transformer := range watcher.Transformers {
|
||||||
// TODO delegate log chunks to respective transformers
|
logChunk := chunkedLogs[transformer.Name()]
|
||||||
// Need to get the transformer name... :/
|
|
||||||
logChunk := chunkedLogs["transformerName"]
|
|
||||||
err = transformer.Execute(logChunk, header)
|
err = transformer.Execute(logChunk, header)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -59,3 +59,7 @@ func (transformer LogNoteTransformer) Execute(logs []types.Log, header core.Head
|
|||||||
}
|
}
|
||||||
return nil
|
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
|
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
|
// 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) {
|
func MissingHeaders(startingBlockNumber, endingBlockNumber int64, db *postgres.DB, notCheckedSQL string) ([]core.Header, error) {
|
||||||
var result []core.Header
|
var result []core.Header
|
||||||
var query string
|
var query string
|
||||||
|
@ -24,6 +24,7 @@ import (
|
|||||||
|
|
||||||
type Transformer interface {
|
type Transformer interface {
|
||||||
Execute(logs []types.Log, header core.Header) error
|
Execute(logs []types.Log, header core.Header) error
|
||||||
|
Name() string
|
||||||
}
|
}
|
||||||
|
|
||||||
type TransformerInitializer func(db *postgres.DB) Transformer
|
type TransformerInitializer func(db *postgres.DB) Transformer
|
||||||
|
Loading…
Reference in New Issue
Block a user