From 24f3df6535a81516b2f50a50da18dd8d3dc3cce0 Mon Sep 17 00:00:00 2001 From: Kevin Atkinson Date: Wed, 5 Sep 2018 03:06:35 -0400 Subject: [PATCH] gx update and fix code to use new Cid type --- mock/centralized_client.go | 6 +++--- mock/centralized_server.go | 8 ++++---- none/none_client.go | 4 ++-- offline/offline.go | 4 ++-- package.json | 12 ++++++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/mock/centralized_client.go b/mock/centralized_client.go index e3d4882..49a3633 100644 --- a/mock/centralized_client.go +++ b/mock/centralized_client.go @@ -34,7 +34,7 @@ func (c *client) GetValue(ctx context.Context, key string, opts ...ropts.Option) return c.vs.GetValue(ctx, key, opts...) } -func (c *client) FindProviders(ctx context.Context, key *cid.Cid) ([]pstore.PeerInfo, error) { +func (c *client) FindProviders(ctx context.Context, key cid.Cid) ([]pstore.PeerInfo, error) { return c.server.Providers(key), nil } @@ -43,7 +43,7 @@ func (c *client) FindPeer(ctx context.Context, pid peer.ID) (pstore.PeerInfo, er return pstore.PeerInfo{}, nil } -func (c *client) FindProvidersAsync(ctx context.Context, k *cid.Cid, max int) <-chan pstore.PeerInfo { +func (c *client) FindProvidersAsync(ctx context.Context, k cid.Cid, max int) <-chan pstore.PeerInfo { out := make(chan pstore.PeerInfo) go func() { defer close(out) @@ -63,7 +63,7 @@ func (c *client) FindProvidersAsync(ctx context.Context, k *cid.Cid, max int) <- // Provide returns once the message is on the network. Value is not necessarily // visible yet. -func (c *client) Provide(_ context.Context, key *cid.Cid, brd bool) error { +func (c *client) Provide(_ context.Context, key cid.Cid, brd bool) error { if !brd { return nil } diff --git a/mock/centralized_server.go b/mock/centralized_server.go index b869a4f..a223f91 100644 --- a/mock/centralized_server.go +++ b/mock/centralized_server.go @@ -18,8 +18,8 @@ import ( // server is the mockrouting.Client's private interface to the routing server type server interface { - Announce(pstore.PeerInfo, *cid.Cid) error - Providers(*cid.Cid) []pstore.PeerInfo + Announce(pstore.PeerInfo, cid.Cid) error + Providers(cid.Cid) []pstore.PeerInfo Server } @@ -37,7 +37,7 @@ type providerRecord struct { Created time.Time } -func (rs *s) Announce(p pstore.PeerInfo, c *cid.Cid) error { +func (rs *s) Announce(p pstore.PeerInfo, c cid.Cid) error { rs.lock.Lock() defer rs.lock.Unlock() @@ -54,7 +54,7 @@ func (rs *s) Announce(p pstore.PeerInfo, c *cid.Cid) error { return nil } -func (rs *s) Providers(c *cid.Cid) []pstore.PeerInfo { +func (rs *s) Providers(c cid.Cid) []pstore.PeerInfo { rs.delayConf.Query.Wait() // before locking rs.lock.RLock() diff --git a/none/none_client.go b/none/none_client.go index a7c1f8f..e29ef36 100644 --- a/none/none_client.go +++ b/none/none_client.go @@ -30,13 +30,13 @@ func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (pstore.PeerInfo, err return pstore.PeerInfo{}, nil } -func (c *nilclient) FindProvidersAsync(_ context.Context, _ *cid.Cid, _ int) <-chan pstore.PeerInfo { +func (c *nilclient) FindProvidersAsync(_ context.Context, _ cid.Cid, _ int) <-chan pstore.PeerInfo { out := make(chan pstore.PeerInfo) defer close(out) return out } -func (c *nilclient) Provide(_ context.Context, _ *cid.Cid, _ bool) error { +func (c *nilclient) Provide(_ context.Context, _ cid.Cid, _ bool) error { return nil } diff --git a/offline/offline.go b/offline/offline.go index ebc96ef..9b94176 100644 --- a/offline/offline.go +++ b/offline/offline.go @@ -94,13 +94,13 @@ func (c *offlineRouting) FindPeer(ctx context.Context, pid peer.ID) (pstore.Peer return pstore.PeerInfo{}, ErrOffline } -func (c *offlineRouting) FindProvidersAsync(ctx context.Context, k *cid.Cid, max int) <-chan pstore.PeerInfo { +func (c *offlineRouting) FindProvidersAsync(ctx context.Context, k cid.Cid, max int) <-chan pstore.PeerInfo { out := make(chan pstore.PeerInfo) close(out) return out } -func (c *offlineRouting) Provide(_ context.Context, k *cid.Cid, _ bool) error { +func (c *offlineRouting) Provide(_ context.Context, k cid.Cid, _ bool) error { return ErrOffline } diff --git a/package.json b/package.json index 68db2f7..a422a8b 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "version": "3.0.8" }, { - "hash": "QmS4niovD1U6pRjUBXivr1zvvLBqiTKbERjFo994JU7oQS", + "hash": "QmTJ8FtSd9vKeuf957bZMZadyCSFBkr4Di3BVyVorAJ9Ri", "name": "go-libp2p-routing", - "version": "2.4.9" + "version": "2.5.0" }, { "author": "whyrusleeping", @@ -32,9 +32,9 @@ }, { "author": "whyrusleeping", - "hash": "QmZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb", + "hash": "QmRZ98Qjb3zafYMeebvG7iy53zu4LScLDzpyLcgUZoMP2K", "name": "go-cid", - "version": "0.8.0" + "version": "1.0.0" }, { "author": "jbenet", @@ -61,9 +61,9 @@ }, { "author": "hsanjuan", - "hash": "Qmd39D2vUhmPKQA2fgykjo2JXwekHKeJUggmGRpYuVMA2Z", + "hash": "QmS1KJuP4zfjpMhg97jD2kEos4sDeiQnzBtK5yvcUygZkT", "name": "go-ipfs-ds-help", - "version": "0.0.9" + "version": "0.1.0" }, { "author": "whyrusleeping",