diff --git a/mock/centralized_client.go b/mock/centralized_client.go index 49a36330006a4f3c269231f7b164deceb4192d7a..e09350da5b5c40f64fc74628975acb8a424924c5 100644 --- a/mock/centralized_client.go +++ b/mock/centralized_client.go @@ -34,6 +34,11 @@ func (c *client) GetValue(ctx context.Context, key string, opts ...ropts.Option) return c.vs.GetValue(ctx, key, opts...) } +func (c *client) SearchValue(ctx context.Context, key string, opts ...ropts.Option) (<-chan []byte, error) { + log.Debugf("SearchValue: %s", key) + return c.vs.SearchValue(ctx, key, opts...) +} + func (c *client) FindProviders(ctx context.Context, key cid.Cid) ([]pstore.PeerInfo, error) { return c.server.Providers(key), nil } diff --git a/none/none_client.go b/none/none_client.go index e29ef36af79b39f9e6c6f05424be46f27a3f5c7b..45febc554e5117578ce2f45e311a5ce38a149d5c 100644 --- a/none/none_client.go +++ b/none/none_client.go @@ -26,6 +26,10 @@ func (c *nilclient) GetValue(_ context.Context, _ string, _ ...ropts.Option) ([] return nil, errors.New("tried GetValue from nil routing") } +func (c *nilclient) SearchValue(_ context.Context, _ string, _ ...ropts.Option) (<-chan []byte, error) { + return nil, errors.New("tried SearchValue from nil routing") +} + func (c *nilclient) FindPeer(_ context.Context, _ peer.ID) (pstore.PeerInfo, error) { return pstore.PeerInfo{}, nil } diff --git a/offline/offline.go b/offline/offline.go index 9b94176ccbc500d197393007a30747185b60bc90..1627490c2307dbe7812144a15160dcb4f78b6740 100644 --- a/offline/offline.go +++ b/offline/offline.go @@ -90,6 +90,18 @@ func (c *offlineRouting) GetValue(ctx context.Context, key string, _ ...ropts.Op return val, nil } +func (c *offlineRouting) SearchValue(ctx context.Context, key string, _ ...ropts.Option) (<-chan []byte, error) { + out := make(chan []byte, 1) + go func() { + defer close(out) + v, err := c.GetValue(ctx, key) + if err == nil { + out <- v + } + }() + return out, nil +} + func (c *offlineRouting) FindPeer(ctx context.Context, pid peer.ID) (pstore.PeerInfo, error) { return pstore.PeerInfo{}, ErrOffline } diff --git a/package.json b/package.json index af8e6a69975764b081751380eb8a6ac9b315b45e..ba9c91cb3a8fc039c645ca4403674d33f11106de 100644 --- a/package.json +++ b/package.json @@ -14,9 +14,9 @@ "version": "3.0.9" }, { - "hash": "QmdKS5YtmuSWKuLLgbHG176mS3VX3AKiyVmaaiAfvgcuch", + "hash": "QmaJ6QDUh7JKPPToaUZ4EtUsPBdrbSAG6zMTkzfEvZgz2j", "name": "go-libp2p-routing", - "version": "2.5.0" + "version": "2.6.0" }, { "author": "whyrusleeping",