b6b6111173
* protos: move streams to pb * protos: move overlay to pb * protos: move pointerdb to pb * protos: move piecestore to pb * fix statdb import naming
34 lines
808 B
Go
34 lines
808 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/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) (Client, error) {
|
|
client := transport.NewClient(identity)
|
|
return &Node{
|
|
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)
|
|
}
|