Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3-routing
Commits
6ce6d8e7
Unverified
Commit
6ce6d8e7
authored
Sep 24, 2018
by
Łukasz Magiera
Committed by
GitHub
Sep 24, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #12 from ipfs/feat/searchvalue
Implement SearchValue
parents
7a10aeb4
2874086f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
2 deletions
+23
-2
mock/centralized_client.go
mock/centralized_client.go
+5
-0
none/none_client.go
none/none_client.go
+4
-0
offline/offline.go
offline/offline.go
+12
-0
package.json
package.json
+2
-2
No files found.
mock/centralized_client.go
View file @
6ce6d8e7
...
...
@@ -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
}
...
...
none/none_client.go
View file @
6ce6d8e7
...
...
@@ -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
}
...
...
offline/offline.go
View file @
6ce6d8e7
...
...
@@ -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
}
...
...
package.json
View file @
6ce6d8e7
...
...
@@ -14,9 +14,9 @@
"version"
:
"3.0.9"
},
{
"hash"
:
"Qm
dKS5YtmuSWKuLLgbHG176mS3VX3AKiyVmaaiAfvgcuch
"
,
"hash"
:
"Qm
aJ6QDUh7JKPPToaUZ4EtUsPBdrbSAG6zMTkzfEvZgz2j
"
,
"name"
:
"go-libp2p-routing"
,
"version"
:
"2.
5
.0"
"version"
:
"2.
6
.0"
},
{
"author"
:
"whyrusleeping"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment