ipld-eth-server/vendor/github.com/vulcanize/eth-block-extractor/pkg/ipfs/publisher.go
Elizabeth Engelman 36533f7c3f Update vendor directory and make necessary code changes
Fixes for new geth version
2019-09-25 16:32:27 -05:00

33 lines
577 B
Go

package ipfs
import "fmt"
type Error struct {
msg string
err error
}
func (ie Error) Error() string {
return fmt.Sprintf("%s: %s", ie.msg, ie.err.Error())
}
type Publisher interface {
Write(input interface{}) ([]string, error)
}
type BlockDataPublisher struct {
DagPutter
}
func NewIpfsPublisher(dagPutter DagPutter) *BlockDataPublisher {
return &BlockDataPublisher{DagPutter: dagPutter}
}
func (ip *BlockDataPublisher) Write(input interface{}) ([]string, error) {
cids, err := ip.DagPutter.DagPut(input)
if err != nil {
return nil, err
}
return cids, nil
}