Commit f6e8d958 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refac(exchange) rename exchange.Interface to match golang conventions

examples:

    http://golang.org/pkg/container/heap/#Interface

    http://golang.org/pkg/net/#Interface

    http://golang.org/pkg/sort/#Interface
parent 7cb2f524
...@@ -18,6 +18,16 @@ import ( ...@@ -18,6 +18,16 @@ import (
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
// TODO rename -> Router?
type Routing interface {
// FindProvidersAsync returns a channel of providers for the given key
// TODO replace with timeout with context
FindProvidersAsync(u.Key, int, time.Duration) <-chan *peer.Peer
// Provide provides the key to the network
Provide(key u.Key) error
}
// TODO(brian): ensure messages are being received // TODO(brian): ensure messages are being received
// PartnerWantListMax is the bound for the number of keys we'll store per // PartnerWantListMax is the bound for the number of keys we'll store per
...@@ -38,7 +48,7 @@ type bitswap struct { ...@@ -38,7 +48,7 @@ type bitswap struct {
blockstore blockstore.Blockstore blockstore blockstore.Blockstore
// routing interface for communication // routing interface for communication
routing exchange.Directory routing Routing
notifications notifications.PubSub notifications notifications.PubSub
...@@ -49,7 +59,7 @@ type bitswap struct { ...@@ -49,7 +59,7 @@ type bitswap struct {
} }
// NewSession initializes a bitswap session. // NewSession initializes a bitswap session.
func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d ds.Datastore, directory exchange.Directory) exchange.Exchange { func NewSession(parent context.Context, s bsnet.NetworkService, p *peer.Peer, d ds.Datastore, directory Routing) exchange.Interface {
// FIXME(brian): instantiate a concrete Strategist // FIXME(brian): instantiate a concrete Strategist
receiver := bsnet.Forwarder{} receiver := bsnet.Forwarder{}
......
...@@ -9,7 +9,7 @@ import ( ...@@ -9,7 +9,7 @@ import (
u "github.com/jbenet/go-ipfs/util" u "github.com/jbenet/go-ipfs/util"
) )
func NewOfflineExchange() exchange.Exchange { func NewOfflineExchange() exchange.Interface {
return &offlineExchange{} return &offlineExchange{}
} }
......
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