2018-02-02 21:53:16 +00:00
|
|
|
package inmemory
|
2017-11-06 16:42:33 +00:00
|
|
|
|
|
|
|
import (
|
2018-01-06 20:31:53 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/core"
|
2018-01-26 00:08:26 +00:00
|
|
|
"github.com/vulcanize/vulcanizedb/pkg/filters"
|
2018-02-02 21:53:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
const (
|
|
|
|
blocksFromHeadBeforeFinal = 20
|
2017-11-06 16:42:33 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type InMemory struct {
|
2018-01-05 17:55:00 +00:00
|
|
|
blocks map[int64]core.Block
|
|
|
|
receipts map[string]core.Receipt
|
|
|
|
contracts map[string]core.Contract
|
|
|
|
logs map[string][]core.Log
|
2018-01-23 18:43:35 +00:00
|
|
|
logFilters map[string]filters.LogFilter
|
2018-01-05 17:55:00 +00:00
|
|
|
CreateOrUpdateBlockCallCount int
|
2017-12-12 21:55:26 +00:00
|
|
|
}
|
|
|
|
|
2018-01-03 17:23:43 +00:00
|
|
|
func NewInMemory() *InMemory {
|
|
|
|
return &InMemory{
|
2018-01-05 17:55:00 +00:00
|
|
|
CreateOrUpdateBlockCallCount: 0,
|
2018-01-23 18:43:35 +00:00
|
|
|
blocks: make(map[int64]core.Block),
|
|
|
|
receipts: make(map[string]core.Receipt),
|
|
|
|
contracts: make(map[string]core.Contract),
|
|
|
|
logs: make(map[string][]core.Log),
|
|
|
|
logFilters: make(map[string]filters.LogFilter),
|
2018-01-03 17:23:43 +00:00
|
|
|
}
|
|
|
|
}
|