2022-01-11 23:49:04 +00:00
|
|
|
package types
|
|
|
|
|
|
|
|
import (
|
2022-05-13 08:30:40 +00:00
|
|
|
"math/big"
|
|
|
|
|
2023-04-11 15:03:27 +00:00
|
|
|
"github.com/ethereum/go-ethereum/statediff/indexer/models"
|
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2022-01-11 23:49:04 +00:00
|
|
|
"github.com/ethereum/go-ethereum/common"
|
|
|
|
"github.com/ethereum/go-ethereum/core/types"
|
|
|
|
)
|
|
|
|
|
|
|
|
type Publisher interface {
|
2022-02-09 15:19:10 +00:00
|
|
|
PublishHeader(header *types.Header) error
|
2023-04-11 15:03:27 +00:00
|
|
|
PublishStateLeafNode(node *models.StateNodeModel, tx Tx) error
|
|
|
|
PublishStorageLeafNode(node *models.StorageNodeModel, tx Tx) error
|
2022-05-13 08:30:40 +00:00
|
|
|
PublishCode(height *big.Int, codeHash common.Hash, codeBytes []byte, tx Tx) error
|
2023-04-11 15:03:27 +00:00
|
|
|
PublishIPLD(c cid.Cid, raw []byte, height *big.Int, tx Tx) (string, error)
|
2022-02-09 15:19:10 +00:00
|
|
|
BeginTx() (Tx, error)
|
|
|
|
PrepareTxForBatch(tx Tx, batchSize uint) (Tx, error)
|
|
|
|
}
|
|
|
|
|
|
|
|
type Tx interface {
|
|
|
|
Rollback() error
|
|
|
|
Commit() error
|
2022-01-11 23:49:04 +00:00
|
|
|
}
|