ipld-eth-state-snapshot/pkg/types/publisher.go
2023-05-10 13:11:12 -05:00

25 lines
577 B
Go

package types
import (
"math/big"
"github.com/ethereum/go-ethereum/statediff/indexer/models"
"github.com/ipfs/go-cid"
"github.com/ethereum/go-ethereum/core/types"
)
type Publisher interface {
PublishHeader(header *types.Header) error
PublishStateLeafNode(node *models.StateNodeModel, tx Tx) error
PublishStorageLeafNode(node *models.StorageNodeModel, tx Tx) error
PublishIPLD(c cid.Cid, raw []byte, height *big.Int, tx Tx) error
BeginTx() (Tx, error)
PrepareTxForBatch(tx Tx, batchSize uint) (Tx, error)
}
type Tx interface {
Rollback() error
Commit() error
}