Commit ba510cbd authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

IpnsPublicher -> Publisher interface

parent 19b0a28d
...@@ -64,7 +64,7 @@ type IpfsNode struct { ...@@ -64,7 +64,7 @@ type IpfsNode struct {
Namesys namesys.Resolver Namesys namesys.Resolver
// the routing publisher // the routing publisher
Publisher *namesys.IpnsPublisher Publisher namesys.Publisher
} }
// NewIpfsNode constructs a new IpfsNode based on the given config. // NewIpfsNode constructs a new IpfsNode based on the given config.
......
...@@ -12,20 +12,24 @@ import ( ...@@ -12,20 +12,24 @@ import (
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
type IpnsPublisher struct { type ipnsPublisher struct {
dag *mdag.DAGService dag *mdag.DAGService
routing routing.IpfsRouting routing routing.IpfsRouting
} }
func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) *IpnsPublisher { type Publisher interface {
return &IpnsPublisher{ Publish(ci.PrivKey, string) error
}
func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) Publisher {
return &ipnsPublisher{
dag: dag, dag: dag,
routing: route, routing: route,
} }
} }
// Publish accepts a keypair and a value, // Publish accepts a keypair and a value,
func (p *IpnsPublisher) Publish(k ci.PrivKey, value string) error { func (p *ipnsPublisher) Publish(k ci.PrivKey, value string) error {
log.Debug("namesys: Publish %s", value) log.Debug("namesys: Publish %s", value)
ctx := context.TODO() ctx := context.TODO()
data, err := CreateEntryData(k, value) data, err := CreateEntryData(k, value)
......
...@@ -28,7 +28,7 @@ func TestRoutingResolve(t *testing.T) { ...@@ -28,7 +28,7 @@ func TestRoutingResolve(t *testing.T) {
resolve := NewMasterResolver(d, dag) resolve := NewMasterResolver(d, dag)
pub := IpnsPublisher{ pub := ipnsPublisher{
dag: dag, dag: dag,
routing: d, routing: d,
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment