Commit 3aaf6463 authored by Brian Tiger Chow's avatar Brian Tiger Chow

refactor(mdag, bserv, bs) mocks, etc.

License: MIT
Signed-off-by: default avatarBrian Tiger Chow <brian@perfmode.com>
parent 25824cf5
...@@ -30,10 +30,6 @@ func NewMockRouter(local peer.Peer, dstore ds.Datastore) routing.IpfsRouting { ...@@ -30,10 +30,6 @@ func NewMockRouter(local peer.Peer, dstore ds.Datastore) routing.IpfsRouting {
} }
} }
func (mr *MockRouter) SetRoutingServer(rs RoutingServer) {
mr.hashTable = rs
}
func (mr *MockRouter) PutValue(ctx context.Context, key u.Key, val []byte) error { func (mr *MockRouter) PutValue(ctx context.Context, key u.Key, val []byte) error {
log.Debugf("PutValue: %s", key) log.Debugf("PutValue: %s", key)
return mr.datastore.Put(key.DsKey(), val) return mr.datastore.Put(key.DsKey(), val)
...@@ -119,7 +115,8 @@ func (rs *hashTable) Announce(p peer.Peer, k u.Key) error { ...@@ -119,7 +115,8 @@ func (rs *hashTable) Announce(p peer.Peer, k u.Key) error {
func (rs *hashTable) Providers(k u.Key) []peer.Peer { func (rs *hashTable) Providers(k u.Key) []peer.Peer {
rs.lock.RLock() rs.lock.RLock()
defer rs.lock.RUnlock() defer rs.lock.RUnlock()
ret := make([]peer.Peer, 0)
var ret []peer.Peer
peerset, ok := rs.providers[k] peerset, ok := rs.providers[k]
if !ok { if !ok {
return ret return ret
......
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