node-node communication (#145)
* node-node communication * PR reviews comments from @bryanchriswhite addressed
This commit is contained in:
parent
f445fab28b
commit
ea077e4dcb
29
internal/test/utils.go
Normal file
29
internal/test/utils.go
Normal file
@ -0,0 +1,29 @@
|
||||
package test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
pb "github.com/gogo/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"storj.io/storj/pkg/kademlia"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
"storj.io/storj/storage"
|
||||
)
|
||||
|
||||
// NewNodeAddressValue provides a convient way to create a storage.Value for testing purposes
|
||||
func NewNodeAddressValue(t *testing.T, address string) storage.Value {
|
||||
na := &proto.NodeAddress{Transport: proto.NodeTransport_TCP, Address: address}
|
||||
d, err := pb.Marshal(na)
|
||||
assert.NoError(t, err)
|
||||
|
||||
return d
|
||||
}
|
||||
|
||||
// NewNodeID returns the string representation of a dht node ID
|
||||
func NewNodeID(t *testing.T) string {
|
||||
id, err := kademlia.NewID()
|
||||
assert.NoError(t, err)
|
||||
|
||||
return id.String()
|
||||
}
|
27
pkg/node/client.go
Normal file
27
pkg/node/client.go
Normal file
@ -0,0 +1,27 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"storj.io/storj/pkg/pool"
|
||||
|
||||
"storj.io/storj/pkg/transport"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
// NewNodeClient instantiates a node client
|
||||
func NewNodeClient(self proto.Node) (Client, error) {
|
||||
return &Node{
|
||||
self: self,
|
||||
tc: transport.NewClient(),
|
||||
cache: pool.NewConnectionPool(),
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Client is the Node client communication interface
|
||||
type Client interface {
|
||||
Lookup(ctx context.Context, to proto.Node, find proto.Node) ([]*proto.Node, error)
|
||||
}
|
47
pkg/node/node.go
Normal file
47
pkg/node/node.go
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"google.golang.org/grpc"
|
||||
"storj.io/storj/pkg/pool"
|
||||
"storj.io/storj/pkg/transport"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
// Node is the storj definition for a node in the network
|
||||
type Node struct {
|
||||
self proto.Node
|
||||
tc transport.Client
|
||||
cache pool.Pool
|
||||
}
|
||||
|
||||
// Lookup queries nodes looking for a particular node in the network
|
||||
func (n *Node) Lookup(ctx context.Context, to proto.Node, find proto.Node) ([]*proto.Node, error) {
|
||||
v, err := n.cache.Get(ctx, to.GetId())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var conn *grpc.ClientConn
|
||||
if c, ok := v.(*grpc.ClientConn); ok {
|
||||
conn = c
|
||||
} else {
|
||||
c, err := n.tc.DialNode(ctx, &to)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
conn = c
|
||||
}
|
||||
|
||||
c := proto.NewNodesClient(conn)
|
||||
resp, err := c.Query(ctx, &proto.QueryRequest{Sender: &n.self, Receiver: &find})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return resp.Response, nil
|
||||
}
|
66
pkg/node/node_test.go
Normal file
66
pkg/node/node_test.go
Normal file
@ -0,0 +1,66 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"google.golang.org/grpc"
|
||||
|
||||
"storj.io/storj/internal/test"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
func TestLookup(t *testing.T) {
|
||||
cases := []struct {
|
||||
self proto.Node
|
||||
to proto.Node
|
||||
find proto.Node
|
||||
expectedErr error
|
||||
expectedNumNodes int
|
||||
}{
|
||||
{
|
||||
self: proto.Node{Id: test.NewNodeID(t), Address: &proto.NodeAddress{Address: ":7070"}},
|
||||
to: proto.Node{Id: test.NewNodeID(t), Address: &proto.NodeAddress{Address: ":8080"}},
|
||||
find: proto.Node{Id: test.NewNodeID(t), Address: &proto.NodeAddress{Address: ":9090"}},
|
||||
expectedErr: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
lis, err := net.Listen("tcp", fmt.Sprintf(":%d", 8080))
|
||||
assert.NoError(t, err)
|
||||
|
||||
srv, mock := newTestServer()
|
||||
go srv.Serve(lis)
|
||||
defer srv.Stop()
|
||||
|
||||
nc, err := NewNodeClient(v.self)
|
||||
assert.NoError(t, err)
|
||||
|
||||
_, err = nc.Lookup(context.Background(), v.to, v.find)
|
||||
assert.Equal(t, v.expectedErr, err)
|
||||
assert.Equal(t, 1, mock.queryCalled)
|
||||
}
|
||||
}
|
||||
|
||||
func newTestServer() (*grpc.Server, *mockNodeServer) {
|
||||
grpcServer := grpc.NewServer()
|
||||
mn := &mockNodeServer{queryCalled: 0}
|
||||
|
||||
proto.RegisterNodesServer(grpcServer, mn)
|
||||
|
||||
return grpcServer, mn
|
||||
|
||||
}
|
||||
|
||||
type mockNodeServer struct {
|
||||
queryCalled int
|
||||
}
|
||||
|
||||
func (mn *mockNodeServer) Query(ctx context.Context, req *proto.QueryRequest) (*proto.QueryResponse, error) {
|
||||
mn.queryCalled++
|
||||
return &proto.QueryResponse{}, nil
|
||||
}
|
20
pkg/node/server.go
Normal file
20
pkg/node/server.go
Normal file
@ -0,0 +1,20 @@
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"storj.io/storj/pkg/dht"
|
||||
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
// Server implements the grpc Node Server
|
||||
type Server struct {
|
||||
rt dht.RoutingTable
|
||||
}
|
||||
|
||||
// Query is a node to node communication query
|
||||
func (s *Server) Query(ctx context.Context, req proto.QueryRequest) (proto.QueryResponse, error) {
|
||||
// TODO(coyle): this will need to be added to the overlay service
|
||||
return proto.QueryResponse{}, nil
|
||||
}
|
47
pkg/pool/connection_pool.go
Normal file
47
pkg/pool/connection_pool.go
Normal file
@ -0,0 +1,47 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information
|
||||
|
||||
package pool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ConnectionPool is the in memory implementation of a connection Pool
|
||||
type ConnectionPool struct {
|
||||
mu sync.RWMutex
|
||||
cache map[string]interface{}
|
||||
}
|
||||
|
||||
// NewConnectionPool initializes a new in memory pool
|
||||
func NewConnectionPool() Pool {
|
||||
return &ConnectionPool{}
|
||||
}
|
||||
|
||||
// Add takes a node ID as the key and a node client as the value to store
|
||||
func (mp *ConnectionPool) Add(ctx context.Context, key string, value interface{}) error {
|
||||
mp.mu.Lock()
|
||||
defer mp.mu.Unlock()
|
||||
mp.cache[key] = value
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Get retrieves a node connection with the provided nodeID
|
||||
// nil is returned if the NodeID is not in the connection pool
|
||||
func (mp *ConnectionPool) Get(ctx context.Context, key string) (interface{}, error) {
|
||||
mp.mu.Lock()
|
||||
defer mp.mu.Unlock()
|
||||
|
||||
return mp.cache[key], nil
|
||||
}
|
||||
|
||||
// Remove deletes a connection associated with the provided NodeID
|
||||
func (mp *ConnectionPool) Remove(ctx context.Context, key string) error {
|
||||
mp.mu.Lock()
|
||||
defer mp.mu.Unlock()
|
||||
mp.cache[key] = nil
|
||||
|
||||
return nil
|
||||
}
|
89
pkg/pool/connection_pool_test.go
Normal file
89
pkg/pool/connection_pool_test.go
Normal file
@ -0,0 +1,89 @@
|
||||
package pool
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
type TestFoo struct {
|
||||
called string
|
||||
}
|
||||
|
||||
func TestGet(t *testing.T) {
|
||||
cases := []struct {
|
||||
pool ConnectionPool
|
||||
key string
|
||||
expected TestFoo
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
pool: ConnectionPool{cache: map[string]interface{}{"foo": TestFoo{called: "hoot"}}},
|
||||
key: "foo",
|
||||
expected: TestFoo{called: "hoot"},
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
test, err := v.pool.Get(context.Background(), v.key)
|
||||
assert.Equal(t, v.expectedError, err)
|
||||
assert.Equal(t, v.expected, test)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAdd(t *testing.T) {
|
||||
cases := []struct {
|
||||
pool ConnectionPool
|
||||
key string
|
||||
value TestFoo
|
||||
expected TestFoo
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
pool: ConnectionPool{cache: map[string]interface{}{}},
|
||||
key: "foo",
|
||||
value: TestFoo{called: "hoot"},
|
||||
expected: TestFoo{called: "hoot"},
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
err := v.pool.Add(context.Background(), v.key, v.value)
|
||||
assert.Equal(t, v.expectedError, err)
|
||||
|
||||
test, err := v.pool.Get(context.Background(), v.key)
|
||||
assert.Equal(t, v.expectedError, err)
|
||||
|
||||
assert.Equal(t, v.expected, test)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRemove(t *testing.T) {
|
||||
cases := []struct {
|
||||
pool ConnectionPool
|
||||
key string
|
||||
value TestFoo
|
||||
expected interface{}
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
pool: ConnectionPool{cache: map[string]interface{}{"foo": TestFoo{called: "hoot"}}},
|
||||
key: "foo",
|
||||
expected: nil,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, v := range cases {
|
||||
err := v.pool.Remove(context.Background(), v.key)
|
||||
assert.Equal(t, v.expectedError, err)
|
||||
|
||||
test, err := v.pool.Get(context.Background(), v.key)
|
||||
assert.Equal(t, v.expectedError, err)
|
||||
|
||||
assert.Equal(t, v.expected, test)
|
||||
}
|
||||
}
|
15
pkg/pool/pool.go
Normal file
15
pkg/pool/pool.go
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information
|
||||
|
||||
package pool
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// Pool is a set of actions for maintaining a node connection pool
|
||||
type Pool interface {
|
||||
Add(ctx context.Context, key string, value interface{}) error
|
||||
Get(ctx context.Context, key string) (interface{}, error)
|
||||
Remove(ctx context.Context, key string) error
|
||||
}
|
@ -15,8 +15,13 @@ import (
|
||||
type Transport struct {
|
||||
}
|
||||
|
||||
// NewClient returns a newly instantiated Transport Client
|
||||
func NewClient() *Transport {
|
||||
return &Transport{}
|
||||
}
|
||||
|
||||
// DialNode using the authenticated mode
|
||||
func (o *Transport) DialNode(ctx context.Context, node proto.Node) (conn *grpc.ClientConn, err error) {
|
||||
func (o *Transport) DialNode(ctx context.Context, node *proto.Node) (conn *grpc.ClientConn, err error) {
|
||||
defer mon.Task()(&ctx)(&err)
|
||||
|
||||
if node.Address == nil {
|
||||
|
@ -22,7 +22,7 @@ func TestDialNode(t *testing.T) {
|
||||
Address: "",
|
||||
},
|
||||
}
|
||||
conn, err := oc.DialNode(context.Background(), node)
|
||||
conn, err := oc.DialNode(context.Background(), &node)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, conn)
|
||||
|
||||
@ -31,7 +31,7 @@ func TestDialNode(t *testing.T) {
|
||||
Id: "DUMMYID2",
|
||||
Address: nil,
|
||||
}
|
||||
conn, err = oc.DialNode(context.Background(), node)
|
||||
conn, err = oc.DialNode(context.Background(), &node)
|
||||
assert.Error(t, err)
|
||||
assert.Nil(t, conn)
|
||||
|
||||
@ -43,7 +43,7 @@ func TestDialNode(t *testing.T) {
|
||||
Address: "127.0.0.0:9000",
|
||||
},
|
||||
}
|
||||
conn, err = oc.DialNode(context.Background(), node)
|
||||
conn, err = oc.DialNode(context.Background(), &node)
|
||||
assert.NoError(t, err)
|
||||
assert.NotNil(t, conn)
|
||||
}
|
||||
|
@ -1,28 +1,12 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: overlay.proto
|
||||
|
||||
/*
|
||||
Package overlay is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
overlay.proto
|
||||
|
||||
It has these top-level messages:
|
||||
LookupRequest
|
||||
LookupResponse
|
||||
FindStorageNodesResponse
|
||||
FindStorageNodesRequest
|
||||
NodeAddress
|
||||
OverlayOptions
|
||||
NodeRep
|
||||
Node
|
||||
*/
|
||||
package overlay
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
import google_protobuf "github.com/golang/protobuf/ptypes/duration"
|
||||
import duration "github.com/golang/protobuf/ptypes/duration"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
@ -57,17 +41,41 @@ var NodeTransport_value = map[string]int32{
|
||||
func (x NodeTransport) String() string {
|
||||
return proto.EnumName(NodeTransport_name, int32(x))
|
||||
}
|
||||
func (NodeTransport) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (NodeTransport) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{0}
|
||||
}
|
||||
|
||||
// LookupRequest is is request message for the lookup rpc call
|
||||
type LookupRequest struct {
|
||||
NodeID string `protobuf:"bytes,1,opt,name=nodeID" json:"nodeID,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LookupRequest) Reset() { *m = LookupRequest{} }
|
||||
func (m *LookupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LookupRequest) ProtoMessage() {}
|
||||
func (*LookupRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
func (*LookupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{0}
|
||||
}
|
||||
func (m *LookupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LookupRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LookupRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LookupRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *LookupRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LookupRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *LookupRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_LookupRequest.Size(m)
|
||||
}
|
||||
func (m *LookupRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LookupRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LookupRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *LookupRequest) GetNodeID() string {
|
||||
if m != nil {
|
||||
@ -79,12 +87,34 @@ func (m *LookupRequest) GetNodeID() string {
|
||||
// LookupResponse is is response message for the lookup rpc call
|
||||
type LookupResponse struct {
|
||||
Node *Node `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *LookupResponse) Reset() { *m = LookupResponse{} }
|
||||
func (m *LookupResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LookupResponse) ProtoMessage() {}
|
||||
func (*LookupResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
func (*LookupResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{1}
|
||||
}
|
||||
func (m *LookupResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LookupResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *LookupResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_LookupResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *LookupResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_LookupResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *LookupResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_LookupResponse.Size(m)
|
||||
}
|
||||
func (m *LookupResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_LookupResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_LookupResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *LookupResponse) GetNode() *Node {
|
||||
if m != nil {
|
||||
@ -96,12 +126,34 @@ func (m *LookupResponse) GetNode() *Node {
|
||||
// FindStorageNodesResponse is is response message for the FindStorageNodes rpc call
|
||||
type FindStorageNodesResponse struct {
|
||||
Nodes []*Node `protobuf:"bytes,1,rep,name=nodes" json:"nodes,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FindStorageNodesResponse) Reset() { *m = FindStorageNodesResponse{} }
|
||||
func (m *FindStorageNodesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindStorageNodesResponse) ProtoMessage() {}
|
||||
func (*FindStorageNodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
func (*FindStorageNodesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{2}
|
||||
}
|
||||
func (m *FindStorageNodesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FindStorageNodesResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *FindStorageNodesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_FindStorageNodesResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *FindStorageNodesResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_FindStorageNodesResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *FindStorageNodesResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_FindStorageNodesResponse.Size(m)
|
||||
}
|
||||
func (m *FindStorageNodesResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_FindStorageNodesResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_FindStorageNodesResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *FindStorageNodesResponse) GetNodes() []*Node {
|
||||
if m != nil {
|
||||
@ -113,14 +165,36 @@ func (m *FindStorageNodesResponse) GetNodes() []*Node {
|
||||
// FindStorageNodesRequest is is request message for the FindStorageNodes rpc call
|
||||
type FindStorageNodesRequest struct {
|
||||
ObjectSize int64 `protobuf:"varint,1,opt,name=objectSize" json:"objectSize,omitempty"`
|
||||
ContractLength *google_protobuf.Duration `protobuf:"bytes,2,opt,name=contractLength" json:"contractLength,omitempty"`
|
||||
ContractLength *duration.Duration `protobuf:"bytes,2,opt,name=contractLength" json:"contractLength,omitempty"`
|
||||
Opts *OverlayOptions `protobuf:"bytes,3,opt,name=opts" json:"opts,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *FindStorageNodesRequest) Reset() { *m = FindStorageNodesRequest{} }
|
||||
func (m *FindStorageNodesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindStorageNodesRequest) ProtoMessage() {}
|
||||
func (*FindStorageNodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
func (*FindStorageNodesRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{3}
|
||||
}
|
||||
func (m *FindStorageNodesRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FindStorageNodesRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *FindStorageNodesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_FindStorageNodesRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *FindStorageNodesRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_FindStorageNodesRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *FindStorageNodesRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_FindStorageNodesRequest.Size(m)
|
||||
}
|
||||
func (m *FindStorageNodesRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_FindStorageNodesRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_FindStorageNodesRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *FindStorageNodesRequest) GetObjectSize() int64 {
|
||||
if m != nil {
|
||||
@ -129,7 +203,7 @@ func (m *FindStorageNodesRequest) GetObjectSize() int64 {
|
||||
return 0
|
||||
}
|
||||
|
||||
func (m *FindStorageNodesRequest) GetContractLength() *google_protobuf.Duration {
|
||||
func (m *FindStorageNodesRequest) GetContractLength() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.ContractLength
|
||||
}
|
||||
@ -145,14 +219,36 @@ func (m *FindStorageNodesRequest) GetOpts() *OverlayOptions {
|
||||
|
||||
// NodeAddress contains the information needed to communicate with a node on the network
|
||||
type NodeAddress struct {
|
||||
Transport NodeTransport `protobuf:"varint,1,opt,name=transport,enum=NodeTransport" json:"transport,omitempty"`
|
||||
Transport NodeTransport `protobuf:"varint,1,opt,name=transport,enum=overlay.NodeTransport" json:"transport,omitempty"`
|
||||
Address string `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *NodeAddress) Reset() { *m = NodeAddress{} }
|
||||
func (m *NodeAddress) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeAddress) ProtoMessage() {}
|
||||
func (*NodeAddress) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} }
|
||||
func (*NodeAddress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{4}
|
||||
}
|
||||
func (m *NodeAddress) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NodeAddress.Unmarshal(m, b)
|
||||
}
|
||||
func (m *NodeAddress) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_NodeAddress.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *NodeAddress) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NodeAddress.Merge(dst, src)
|
||||
}
|
||||
func (m *NodeAddress) XXX_Size() int {
|
||||
return xxx_messageInfo_NodeAddress.Size(m)
|
||||
}
|
||||
func (m *NodeAddress) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NodeAddress.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NodeAddress proto.InternalMessageInfo
|
||||
|
||||
func (m *NodeAddress) GetTransport() NodeTransport {
|
||||
if m != nil {
|
||||
@ -170,18 +266,40 @@ func (m *NodeAddress) GetAddress() string {
|
||||
|
||||
// OverlayOptions is a set of criteria that a node must meet to be considered for a storage opportunity
|
||||
type OverlayOptions struct {
|
||||
MaxLatency *google_protobuf.Duration `protobuf:"bytes,1,opt,name=maxLatency" json:"maxLatency,omitempty"`
|
||||
MaxLatency *duration.Duration `protobuf:"bytes,1,opt,name=maxLatency" json:"maxLatency,omitempty"`
|
||||
MinReputation *NodeRep `protobuf:"bytes,2,opt,name=minReputation" json:"minReputation,omitempty"`
|
||||
MinSpeedKbps int64 `protobuf:"varint,3,opt,name=minSpeedKbps" json:"minSpeedKbps,omitempty"`
|
||||
Limit int64 `protobuf:"varint,4,opt,name=limit" json:"limit,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *OverlayOptions) Reset() { *m = OverlayOptions{} }
|
||||
func (m *OverlayOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*OverlayOptions) ProtoMessage() {}
|
||||
func (*OverlayOptions) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} }
|
||||
func (*OverlayOptions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{5}
|
||||
}
|
||||
func (m *OverlayOptions) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_OverlayOptions.Unmarshal(m, b)
|
||||
}
|
||||
func (m *OverlayOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_OverlayOptions.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *OverlayOptions) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_OverlayOptions.Merge(dst, src)
|
||||
}
|
||||
func (m *OverlayOptions) XXX_Size() int {
|
||||
return xxx_messageInfo_OverlayOptions.Size(m)
|
||||
}
|
||||
func (m *OverlayOptions) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_OverlayOptions.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
func (m *OverlayOptions) GetMaxLatency() *google_protobuf.Duration {
|
||||
var xxx_messageInfo_OverlayOptions proto.InternalMessageInfo
|
||||
|
||||
func (m *OverlayOptions) GetMaxLatency() *duration.Duration {
|
||||
if m != nil {
|
||||
return m.MaxLatency
|
||||
}
|
||||
@ -211,23 +329,67 @@ func (m *OverlayOptions) GetLimit() int64 {
|
||||
|
||||
// NodeRep is the reputation characteristics of a node
|
||||
type NodeRep struct {
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *NodeRep) Reset() { *m = NodeRep{} }
|
||||
func (m *NodeRep) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeRep) ProtoMessage() {}
|
||||
func (*NodeRep) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} }
|
||||
func (*NodeRep) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{6}
|
||||
}
|
||||
func (m *NodeRep) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NodeRep.Unmarshal(m, b)
|
||||
}
|
||||
func (m *NodeRep) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_NodeRep.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *NodeRep) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_NodeRep.Merge(dst, src)
|
||||
}
|
||||
func (m *NodeRep) XXX_Size() int {
|
||||
return xxx_messageInfo_NodeRep.Size(m)
|
||||
}
|
||||
func (m *NodeRep) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_NodeRep.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_NodeRep proto.InternalMessageInfo
|
||||
|
||||
// Node represents a node in the overlay network
|
||||
type Node struct {
|
||||
Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"`
|
||||
Address *NodeAddress `protobuf:"bytes,2,opt,name=address" json:"address,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *Node) Reset() { *m = Node{} }
|
||||
func (m *Node) String() string { return proto.CompactTextString(m) }
|
||||
func (*Node) ProtoMessage() {}
|
||||
func (*Node) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} }
|
||||
func (*Node) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{7}
|
||||
}
|
||||
func (m *Node) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Node.Unmarshal(m, b)
|
||||
}
|
||||
func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_Node.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *Node) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_Node.Merge(dst, src)
|
||||
}
|
||||
func (m *Node) XXX_Size() int {
|
||||
return xxx_messageInfo_Node.Size(m)
|
||||
}
|
||||
func (m *Node) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_Node.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_Node proto.InternalMessageInfo
|
||||
|
||||
func (m *Node) GetId() string {
|
||||
if m != nil {
|
||||
@ -243,16 +405,110 @@ func (m *Node) GetAddress() *NodeAddress {
|
||||
return nil
|
||||
}
|
||||
|
||||
type QueryRequest struct {
|
||||
Sender *Node `protobuf:"bytes,1,opt,name=sender" json:"sender,omitempty"`
|
||||
Receiver *Node `protobuf:"bytes,2,opt,name=receiver" json:"receiver,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *QueryRequest) Reset() { *m = QueryRequest{} }
|
||||
func (m *QueryRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryRequest) ProtoMessage() {}
|
||||
func (*QueryRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{8}
|
||||
}
|
||||
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_QueryRequest.Unmarshal(m, b)
|
||||
}
|
||||
func (m *QueryRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_QueryRequest.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *QueryRequest) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryRequest.Merge(dst, src)
|
||||
}
|
||||
func (m *QueryRequest) XXX_Size() int {
|
||||
return xxx_messageInfo_QueryRequest.Size(m)
|
||||
}
|
||||
func (m *QueryRequest) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryRequest.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryRequest proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryRequest) GetSender() *Node {
|
||||
if m != nil {
|
||||
return m.Sender
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *QueryRequest) GetReceiver() *Node {
|
||||
if m != nil {
|
||||
return m.Receiver
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
type QueryResponse struct {
|
||||
Sender *Node `protobuf:"bytes,1,opt,name=sender" json:"sender,omitempty"`
|
||||
Response []*Node `protobuf:"bytes,2,rep,name=response" json:"response,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
}
|
||||
|
||||
func (m *QueryResponse) Reset() { *m = QueryResponse{} }
|
||||
func (m *QueryResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*QueryResponse) ProtoMessage() {}
|
||||
func (*QueryResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_aafd300da6d5535b, []int{9}
|
||||
}
|
||||
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_QueryResponse.Unmarshal(m, b)
|
||||
}
|
||||
func (m *QueryResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
|
||||
return xxx_messageInfo_QueryResponse.Marshal(b, m, deterministic)
|
||||
}
|
||||
func (dst *QueryResponse) XXX_Merge(src proto.Message) {
|
||||
xxx_messageInfo_QueryResponse.Merge(dst, src)
|
||||
}
|
||||
func (m *QueryResponse) XXX_Size() int {
|
||||
return xxx_messageInfo_QueryResponse.Size(m)
|
||||
}
|
||||
func (m *QueryResponse) XXX_DiscardUnknown() {
|
||||
xxx_messageInfo_QueryResponse.DiscardUnknown(m)
|
||||
}
|
||||
|
||||
var xxx_messageInfo_QueryResponse proto.InternalMessageInfo
|
||||
|
||||
func (m *QueryResponse) GetSender() *Node {
|
||||
if m != nil {
|
||||
return m.Sender
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *QueryResponse) GetResponse() []*Node {
|
||||
if m != nil {
|
||||
return m.Response
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*LookupRequest)(nil), "LookupRequest")
|
||||
proto.RegisterType((*LookupResponse)(nil), "LookupResponse")
|
||||
proto.RegisterType((*FindStorageNodesResponse)(nil), "FindStorageNodesResponse")
|
||||
proto.RegisterType((*FindStorageNodesRequest)(nil), "FindStorageNodesRequest")
|
||||
proto.RegisterType((*NodeAddress)(nil), "NodeAddress")
|
||||
proto.RegisterType((*OverlayOptions)(nil), "OverlayOptions")
|
||||
proto.RegisterType((*NodeRep)(nil), "NodeRep")
|
||||
proto.RegisterType((*Node)(nil), "Node")
|
||||
proto.RegisterEnum("NodeTransport", NodeTransport_name, NodeTransport_value)
|
||||
proto.RegisterType((*LookupRequest)(nil), "overlay.LookupRequest")
|
||||
proto.RegisterType((*LookupResponse)(nil), "overlay.LookupResponse")
|
||||
proto.RegisterType((*FindStorageNodesResponse)(nil), "overlay.FindStorageNodesResponse")
|
||||
proto.RegisterType((*FindStorageNodesRequest)(nil), "overlay.FindStorageNodesRequest")
|
||||
proto.RegisterType((*NodeAddress)(nil), "overlay.NodeAddress")
|
||||
proto.RegisterType((*OverlayOptions)(nil), "overlay.OverlayOptions")
|
||||
proto.RegisterType((*NodeRep)(nil), "overlay.NodeRep")
|
||||
proto.RegisterType((*Node)(nil), "overlay.Node")
|
||||
proto.RegisterType((*QueryRequest)(nil), "overlay.QueryRequest")
|
||||
proto.RegisterType((*QueryResponse)(nil), "overlay.QueryResponse")
|
||||
proto.RegisterEnum("overlay.NodeTransport", NodeTransport_name, NodeTransport_value)
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
@ -263,8 +519,9 @@ var _ grpc.ClientConn
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for Overlay service
|
||||
|
||||
// OverlayClient is the client API for Overlay service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type OverlayClient interface {
|
||||
// Lookup finds a nodes address from the network
|
||||
Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error)
|
||||
@ -282,7 +539,7 @@ func NewOverlayClient(cc *grpc.ClientConn) OverlayClient {
|
||||
|
||||
func (c *overlayClient) Lookup(ctx context.Context, in *LookupRequest, opts ...grpc.CallOption) (*LookupResponse, error) {
|
||||
out := new(LookupResponse)
|
||||
err := grpc.Invoke(ctx, "/Overlay/Lookup", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/overlay.Overlay/Lookup", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -291,15 +548,14 @@ func (c *overlayClient) Lookup(ctx context.Context, in *LookupRequest, opts ...g
|
||||
|
||||
func (c *overlayClient) FindStorageNodes(ctx context.Context, in *FindStorageNodesRequest, opts ...grpc.CallOption) (*FindStorageNodesResponse, error) {
|
||||
out := new(FindStorageNodesResponse)
|
||||
err := grpc.Invoke(ctx, "/Overlay/FindStorageNodes", in, out, c.cc, opts...)
|
||||
err := c.cc.Invoke(ctx, "/overlay.Overlay/FindStorageNodes", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Overlay service
|
||||
|
||||
// OverlayServer is the server API for Overlay service.
|
||||
type OverlayServer interface {
|
||||
// Lookup finds a nodes address from the network
|
||||
Lookup(context.Context, *LookupRequest) (*LookupResponse, error)
|
||||
@ -321,7 +577,7 @@ func _Overlay_Lookup_Handler(srv interface{}, ctx context.Context, dec func(inte
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Overlay/Lookup",
|
||||
FullMethod: "/overlay.Overlay/Lookup",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OverlayServer).Lookup(ctx, req.(*LookupRequest))
|
||||
@ -339,7 +595,7 @@ func _Overlay_FindStorageNodes_Handler(srv interface{}, ctx context.Context, dec
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/Overlay/FindStorageNodes",
|
||||
FullMethod: "/overlay.Overlay/FindStorageNodes",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(OverlayServer).FindStorageNodes(ctx, req.(*FindStorageNodesRequest))
|
||||
@ -348,7 +604,7 @@ func _Overlay_FindStorageNodes_Handler(srv interface{}, ctx context.Context, dec
|
||||
}
|
||||
|
||||
var _Overlay_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "Overlay",
|
||||
ServiceName: "overlay.Overlay",
|
||||
HandlerType: (*OverlayServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
@ -364,37 +620,106 @@ var _Overlay_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "overlay.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("overlay.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 450 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x92, 0xdf, 0x8a, 0x13, 0x31,
|
||||
0x14, 0xc6, 0x9d, 0x4e, 0xff, 0xd8, 0xd3, 0xed, 0xec, 0x12, 0x44, 0xd3, 0x0a, 0xb2, 0x44, 0xf0,
|
||||
0x3f, 0xb9, 0xa8, 0x17, 0xe2, 0x8d, 0xb0, 0xb8, 0x28, 0x62, 0x71, 0x25, 0x5d, 0x1f, 0x60, 0xda,
|
||||
0xc4, 0x1a, 0x6d, 0x73, 0xe2, 0x24, 0x23, 0xae, 0xe0, 0xc3, 0xf8, 0x10, 0xbe, 0x9f, 0x4c, 0x32,
|
||||
0xdd, 0xed, 0x54, 0xba, 0x77, 0x73, 0xce, 0xf9, 0xbe, 0xc9, 0x39, 0x3f, 0x3e, 0x18, 0xe2, 0x0f,
|
||||
0x55, 0xac, 0xf2, 0x0b, 0x6e, 0x0b, 0xf4, 0x38, 0xce, 0x64, 0x59, 0xe4, 0x5e, 0xa3, 0x89, 0x35,
|
||||
0x7b, 0x08, 0xc3, 0x29, 0xe2, 0xb7, 0xd2, 0x0a, 0xf5, 0xbd, 0x54, 0xce, 0x93, 0xdb, 0xd0, 0x35,
|
||||
0x28, 0xd5, 0xbb, 0x53, 0x9a, 0x1c, 0x27, 0x8f, 0xfa, 0xa2, 0xae, 0xd8, 0x53, 0xc8, 0x36, 0x42,
|
||||
0x67, 0xd1, 0x38, 0x45, 0x46, 0xd0, 0xae, 0x66, 0x41, 0x37, 0x98, 0x74, 0xf8, 0x07, 0x94, 0x4a,
|
||||
0x84, 0x16, 0x7b, 0x01, 0xf4, 0x8d, 0x36, 0x72, 0xe6, 0xb1, 0xc8, 0x97, 0xaa, 0x1a, 0xb8, 0x4b,
|
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 0xe4,
|
||||
0xfb, 0xb9, 0x8d, 0x04, 0x52, 0xd1, 0xe8, 0x91, 0x5b, 0xd0, 0x59, 0xe9, 0xb5, 0xf6, 0xb4, 0x1d,
|
||||
0x86, 0xb1, 0x60, 0x7d, 0xe8, 0xd5, 0xff, 0x64, 0xaf, 0xa0, 0x5d, 0x7d, 0x92, 0x0c, 0x5a, 0x5a,
|
||||
0xd6, 0xf9, 0x69, 0x69, 0x49, 0x1e, 0x34, 0x8f, 0x1e, 0x4c, 0x0e, 0xf8, 0x16, 0xc1, 0x4b, 0x04,
|
||||
0x4f, 0x28, 0x0c, 0x1b, 0xe0, 0x48, 0x0f, 0xd2, 0xf3, 0xd7, 0x1f, 0x8f, 0x6e, 0x4c, 0x7e, 0x43,
|
||||
0xaf, 0x66, 0x43, 0x1e, 0x43, 0x37, 0x06, 0x91, 0x64, 0xbc, 0x11, 0xdd, 0xf1, 0x21, 0xdf, 0x49,
|
||||
0xe8, 0x5b, 0x38, 0xda, 0x0d, 0x13, 0xa1, 0x7c, 0x4f, 0xbe, 0xc6, 0x23, 0xbe, 0x2f, 0xb3, 0xf3,
|
||||
0x6e, 0x80, 0xfd, 0xfc, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0x68, 0x5d, 0x12, 0x4d, 0x03,
|
||||
0x00, 0x00,
|
||||
// NodesClient is the client API for Nodes service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
|
||||
type NodesClient interface {
|
||||
Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error)
|
||||
}
|
||||
|
||||
type nodesClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewNodesClient(cc *grpc.ClientConn) NodesClient {
|
||||
return &nodesClient{cc}
|
||||
}
|
||||
|
||||
func (c *nodesClient) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) {
|
||||
out := new(QueryResponse)
|
||||
err := c.cc.Invoke(ctx, "/overlay.Nodes/Query", in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// NodesServer is the server API for Nodes service.
|
||||
type NodesServer interface {
|
||||
Query(context.Context, *QueryRequest) (*QueryResponse, error)
|
||||
}
|
||||
|
||||
func RegisterNodesServer(s *grpc.Server, srv NodesServer) {
|
||||
s.RegisterService(&_Nodes_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Nodes_Query_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(NodesServer).Query(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/overlay.Nodes/Query",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(NodesServer).Query(ctx, req.(*QueryRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Nodes_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "overlay.Nodes",
|
||||
HandlerType: (*NodesServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Query",
|
||||
Handler: _Nodes_Query_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "overlay.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("overlay.proto", fileDescriptor_overlay_aafd300da6d5535b) }
|
||||
|
||||
var fileDescriptor_overlay_aafd300da6d5535b = []byte{
|
||||
// 541 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0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e, 0xf4, 0xf6, 0x33, 0x58, 0xa5, 0x0f, 0x00,
|
||||
0xf8, 0xf4, 0x0b, 0xce, 0xf4, 0x24, 0xfd, 0x61, 0x55, 0x54, 0xe9, 0xd6, 0x0d, 0x39, 0x87, 0x60,
|
||||
0xc6, 0x99, 0x96, 0xf1, 0x4c, 0x8f, 0x91, 0xcd, 0xf5, 0xe7, 0xb0, 0x62, 0x94, 0xde, 0x1f, 0xce,
|
||||
0x39, 0x9f, 0x2f, 0xd0, 0x76, 0x60, 0x9a, 0x7d, 0x1a, 0x5e, 0xb8, 0x9e, 0xd0, 0x9d, 0x00, 0xf2,
|
||||
0x1c, 0x6a, 0x5c, 0x68, 0x15, 0x56, 0x4d, 0x60, 0xaf, 0x90, 0x78, 0x65, 0xbf, 0x57, 0x22, 0x8f,
|
||||
0x52, 0xd4, 0x90, 0xa2, 0x0f, 0xd0, 0xce, 0xf5, 0x9d, 0x27, 0x89, 0x44, 0xa5, 0xc8, 0x0b, 0x68,
|
||||
0x69, 0x19, 0x33, 0x25, 0xb8, 0xd4, 0x46, 0x5d, 0x30, 0xea, 0x96, 0xde, 0x78, 0xbd, 0x46, 0xe9,
|
||||
0x86, 0x48, 0x42, 0x68, 0xc6, 0x36, 0x81, 0x51, 0xdb, 0xa2, 0xeb, 0x63, 0xf4, 0xdb, 0x83, 0xa0,
|
||||
0x5c, 0x97, 0x9c, 0x02, 0x2c, 0xe3, 0xef, 0xe3, 0x58, 0x23, 0x9b, 0xad, 0xdc, 0x1c, 0xee, 0x78,
|
||||
0xdd, 0x16, 0x99, 0x9c, 0x80, 0xbf, 0x4c, 0x19, 0x45, 0x91, 0x69, 0x03, 0xba, 0xde, 0x74, 0xca,
|
||||
0x53, 0x40, 0x41, 0xcb, 0x34, 0x12, 0xc1, 0xc1, 0x32, 0x65, 0x13, 0x81, 0x98, 0xbc, 0x9e, 0x0a,
|
||||
0xdb, 0x99, 0x2a, 0x2d, 0xdd, 0x91, 0x43, 0xa8, 0x2f, 0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x38, 0x87, 0xad, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
@ -3,7 +3,9 @@
|
||||
|
||||
syntax = "proto3";
|
||||
|
||||
import "google/protobuf/duration.proto";
|
||||
import "duration.proto";
|
||||
|
||||
package overlay;
|
||||
|
||||
// NodeTransport is an enum of possible transports for the overlay network
|
||||
enum NodeTransport {
|
||||
@ -18,6 +20,10 @@ service Overlay {
|
||||
rpc FindStorageNodes(FindStorageNodesRequest) returns (FindStorageNodesResponse);
|
||||
}
|
||||
|
||||
service Nodes {
|
||||
rpc Query(QueryRequest) returns (QueryResponse);
|
||||
}
|
||||
|
||||
// LookupRequest is is request message for the lookup rpc call
|
||||
message LookupRequest {
|
||||
string nodeID = 1;
|
||||
@ -62,3 +68,13 @@ message Node {
|
||||
string id = 1;
|
||||
NodeAddress address = 2;
|
||||
}
|
||||
|
||||
message QueryRequest {
|
||||
overlay.Node sender = 1;
|
||||
overlay.Node receiver = 2;
|
||||
}
|
||||
|
||||
message QueryResponse {
|
||||
overlay.Node sender = 1;
|
||||
repeated overlay.Node response = 2;
|
||||
}
|
Loading…
Reference in New Issue
Block a user