1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-11 07:03:32 +08:00

comments from CR

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-07-17 10:12:27 -07:00
parent 45d4b1a8bc
commit c6ee2058d9
4 changed files with 6 additions and 8 deletions

4
Godeps/Godeps.json generated
View File

@ -166,11 +166,7 @@
}, },
{ {
"ImportPath": "github.com/jbenet/go-datastore", "ImportPath": "github.com/jbenet/go-datastore",
<<<<<<< HEAD
"Rev": "c835c30f206c1e97172e428f052e225adab9abde" "Rev": "c835c30f206c1e97172e428f052e225adab9abde"
=======
"Rev": "47af23f2ad09237ccc09c586c118048e2b39b358"
>>>>>>> fixup datastore interfaces
}, },
{ {
"ImportPath": "github.com/jbenet/go-detect-race", "ImportPath": "github.com/jbenet/go-detect-race",

View File

@ -52,9 +52,11 @@ type GCBlockstore interface {
} }
func NewBlockstore(d ds.Batching) *blockstore { func NewBlockstore(d ds.Batching) *blockstore {
var dsb ds.Batching
dd := dsns.Wrap(d, BlockPrefix) dd := dsns.Wrap(d, BlockPrefix)
dsb = dd
return &blockstore{ return &blockstore{
datastore: dd, datastore: dsb,
} }
} }

View File

@ -28,7 +28,7 @@ var (
// SupernodeServer returns a configuration for a routing server that stores // SupernodeServer returns a configuration for a routing server that stores
// routing records to the provided datastore. Only routing records are store in // routing records to the provided datastore. Only routing records are store in
// the datastore. // the datastore.
func SupernodeServer(recordSource ds.ThreadSafeDatastore) core.RoutingOption { func SupernodeServer(recordSource ds.Datastore) core.RoutingOption {
return func(ctx context.Context, ph host.Host, dstore repo.Datastore) (routing.IpfsRouting, error) { return func(ctx context.Context, ph host.Host, dstore repo.Datastore) (routing.IpfsRouting, error) {
server, err := supernode.NewServer(recordSource, ph.Peerstore(), ph.ID()) server, err := supernode.NewServer(recordSource, ph.Peerstore(), ph.ID())
if err != nil { if err != nil {

View File

@ -18,13 +18,13 @@ import (
// Server handles routing queries using a database backend // Server handles routing queries using a database backend
type Server struct { type Server struct {
local peer.ID local peer.ID
routingBackend datastore.ThreadSafeDatastore routingBackend datastore.Datastore
peerstore peer.Peerstore peerstore peer.Peerstore
*proxy.Loopback // so server can be injected into client *proxy.Loopback // so server can be injected into client
} }
// NewServer creates a new Supernode routing Server // NewServer creates a new Supernode routing Server
func NewServer(ds datastore.ThreadSafeDatastore, ps peer.Peerstore, local peer.ID) (*Server, error) { func NewServer(ds datastore.Datastore, ps peer.Peerstore, local peer.ID) (*Server, error) {
s := &Server{local, ds, ps, nil} s := &Server{local, ds, ps, nil}
s.Loopback = &proxy.Loopback{ s.Loopback = &proxy.Loopback{
Handler: s, Handler: s,