@cryptotaxi247 / kubo / commits / ba510cbd6

IpnsPublicher -> Publisher interface

Juan Batiz-Benet committed Oct 1, 2014 at 01:36 UTC ba510cbd6dd432519b43eb594dd2a214720a0970
3 files changed +10 -6
core/core.go
+1 -1
@@ -64,7 +64,7 @@ type IpfsNode struct {
64 Namesys namesys.Resolver
65
66 // the routing publisher
67 - Publisher *namesys.IpnsPublisher
67 + Publisher namesys.Publisher
68 }
69
70 // NewIpfsNode constructs a new IpfsNode based on the given config.
namesys/publisher.go
+8 -4
@@ -12,20 +12,24 @@ import (
12 u "github.com/jbenet/go-ipfs/util"
13 )
14
15 -type IpnsPublisher struct {
15 +type ipnsPublisher struct {
16 dag *mdag.DAGService
17 routing routing.IpfsRouting
18 }
19
20 -func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) *IpnsPublisher {
21 - return &IpnsPublisher{
20 +type Publisher interface {
21 + Publish(ci.PrivKey, string) error
22 +}
23 +
24 +func NewPublisher(dag *mdag.DAGService, route routing.IpfsRouting) Publisher {
25 + return &ipnsPublisher{
26 dag: dag,
27 routing: route,
28 }
29 }
30
31 // Publish accepts a keypair and a value,
28 -func (p *IpnsPublisher) Publish(k ci.PrivKey, value string) error {
32 +func (p *ipnsPublisher) Publish(k ci.PrivKey, value string) error {
33 log.Debug("namesys: Publish %s", value)
34 ctx := context.TODO()
35 data, err := CreateEntryData(k, value)
namesys/resolve_test.go
+1 -1
@@ -28,7 +28,7 @@ func TestRoutingResolve(t *testing.T) {
28
29 resolve := NewMasterResolver(d, dag)
30
31 - pub := IpnsPublisher{
31 + pub := ipnsPublisher{
32 dag: dag,
33 routing: d,
34 }