dee2c137c8
* slowly but surely * hardcode ID for tests so we can get predictable results * skipping bad test * removing tests of bkad * wip * new algorithm for worker * clean up * remove skipped test * changes * uncomment * fixed conflicts * maybe done ? * cleanup * boot bkad * wip * cleanup * undo change * fixes * wip * wip * moving nodeID around * wip * wip * fixes * fixes after merge * added TODO * fixed tests post identity * linter fixes * wip * PR review comments * wip * fixing tests * fix tests * force db directory * bad test * fixes race condition * small cleanups * adding db folder * testing * wip * cleanup * cleanup * linters * export Restrict * add timeout * testing * linters * forgot one * moar fixes from master merge * PR comments * moar PR comments * removed stun flag * remove duplicate declaration * remove old tests * remove timeout * fix tests * missed one * changed StringToID >> IDFromString * PR comments * stupid linter * moevd overlay mock * fixed merge conflicts * fixes * linter
36 lines
861 B
Go
36 lines
861 B
Go
// Copyright (C) 2018 Storj Labs, Inc.
|
|
// See LICENSE for copying information
|
|
|
|
package node
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/zeebo/errs"
|
|
|
|
"storj.io/storj/pkg/dht"
|
|
"storj.io/storj/pkg/pb"
|
|
"storj.io/storj/pkg/pool"
|
|
"storj.io/storj/pkg/provider"
|
|
"storj.io/storj/pkg/transport"
|
|
)
|
|
|
|
//NodeClientErr is the class for all errors pertaining to node client operations
|
|
var NodeClientErr = errs.Class("node client error")
|
|
|
|
// NewNodeClient instantiates a node client
|
|
func NewNodeClient(identity *provider.FullIdentity, self pb.Node, dht dht.DHT) (Client, error) {
|
|
client := transport.NewClient(identity)
|
|
return &Node{
|
|
dht: dht,
|
|
self: self,
|
|
tc: client,
|
|
cache: pool.NewConnectionPool(),
|
|
}, nil
|
|
}
|
|
|
|
// Client is the Node client communication interface
|
|
type Client interface {
|
|
Lookup(ctx context.Context, to pb.Node, find pb.Node) ([]*pb.Node, error)
|
|
}
|