forked from cerc-io/ipld-eth-server
36533f7c3f
Fixes for new geth version
33 lines
577 B
Go
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
|
|
}
|