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
4570f1ef
Commit
4570f1ef
authored
Sep 05, 2018
by
Kevin Atkinson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gx update and fix code to use new Cid type
parent
48ba18db
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
17 deletions
+17
-17
mock/centralized_client.go
mock/centralized_client.go
+3
-3
mock/centralized_server.go
mock/centralized_server.go
+4
-4
none/none_client.go
none/none_client.go
+2
-2
offline/offline.go
offline/offline.go
+2
-2
package.json
package.json
+6
-6
No files found.
mock/centralized_client.go
View file @
4570f1ef
...
...
@@ -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
}
...
...
mock/centralized_server.go
View file @
4570f1ef
...
...
@@ -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
()
...
...
none/none_client.go
View file @
4570f1ef
...
...
@@ -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
}
...
...
offline/offline.go
View file @
4570f1ef
...
...
@@ -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
}
...
...
package.json
View file @
4570f1ef
...
...
@@ -14,9 +14,9 @@
"version"
:
"3.0.9"
},
{
"hash"
:
"Qm
Y9JUvS8kbgao3XbPh6WAV3ChE2nxGKhcGTHiwMC4gmcU
"
,
"hash"
:
"Qm
dKS5YtmuSWKuLLgbHG176mS3VX3AKiyVmaaiAfvgcuch
"
,
"name"
:
"go-libp2p-routing"
,
"version"
:
"2.
4.1
0"
"version"
:
"2.
5.
0"
},
{
"author"
:
"whyrusleeping"
,
...
...
@@ -32,9 +32,9 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
ZFbDTY9jfSBms2MchvYM9oYRbAF19K7Pby47yDBfpPrb
"
,
"hash"
:
"Qm
PSQnBKM9g7BaUcZCvswUJVscQ1ipjmwxN5PXCjkp9EQ7
"
,
"name"
:
"go-cid"
,
"version"
:
"0.
8
.0"
"version"
:
"0.
9
.0"
},
{
"author"
:
"jbenet"
,
...
...
@@ -61,9 +61,9 @@
},
{
"author"
:
"hsanjuan"
,
"hash"
:
"Qm
f1xGr3SyBpiPp3ZDuKkYMh4gnRk9K4QnbL17kstnf35h
"
,
"hash"
:
"Qm
XejiSr776HgKLEGSs7unW7GT82AgfMbQX5crfSybGU8b
"
,
"name"
:
"go-ipfs-ds-help"
,
"version"
:
"0.
0.
10"
"version"
:
"0.1
.
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