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
d8d7cc75
Commit
d8d7cc75
authored
Sep 14, 2015
by
Jeromy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
extract logging
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
parent
172cd15e
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
25 additions
and
25 deletions
+25
-25
dht/dht.go
dht/dht.go
+3
-3
dht/pb/message.go
dht/pb/message.go
+2
-2
dht/query.go
dht/query.go
+2
-2
kbucket/table.go
kbucket/table.go
+2
-2
mock/centralized_client.go
mock/centralized_client.go
+2
-2
none/none_client.go
none/none_client.go
+2
-2
offline/offline.go
offline/offline.go
+2
-2
record/record.go
record/record.go
+2
-2
supernode/client.go
supernode/client.go
+3
-3
supernode/proxy/standard.go
supernode/proxy/standard.go
+5
-5
No files found.
dht/dht.go
View file @
d8d7cc75
...
@@ -18,8 +18,8 @@ import (
...
@@ -18,8 +18,8 @@ import (
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
kb
"github.com/ipfs/go-ipfs/routing/kbucket"
kb
"github.com/ipfs/go-ipfs/routing/kbucket"
record
"github.com/ipfs/go-ipfs/routing/record"
record
"github.com/ipfs/go-ipfs/routing/record"
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
u
"github.com/ipfs/go-ipfs/util"
u
"github.com/ipfs/go-ipfs/util"
logging
"github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
proto
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
proto
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/gogo/protobuf/proto"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
ds
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
...
@@ -28,7 +28,7 @@ import (
...
@@ -28,7 +28,7 @@ import (
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
)
)
var
log
=
eventlo
g
.
Logger
(
"dht"
)
var
log
=
loggin
g
.
Logger
(
"dht"
)
var
ProtocolDHT
protocol
.
ID
=
"/ipfs/dht"
var
ProtocolDHT
protocol
.
ID
=
"/ipfs/dht"
...
@@ -98,7 +98,7 @@ func (dht *IpfsDHT) LocalPeer() peer.ID {
...
@@ -98,7 +98,7 @@ func (dht *IpfsDHT) LocalPeer() peer.ID {
}
}
// log returns the dht's logger
// log returns the dht's logger
func
(
dht
*
IpfsDHT
)
log
()
eventlo
g
.
EventLogger
{
func
(
dht
*
IpfsDHT
)
log
()
loggin
g
.
EventLogger
{
return
log
// TODO rm
return
log
// TODO rm
}
}
...
...
dht/pb/message.go
View file @
d8d7cc75
...
@@ -6,10 +6,10 @@ import (
...
@@ -6,10 +6,10 @@ import (
key
"github.com/ipfs/go-ipfs/blocks/key"
key
"github.com/ipfs/go-ipfs/blocks/key"
inet
"github.com/ipfs/go-ipfs/p2p/net"
inet
"github.com/ipfs/go-ipfs/p2p/net"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
log
=
eventlo
g
.
Logger
(
"dht.pb"
)
var
log
=
loggin
g
.
Logger
(
"dht.pb"
)
type
PeerRoutingInfo
struct
{
type
PeerRoutingInfo
struct
{
peer
.
PeerInfo
peer
.
PeerInfo
...
...
dht/query.go
View file @
d8d7cc75
...
@@ -8,10 +8,10 @@ import (
...
@@ -8,10 +8,10 @@ import (
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
queue
"github.com/ipfs/go-ipfs/p2p/peer/queue"
queue
"github.com/ipfs/go-ipfs/p2p/peer/queue"
"github.com/ipfs/go-ipfs/routing"
"github.com/ipfs/go-ipfs/routing"
eventlog
"github.com/ipfs/go-ipfs/thirdparty/eventlog"
u
"github.com/ipfs/go-ipfs/util"
u
"github.com/ipfs/go-ipfs/util"
pset
"github.com/ipfs/go-ipfs/util/peerset"
pset
"github.com/ipfs/go-ipfs/util/peerset"
todoctr
"github.com/ipfs/go-ipfs/util/todocounter"
todoctr
"github.com/ipfs/go-ipfs/util/todocounter"
logging
"github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
process
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
process
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess"
ctxproc
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
ctxproc
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/goprocess/context"
...
@@ -77,7 +77,7 @@ type dhtQueryRunner struct {
...
@@ -77,7 +77,7 @@ type dhtQueryRunner struct {
errs
u
.
MultiErr
// result errors. maybe should be a map[peer.ID]error
errs
u
.
MultiErr
// result errors. maybe should be a map[peer.ID]error
rateLimit
chan
struct
{}
// processing semaphore
rateLimit
chan
struct
{}
// processing semaphore
log
eventlo
g
.
EventLogger
log
loggin
g
.
EventLogger
proc
process
.
Process
proc
process
.
Process
sync
.
RWMutex
sync
.
RWMutex
...
...
kbucket/table.go
View file @
d8d7cc75
...
@@ -8,10 +8,10 @@ import (
...
@@ -8,10 +8,10 @@ import (
"time"
"time"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
u
"github.com/ipfs/go-ipfs/
util
"
logging
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
log
=
u
.
Logger
(
"table"
)
var
log
=
logging
.
Logger
(
"table"
)
// RoutingTable defines the routing table.
// RoutingTable defines the routing table.
type
RoutingTable
struct
{
type
RoutingTable
struct
{
...
...
mock/centralized_client.go
View file @
d8d7cc75
...
@@ -10,11 +10,11 @@ import (
...
@@ -10,11 +10,11 @@ import (
key
"github.com/ipfs/go-ipfs/blocks/key"
key
"github.com/ipfs/go-ipfs/blocks/key"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
routing
"github.com/ipfs/go-ipfs/routing"
routing
"github.com/ipfs/go-ipfs/routing"
u
"github.com/ipfs/go-ipfs/util"
"github.com/ipfs/go-ipfs/util/testutil"
"github.com/ipfs/go-ipfs/util/testutil"
logging
"github.com/ipfs/go-ipfs/vendor/go-log-v1.0.0"
)
)
var
log
=
u
.
Logger
(
"mockrouter"
)
var
log
=
logging
.
Logger
(
"mockrouter"
)
type
client
struct
{
type
client
struct
{
datastore
ds
.
Datastore
datastore
ds
.
Datastore
...
...
none/none_client.go
View file @
d8d7cc75
...
@@ -9,10 +9,10 @@ import (
...
@@ -9,10 +9,10 @@ import (
p2phost
"github.com/ipfs/go-ipfs/p2p/host"
p2phost
"github.com/ipfs/go-ipfs/p2p/host"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
routing
"github.com/ipfs/go-ipfs/routing"
routing
"github.com/ipfs/go-ipfs/routing"
u
"github.com/ipfs/go-ipfs/
util
"
logging
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
log
=
u
.
Logger
(
"mockrouter"
)
var
log
=
logging
.
Logger
(
"mockrouter"
)
type
nilclient
struct
{
type
nilclient
struct
{
}
}
...
...
offline/offline.go
View file @
d8d7cc75
...
@@ -13,10 +13,10 @@ import (
...
@@ -13,10 +13,10 @@ import (
routing
"github.com/ipfs/go-ipfs/routing"
routing
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
record
"github.com/ipfs/go-ipfs/routing/record"
record
"github.com/ipfs/go-ipfs/routing/record"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
log
=
eventlo
g
.
Logger
(
"offlinerouting"
)
var
log
=
loggin
g
.
Logger
(
"offlinerouting"
)
var
ErrOffline
=
errors
.
New
(
"routing system in offline mode"
)
var
ErrOffline
=
errors
.
New
(
"routing system in offline mode"
)
...
...
record/record.go
View file @
d8d7cc75
...
@@ -9,11 +9,11 @@ import (
...
@@ -9,11 +9,11 @@ import (
dag
"github.com/ipfs/go-ipfs/merkledag"
dag
"github.com/ipfs/go-ipfs/merkledag"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
ci
"github.com/ipfs/go-ipfs/p2p/crypto"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
_
=
dag
.
FetchGraph
var
_
=
dag
.
FetchGraph
var
log
=
eventlo
g
.
Logger
(
"routing/record"
)
var
log
=
loggin
g
.
Logger
(
"routing/record"
)
// MakePutRecord creates and signs a dht record for the given key/value pair
// MakePutRecord creates and signs a dht record for the given key/value pair
func
MakePutRecord
(
sk
ci
.
PrivKey
,
key
key
.
Key
,
value
[]
byte
,
sign
bool
)
(
*
pb
.
Record
,
error
)
{
func
MakePutRecord
(
sk
ci
.
PrivKey
,
key
key
.
Key
,
value
[]
byte
,
sign
bool
)
(
*
pb
.
Record
,
error
)
{
...
...
supernode/client.go
View file @
d8d7cc75
...
@@ -14,10 +14,10 @@ import (
...
@@ -14,10 +14,10 @@ import (
routing
"github.com/ipfs/go-ipfs/routing"
routing
"github.com/ipfs/go-ipfs/routing"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
pb
"github.com/ipfs/go-ipfs/routing/dht/pb"
proxy
"github.com/ipfs/go-ipfs/routing/supernode/proxy"
proxy
"github.com/ipfs/go-ipfs/routing/supernode/proxy"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
var
log
=
eventlo
g
.
Logger
(
"supernode"
)
var
log
=
loggin
g
.
Logger
(
"supernode"
)
type
Client
struct
{
type
Client
struct
{
peerhost
host
.
Host
peerhost
host
.
Host
...
@@ -37,7 +37,7 @@ func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (*
...
@@ -37,7 +37,7 @@ func NewClient(px proxy.Proxy, h host.Host, ps peer.Peerstore, local peer.ID) (*
}
}
func
(
c
*
Client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
key
.
Key
,
max
int
)
<-
chan
peer
.
PeerInfo
{
func
(
c
*
Client
)
FindProvidersAsync
(
ctx
context
.
Context
,
k
key
.
Key
,
max
int
)
<-
chan
peer
.
PeerInfo
{
ctx
=
eventlo
g
.
ContextWithLoggable
(
ctx
,
eventlo
g
.
Uuid
(
"findProviders"
))
ctx
=
loggin
g
.
ContextWithLoggable
(
ctx
,
loggin
g
.
Uuid
(
"findProviders"
))
defer
log
.
EventBegin
(
ctx
,
"findProviders"
,
&
k
)
.
Done
()
defer
log
.
EventBegin
(
ctx
,
"findProviders"
,
&
k
)
.
Done
()
ch
:=
make
(
chan
peer
.
PeerInfo
)
ch
:=
make
(
chan
peer
.
PeerInfo
)
go
func
()
{
go
func
()
{
...
...
supernode/proxy/standard.go
View file @
d8d7cc75
...
@@ -12,12 +12,12 @@ import (
...
@@ -12,12 +12,12 @@ import (
peer
"github.com/ipfs/go-ipfs/p2p/peer"
peer
"github.com/ipfs/go-ipfs/p2p/peer"
dhtpb
"github.com/ipfs/go-ipfs/routing/dht/pb"
dhtpb
"github.com/ipfs/go-ipfs/routing/dht/pb"
kbucket
"github.com/ipfs/go-ipfs/routing/kbucket"
kbucket
"github.com/ipfs/go-ipfs/routing/kbucket"
eventlo
g
"github.com/ipfs/go-ipfs/
thirdparty/eventlog
"
loggin
g
"github.com/ipfs/go-ipfs/
vendor/go-log-v1.0.0
"
)
)
const
ProtocolSNR
=
"/ipfs/supernoderouting"
const
ProtocolSNR
=
"/ipfs/supernoderouting"
var
log
=
eventlo
g
.
Logger
(
"supernode/proxy"
)
var
log
=
loggin
g
.
Logger
(
"supernode/proxy"
)
type
Proxy
interface
{
type
Proxy
interface
{
Bootstrap
(
context
.
Context
)
error
Bootstrap
(
context
.
Context
)
error
...
@@ -127,7 +127,7 @@ func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.M
...
@@ -127,7 +127,7 @@ func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.M
}
}
func
(
px
*
standard
)
sendRequest
(
ctx
context
.
Context
,
m
*
dhtpb
.
Message
,
remote
peer
.
ID
)
(
*
dhtpb
.
Message
,
error
)
{
func
(
px
*
standard
)
sendRequest
(
ctx
context
.
Context
,
m
*
dhtpb
.
Message
,
remote
peer
.
ID
)
(
*
dhtpb
.
Message
,
error
)
{
e
:=
log
.
EventBegin
(
ctx
,
"sendRoutingRequest"
,
px
.
Host
.
ID
(),
remote
,
eventlo
g
.
Pair
(
"request"
,
m
))
e
:=
log
.
EventBegin
(
ctx
,
"sendRoutingRequest"
,
px
.
Host
.
ID
(),
remote
,
loggin
g
.
Pair
(
"request"
,
m
))
defer
e
.
Done
()
defer
e
.
Done
()
if
err
:=
px
.
Host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
remote
});
err
!=
nil
{
if
err
:=
px
.
Host
.
Connect
(
ctx
,
peer
.
PeerInfo
{
ID
:
remote
});
err
!=
nil
{
e
.
SetError
(
err
)
e
.
SetError
(
err
)
...
@@ -157,8 +157,8 @@ func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote pe
...
@@ -157,8 +157,8 @@ func (px *standard) sendRequest(ctx context.Context, m *dhtpb.Message, remote pe
e
.
SetError
(
err
)
e
.
SetError
(
err
)
return
nil
,
err
return
nil
,
err
}
}
e
.
Append
(
eventlo
g
.
Pair
(
"response"
,
response
))
e
.
Append
(
loggin
g
.
Pair
(
"response"
,
response
))
e
.
Append
(
eventlo
g
.
Pair
(
"uuid"
,
eventlo
g
.
Uuid
(
"foo"
)))
e
.
Append
(
loggin
g
.
Pair
(
"uuid"
,
loggin
g
.
Uuid
(
"foo"
)))
return
response
,
nil
return
response
,
nil
}
}
...
...
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