implements node pkg query method (#251)
This commit is contained in:
parent
0e2fd97029
commit
154a1eab3a
265
pkg/dht/mocks/mock_dht.go
Normal file
265
pkg/dht/mocks/mock_dht.go
Normal file
@ -0,0 +1,265 @@
|
||||
// Code generated by MockGen. DO NOT EDIT.
|
||||
// Source: storj.io/storj/pkg/dht (interfaces: DHT,RoutingTable)
|
||||
|
||||
// Package mock_dht is a generated GoMock package.
|
||||
package mock_dht
|
||||
|
||||
import (
|
||||
context "context"
|
||||
gomock "github.com/golang/mock/gomock"
|
||||
reflect "reflect"
|
||||
dht "storj.io/storj/pkg/dht"
|
||||
overlay "storj.io/storj/protos/overlay"
|
||||
time "time"
|
||||
)
|
||||
|
||||
// MockDHT is a mock of DHT interface
|
||||
type MockDHT struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockDHTMockRecorder
|
||||
}
|
||||
|
||||
// MockDHTMockRecorder is the mock recorder for MockDHT
|
||||
type MockDHTMockRecorder struct {
|
||||
mock *MockDHT
|
||||
}
|
||||
|
||||
// NewMockDHT creates a new mock instance
|
||||
func NewMockDHT(ctrl *gomock.Controller) *MockDHT {
|
||||
mock := &MockDHT{ctrl: ctrl}
|
||||
mock.recorder = &MockDHTMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use
|
||||
func (m *MockDHT) EXPECT() *MockDHTMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// Bootstrap mocks base method
|
||||
func (m *MockDHT) Bootstrap(arg0 context.Context) error {
|
||||
ret := m.ctrl.Call(m, "Bootstrap", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Bootstrap indicates an expected call of Bootstrap
|
||||
func (mr *MockDHTMockRecorder) Bootstrap(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Bootstrap", reflect.TypeOf((*MockDHT)(nil).Bootstrap), arg0)
|
||||
}
|
||||
|
||||
// Disconnect mocks base method
|
||||
func (m *MockDHT) Disconnect() error {
|
||||
ret := m.ctrl.Call(m, "Disconnect")
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Disconnect indicates an expected call of Disconnect
|
||||
func (mr *MockDHTMockRecorder) Disconnect() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Disconnect", reflect.TypeOf((*MockDHT)(nil).Disconnect))
|
||||
}
|
||||
|
||||
// FindNode mocks base method
|
||||
func (m *MockDHT) FindNode(arg0 context.Context, arg1 dht.NodeID) (overlay.Node, error) {
|
||||
ret := m.ctrl.Call(m, "FindNode", arg0, arg1)
|
||||
ret0, _ := ret[0].(overlay.Node)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// FindNode indicates an expected call of FindNode
|
||||
func (mr *MockDHTMockRecorder) FindNode(arg0, arg1 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindNode", reflect.TypeOf((*MockDHT)(nil).FindNode), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetNodes mocks base method
|
||||
func (m *MockDHT) GetNodes(arg0 context.Context, arg1 string, arg2 int, arg3 ...overlay.Restriction) ([]*overlay.Node, error) {
|
||||
varargs := []interface{}{arg0, arg1, arg2}
|
||||
for _, a := range arg3 {
|
||||
varargs = append(varargs, a)
|
||||
}
|
||||
ret := m.ctrl.Call(m, "GetNodes", varargs...)
|
||||
ret0, _ := ret[0].([]*overlay.Node)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetNodes indicates an expected call of GetNodes
|
||||
func (mr *MockDHTMockRecorder) GetNodes(arg0, arg1, arg2 interface{}, arg3 ...interface{}) *gomock.Call {
|
||||
varargs := append([]interface{}{arg0, arg1, arg2}, arg3...)
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetNodes", reflect.TypeOf((*MockDHT)(nil).GetNodes), varargs...)
|
||||
}
|
||||
|
||||
// GetRoutingTable mocks base method
|
||||
func (m *MockDHT) GetRoutingTable(arg0 context.Context) (dht.RoutingTable, error) {
|
||||
ret := m.ctrl.Call(m, "GetRoutingTable", arg0)
|
||||
ret0, _ := ret[0].(dht.RoutingTable)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetRoutingTable indicates an expected call of GetRoutingTable
|
||||
func (mr *MockDHTMockRecorder) GetRoutingTable(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetRoutingTable", reflect.TypeOf((*MockDHT)(nil).GetRoutingTable), arg0)
|
||||
}
|
||||
|
||||
// Ping mocks base method
|
||||
func (m *MockDHT) Ping(arg0 context.Context, arg1 overlay.Node) (overlay.Node, error) {
|
||||
ret := m.ctrl.Call(m, "Ping", arg0, arg1)
|
||||
ret0, _ := ret[0].(overlay.Node)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// Ping indicates an expected call of Ping
|
||||
func (mr *MockDHTMockRecorder) Ping(arg0, arg1 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ping", reflect.TypeOf((*MockDHT)(nil).Ping), arg0, arg1)
|
||||
}
|
||||
|
||||
// MockRoutingTable is a mock of RoutingTable interface
|
||||
type MockRoutingTable struct {
|
||||
ctrl *gomock.Controller
|
||||
recorder *MockRoutingTableMockRecorder
|
||||
}
|
||||
|
||||
// MockRoutingTableMockRecorder is the mock recorder for MockRoutingTable
|
||||
type MockRoutingTableMockRecorder struct {
|
||||
mock *MockRoutingTable
|
||||
}
|
||||
|
||||
// NewMockRoutingTable creates a new mock instance
|
||||
func NewMockRoutingTable(ctrl *gomock.Controller) *MockRoutingTable {
|
||||
mock := &MockRoutingTable{ctrl: ctrl}
|
||||
mock.recorder = &MockRoutingTableMockRecorder{mock}
|
||||
return mock
|
||||
}
|
||||
|
||||
// EXPECT returns an object that allows the caller to indicate expected use
|
||||
func (m *MockRoutingTable) EXPECT() *MockRoutingTableMockRecorder {
|
||||
return m.recorder
|
||||
}
|
||||
|
||||
// CacheSize mocks base method
|
||||
func (m *MockRoutingTable) CacheSize() int {
|
||||
ret := m.ctrl.Call(m, "CacheSize")
|
||||
ret0, _ := ret[0].(int)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// CacheSize indicates an expected call of CacheSize
|
||||
func (mr *MockRoutingTableMockRecorder) CacheSize() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CacheSize", reflect.TypeOf((*MockRoutingTable)(nil).CacheSize))
|
||||
}
|
||||
|
||||
// ConnectionFailed mocks base method
|
||||
func (m *MockRoutingTable) ConnectionFailed(arg0 *overlay.Node) error {
|
||||
ret := m.ctrl.Call(m, "ConnectionFailed", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConnectionFailed indicates an expected call of ConnectionFailed
|
||||
func (mr *MockRoutingTableMockRecorder) ConnectionFailed(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionFailed", reflect.TypeOf((*MockRoutingTable)(nil).ConnectionFailed), arg0)
|
||||
}
|
||||
|
||||
// ConnectionSuccess mocks base method
|
||||
func (m *MockRoutingTable) ConnectionSuccess(arg0 *overlay.Node) error {
|
||||
ret := m.ctrl.Call(m, "ConnectionSuccess", arg0)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// ConnectionSuccess indicates an expected call of ConnectionSuccess
|
||||
func (mr *MockRoutingTableMockRecorder) ConnectionSuccess(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ConnectionSuccess", reflect.TypeOf((*MockRoutingTable)(nil).ConnectionSuccess), arg0)
|
||||
}
|
||||
|
||||
// FindNear mocks base method
|
||||
func (m *MockRoutingTable) FindNear(arg0 dht.NodeID, arg1 int) ([]*overlay.Node, error) {
|
||||
ret := m.ctrl.Call(m, "FindNear", arg0, arg1)
|
||||
ret0, _ := ret[0].([]*overlay.Node)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// FindNear indicates an expected call of FindNear
|
||||
func (mr *MockRoutingTableMockRecorder) FindNear(arg0, arg1 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "FindNear", reflect.TypeOf((*MockRoutingTable)(nil).FindNear), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetBucket mocks base method
|
||||
func (m *MockRoutingTable) GetBucket(arg0 string) (dht.Bucket, bool) {
|
||||
ret := m.ctrl.Call(m, "GetBucket", arg0)
|
||||
ret0, _ := ret[0].(dht.Bucket)
|
||||
ret1, _ := ret[1].(bool)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBucket indicates an expected call of GetBucket
|
||||
func (mr *MockRoutingTableMockRecorder) GetBucket(arg0 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBucket", reflect.TypeOf((*MockRoutingTable)(nil).GetBucket), arg0)
|
||||
}
|
||||
|
||||
// GetBucketTimestamp mocks base method
|
||||
func (m *MockRoutingTable) GetBucketTimestamp(arg0 string, arg1 dht.Bucket) (time.Time, error) {
|
||||
ret := m.ctrl.Call(m, "GetBucketTimestamp", arg0, arg1)
|
||||
ret0, _ := ret[0].(time.Time)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBucketTimestamp indicates an expected call of GetBucketTimestamp
|
||||
func (mr *MockRoutingTableMockRecorder) GetBucketTimestamp(arg0, arg1 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBucketTimestamp", reflect.TypeOf((*MockRoutingTable)(nil).GetBucketTimestamp), arg0, arg1)
|
||||
}
|
||||
|
||||
// GetBuckets mocks base method
|
||||
func (m *MockRoutingTable) GetBuckets() ([]dht.Bucket, error) {
|
||||
ret := m.ctrl.Call(m, "GetBuckets")
|
||||
ret0, _ := ret[0].([]dht.Bucket)
|
||||
ret1, _ := ret[1].(error)
|
||||
return ret0, ret1
|
||||
}
|
||||
|
||||
// GetBuckets indicates an expected call of GetBuckets
|
||||
func (mr *MockRoutingTableMockRecorder) GetBuckets() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBuckets", reflect.TypeOf((*MockRoutingTable)(nil).GetBuckets))
|
||||
}
|
||||
|
||||
// K mocks base method
|
||||
func (m *MockRoutingTable) K() int {
|
||||
ret := m.ctrl.Call(m, "K")
|
||||
ret0, _ := ret[0].(int)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// K indicates an expected call of K
|
||||
func (mr *MockRoutingTableMockRecorder) K() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "K", reflect.TypeOf((*MockRoutingTable)(nil).K))
|
||||
}
|
||||
|
||||
// Local mocks base method
|
||||
func (m *MockRoutingTable) Local() overlay.Node {
|
||||
ret := m.ctrl.Call(m, "Local")
|
||||
ret0, _ := ret[0].(overlay.Node)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// Local indicates an expected call of Local
|
||||
func (mr *MockRoutingTableMockRecorder) Local() *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Local", reflect.TypeOf((*MockRoutingTable)(nil).Local))
|
||||
}
|
||||
|
||||
// SetBucketTimestamp mocks base method
|
||||
func (m *MockRoutingTable) SetBucketTimestamp(arg0 string, arg1 time.Time) error {
|
||||
ret := m.ctrl.Call(m, "SetBucketTimestamp", arg0, arg1)
|
||||
ret0, _ := ret[0].(error)
|
||||
return ret0
|
||||
}
|
||||
|
||||
// SetBucketTimestamp indicates an expected call of SetBucketTimestamp
|
||||
func (mr *MockRoutingTableMockRecorder) SetBucketTimestamp(arg0, arg1 interface{}) *gomock.Call {
|
||||
return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetBucketTimestamp", reflect.TypeOf((*MockRoutingTable)(nil).SetBucketTimestamp), arg0, arg1)
|
||||
}
|
@ -126,20 +126,31 @@ func (rt *RoutingTable) GetBuckets() (k []dht.Bucket, err error) {
|
||||
return bs, nil
|
||||
}
|
||||
|
||||
// FindNear finds all Nodes near the provided nodeID up to the provided limit
|
||||
// FindNear returns the node corresponding to the provided nodeID if present in the routing table
|
||||
// otherwise returns all Nodes closest via XOR to the provided nodeID up to the provided limit
|
||||
func (rt *RoutingTable) FindNear(id dht.NodeID, limit int) ([]*proto.Node, error) {
|
||||
//if id is in the routing table
|
||||
n, err := rt.nodeBucketDB.Get(id.Bytes())
|
||||
if n != nil {
|
||||
ns, err := unmarshalNodes(storage.Keys{id.Bytes()}, []storage.Value{n})
|
||||
if err != nil {
|
||||
return []*proto.Node{}, RoutingErr.New("could not unmarshal node %s", err)
|
||||
}
|
||||
return ns, nil
|
||||
}
|
||||
if err != nil && !storage.ErrKeyNotFound.Has(err) {
|
||||
return []*proto.Node{}, RoutingErr.New("could not get key from rt %s", err)
|
||||
}
|
||||
// if id is not in the routing table
|
||||
nodeIDs, err := rt.nodeBucketDB.List(nil, 0)
|
||||
if err != nil {
|
||||
return []*proto.Node{}, RoutingErr.New("could not get node ids %s", err)
|
||||
}
|
||||
sortedIDs := sortByXOR(nodeIDs, id.Bytes())
|
||||
var nearIDs storage.Keys
|
||||
if len(sortedIDs) < limit+1 {
|
||||
nearIDs = sortedIDs[1:]
|
||||
} else {
|
||||
nearIDs = sortedIDs[1 : limit+1]
|
||||
if len(sortedIDs) >= limit {
|
||||
sortedIDs = sortedIDs[:limit]
|
||||
}
|
||||
ids, serializedNodes, err := rt.getNodesFromIDs(nearIDs)
|
||||
ids, serializedNodes, err := rt.getNodesFromIDs(sortedIDs)
|
||||
if err != nil {
|
||||
return []*proto.Node{}, RoutingErr.New("could not get nodes %s", err)
|
||||
}
|
||||
|
@ -4,7 +4,6 @@
|
||||
package kademlia
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"testing"
|
||||
@ -328,7 +327,6 @@ func TestSortByXOR(t *testing.T) {
|
||||
node5 := []byte{133, 255} //xor 250
|
||||
rt.nodeBucketDB.Put(node5, []byte(""))
|
||||
nodes, err := rt.nodeBucketDB.List(nil, 0)
|
||||
fmt.Print(nodes)
|
||||
assert.NoError(t, err)
|
||||
expectedNodes := storage.Keys{node1, node5, node2, node4, node3}
|
||||
assert.Equal(t, expectedNodes, nodes)
|
||||
@ -547,8 +545,6 @@ func TestGetUnmarshaledNodesFromBucket(t *testing.T) {
|
||||
rt.addNode(nodeC)
|
||||
nodes, err := rt.getUnmarshaledNodesFromBucket(bucketID)
|
||||
expected := []*proto.Node{nodeA, nodeB, nodeC}
|
||||
fmt.Print(expected)
|
||||
fmt.Print(nodes)
|
||||
assert.NoError(t, err)
|
||||
for i, v := range expected {
|
||||
assert.True(t, pb.Equal(v, nodes[i]))
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
|
||||
pb "github.com/golang/protobuf/proto"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"storj.io/storj/storage"
|
||||
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
"storj.io/storj/storage"
|
||||
)
|
||||
|
||||
func TestLocal(t *testing.T) {
|
||||
@ -60,10 +60,13 @@ func TestGetBucket(t *testing.T) {
|
||||
for i, v := range cases {
|
||||
b, e := rt.GetBucket(node2.Id)
|
||||
for j, w := range v.expected.nodes {
|
||||
assert.True(t, pb.Equal(w, b.Nodes()[j]))
|
||||
if !assert.True(t, pb.Equal(w, b.Nodes()[j])) {
|
||||
fmt.Printf("case %v failed expected: ", i)
|
||||
}
|
||||
}
|
||||
if !assert.Equal(t, v.ok, e) {
|
||||
fmt.Printf("case %v failed ok: ", i)
|
||||
}
|
||||
assert.Equal(t, v.ok, e)
|
||||
fmt.Printf("error occured at index %d", i) //what's a better way to print the index?
|
||||
}
|
||||
}
|
||||
|
||||
@ -91,12 +94,27 @@ func TestFindNear(t *testing.T) {
|
||||
ok, err := rt.addNode(node2)
|
||||
assert.True(t, ok)
|
||||
assert.NoError(t, err)
|
||||
expected := []*proto.Node{node2}
|
||||
expected := []*proto.Node{node}
|
||||
nodes, err := rt.FindNear(StringToNodeID(node.Id), 1)
|
||||
assert.NoError(t, err)
|
||||
for i, v := range nodes {
|
||||
assert.True(t, pb.Equal(expected[i], v))
|
||||
}
|
||||
assert.Equal(t, expected, nodes)
|
||||
|
||||
node3 := mockNode("CC")
|
||||
expected = []*proto.Node{node2, node}
|
||||
nodes, err = rt.FindNear(StringToNodeID(node3.Id), 2)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, nodes)
|
||||
|
||||
expected = []*proto.Node{node2}
|
||||
nodes, err = rt.FindNear(StringToNodeID(node3.Id), 1)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, nodes)
|
||||
|
||||
expected = []*proto.Node{node2, node}
|
||||
nodes, err = rt.FindNear(StringToNodeID(node3.Id), 3)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, expected, nodes)
|
||||
|
||||
}
|
||||
|
||||
func TestConnectionSuccess(t *testing.T) {
|
||||
@ -107,7 +125,7 @@ func TestConnectionSuccess(t *testing.T) {
|
||||
address2 := &proto.NodeAddress{Address: "b"}
|
||||
node1 := &proto.Node{Id: id, Address: address1}
|
||||
node2 := &proto.Node{Id: id2, Address: address2}
|
||||
|
||||
|
||||
//Updates node
|
||||
err := rt.ConnectionSuccess(node1)
|
||||
assert.NoError(t, err)
|
||||
|
@ -6,12 +6,16 @@ package node
|
||||
import (
|
||||
"context"
|
||||
|
||||
"storj.io/storj/pkg/pool"
|
||||
"github.com/zeebo/errs"
|
||||
|
||||
"storj.io/storj/pkg/pool"
|
||||
"storj.io/storj/pkg/transport"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
//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(self proto.Node) (Client, error) {
|
||||
return &Node{
|
||||
|
@ -18,7 +18,7 @@ type Node struct {
|
||||
tc transport.Client
|
||||
cache pool.Pool
|
||||
}
|
||||
//TODO: change lookup to findnear
|
||||
|
||||
// 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())
|
||||
@ -38,7 +38,7 @@ func (n *Node) Lookup(ctx context.Context, to proto.Node, find proto.Node) ([]*p
|
||||
}
|
||||
|
||||
c := proto.NewNodesClient(conn)
|
||||
resp, err := c.Query(ctx, &proto.QueryRequest{Sender: &n.self, Receiver: &find})
|
||||
resp, err := c.Query(ctx, &proto.QueryRequest{Sender: &n.self, Target: &find})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -7,21 +7,37 @@ import (
|
||||
"context"
|
||||
|
||||
"storj.io/storj/pkg/dht"
|
||||
|
||||
"storj.io/storj/pkg/kademlia"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
// Server implements the grpc Node Server
|
||||
type Server struct {
|
||||
rt dht.RoutingTable
|
||||
dht dht.DHT
|
||||
}
|
||||
|
||||
//TODO: add limit to query request proto
|
||||
// Query is a node to node communication query
|
||||
func (s *Server) Query(ctx context.Context, req proto.QueryRequest) (proto.QueryResponse, error) {
|
||||
// TODO: ping sender
|
||||
// Add sender to rt
|
||||
// look for receiver in routing table
|
||||
// return receiver or find nearest to receiver
|
||||
return proto.QueryResponse{}, nil
|
||||
rt, err := s.dht.GetRoutingTable(ctx)
|
||||
if err != nil {
|
||||
return proto.QueryResponse{}, NodeClientErr.New("could not get routing table %s", err)
|
||||
}
|
||||
_, err = s.dht.Ping(ctx, *req.Sender)
|
||||
if err != nil {
|
||||
err = rt.ConnectionFailed(req.Sender)
|
||||
if err != nil {
|
||||
return proto.QueryResponse{}, NodeClientErr.New("could not respond to connection failed %s", err)
|
||||
}
|
||||
return proto.QueryResponse{}, NodeClientErr.New("connection to node %s failed", req.Sender.Id)
|
||||
}
|
||||
err = rt.ConnectionSuccess(req.Sender)
|
||||
if err != nil {
|
||||
return proto.QueryResponse{}, NodeClientErr.New("could not respond to connection success %s", err)
|
||||
}
|
||||
id := kademlia.StringToNodeID(req.Target.Id)
|
||||
nodes, err := rt.FindNear(id, int(req.Limit))
|
||||
if err != nil {
|
||||
return proto.QueryResponse{}, NodeClientErr.New("could not find near %s", err)
|
||||
}
|
||||
return proto.QueryResponse{Sender: req.Sender, Response: nodes}, nil
|
||||
}
|
||||
|
129
pkg/node/server_test.go
Normal file
129
pkg/node/server_test.go
Normal file
@ -0,0 +1,129 @@
|
||||
// Copyright (C) 2018 Storj Labs, Inc.
|
||||
// See LICENSE for copying information.
|
||||
|
||||
package node
|
||||
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/golang/mock/gomock"
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"storj.io/storj/pkg/dht"
|
||||
"storj.io/storj/pkg/dht/mocks"
|
||||
proto "storj.io/storj/protos/overlay"
|
||||
)
|
||||
|
||||
func TestQuery(t *testing.T) {
|
||||
ctrl := gomock.NewController(t)
|
||||
defer ctrl.Finish()
|
||||
mockDHT := mock_dht.NewMockDHT(ctrl)
|
||||
mockRT := mock_dht.NewMockRoutingTable(ctrl)
|
||||
s := &Server{dht: mockDHT}
|
||||
sender := &proto.Node{Id: "A"}
|
||||
target := &proto.Node{Id: "B"}
|
||||
node := &proto.Node{Id: "C"}
|
||||
cases := []struct {
|
||||
caseName string
|
||||
rt dht.RoutingTable
|
||||
getRTErr error
|
||||
pingNode proto.Node
|
||||
pingErr error
|
||||
successErr error
|
||||
failErr error
|
||||
findNear []*proto.Node
|
||||
limit int
|
||||
nearErr error
|
||||
res proto.QueryResponse
|
||||
err error
|
||||
}{
|
||||
{caseName: "ping success, return sender",
|
||||
rt: mockRT,
|
||||
getRTErr: nil,
|
||||
pingNode: *sender,
|
||||
pingErr: nil,
|
||||
successErr: nil,
|
||||
failErr: nil,
|
||||
findNear: []*proto.Node{target},
|
||||
limit: 2,
|
||||
nearErr: nil,
|
||||
res: proto.QueryResponse{Sender: sender, Response: []*proto.Node{target}},
|
||||
err: nil,
|
||||
},
|
||||
{caseName: "ping success, return nearest",
|
||||
rt: mockRT,
|
||||
getRTErr: nil,
|
||||
pingNode: *sender,
|
||||
pingErr: nil,
|
||||
successErr: nil,
|
||||
failErr: nil,
|
||||
findNear: []*proto.Node{sender, node},
|
||||
limit: 2,
|
||||
nearErr: nil,
|
||||
res: proto.QueryResponse{Sender: sender, Response: []*proto.Node{sender, node}},
|
||||
err: nil,
|
||||
},
|
||||
{caseName: "ping success, connectionSuccess errors",
|
||||
rt: mockRT,
|
||||
getRTErr: nil,
|
||||
pingNode: *sender,
|
||||
pingErr: nil,
|
||||
successErr: errors.New("connection fails error"),
|
||||
failErr: nil,
|
||||
findNear: []*proto.Node{},
|
||||
limit: 2,
|
||||
nearErr: nil,
|
||||
res: proto.QueryResponse{},
|
||||
err: errors.New("query error"),
|
||||
},
|
||||
{caseName: "ping fails, return error",
|
||||
rt: mockRT,
|
||||
getRTErr: nil,
|
||||
pingNode: proto.Node{},
|
||||
pingErr: errors.New("ping err"),
|
||||
successErr: nil,
|
||||
failErr: nil,
|
||||
findNear: []*proto.Node{},
|
||||
limit: 2,
|
||||
nearErr: nil,
|
||||
res: proto.QueryResponse{},
|
||||
err: errors.New("query error"),
|
||||
},
|
||||
{caseName: "ping fails, connectionFailed errors",
|
||||
rt: mockRT,
|
||||
getRTErr: nil,
|
||||
pingNode: proto.Node{},
|
||||
pingErr: errors.New("ping err"),
|
||||
successErr: nil,
|
||||
failErr: errors.New("connection fails error"),
|
||||
findNear: []*proto.Node{},
|
||||
limit: 2,
|
||||
nearErr: nil,
|
||||
res: proto.QueryResponse{},
|
||||
err: errors.New("query error"),
|
||||
},
|
||||
}
|
||||
for i, v := range cases {
|
||||
req := proto.QueryRequest{Sender: sender, Target: &proto.Node{Id: "B"}, Limit: int64(2)}
|
||||
mockDHT.EXPECT().GetRoutingTable(gomock.Any()).Return(v.rt, v.getRTErr)
|
||||
mockDHT.EXPECT().Ping(gomock.Any(), gomock.Any()).Return(v.pingNode, v.pingErr)
|
||||
if v.pingErr != nil {
|
||||
mockRT.EXPECT().ConnectionFailed(gomock.Any()).Return(v.failErr)
|
||||
} else {
|
||||
mockRT.EXPECT().ConnectionSuccess(gomock.Any()).Return(v.successErr)
|
||||
if v.successErr == nil {
|
||||
mockRT.EXPECT().FindNear(gomock.Any(), v.limit).Return(v.findNear, v.nearErr)
|
||||
}
|
||||
}
|
||||
res, err := s.Query(context.Background(), req)
|
||||
if !assert.Equal(t, v.res, res) {
|
||||
fmt.Printf("case %s (%v) failed\n", v.caseName, i)
|
||||
}
|
||||
if v.err == nil && !assert.NoError(t, err) {
|
||||
fmt.Printf("query errored at case %v\n", i)
|
||||
}
|
||||
}
|
||||
}
|
@ -70,7 +70,6 @@ func (o *Server) FindStorageNodes(ctx context.Context, req *proto.FindStorageNod
|
||||
}
|
||||
|
||||
if len(result) < int(maxNodes) {
|
||||
fmt.Printf("result %v", result)
|
||||
return nil, status.Errorf(codes.ResourceExhausted, fmt.Sprintf("requested %d nodes, only %d nodes matched the criteria requested", maxNodes, len(result)))
|
||||
}
|
||||
|
||||
@ -106,7 +105,6 @@ func (o *Server) getNodes(ctx context.Context, keys storage.Keys) ([]*proto.Node
|
||||
func (o *Server) populate(ctx context.Context, starting storage.Key, maxNodes, restrictedBandwidth, restrictedSpace int64) ([]*proto.Node, storage.Key, error) {
|
||||
limit := storage.Limit(maxNodes) * 2
|
||||
keys, err := o.cache.DB.List(starting, limit)
|
||||
fmt.Printf("keys from populate %v\n", keys)
|
||||
if err != nil {
|
||||
o.logger.Error("Error listing nodes", zap.Error(err))
|
||||
return nil, nil, Error.Wrap(err)
|
||||
@ -119,7 +117,6 @@ func (o *Server) populate(ctx context.Context, starting storage.Key, maxNodes, r
|
||||
|
||||
result := []*proto.Node{}
|
||||
nodes, err := o.getNodes(ctx, keys)
|
||||
fmt.Printf("nodes from populate %v\n", len(nodes))
|
||||
if err != nil {
|
||||
o.logger.Error("Error getting nodes", zap.Error(err))
|
||||
return nil, nil, Error.Wrap(err)
|
||||
|
@ -42,7 +42,7 @@ func (x NodeTransport) String() string {
|
||||
return proto.EnumName(NodeTransport_name, int32(x))
|
||||
}
|
||||
func (NodeTransport) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{0}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{0}
|
||||
}
|
||||
|
||||
// NodeType is an enum of possible node types
|
||||
@ -66,7 +66,7 @@ func (x NodeType) String() string {
|
||||
return proto.EnumName(NodeType_name, int32(x))
|
||||
}
|
||||
func (NodeType) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{1}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{1}
|
||||
}
|
||||
|
||||
type Restriction_Operator int32
|
||||
@ -98,7 +98,7 @@ func (x Restriction_Operator) String() string {
|
||||
return proto.EnumName(Restriction_Operator_name, int32(x))
|
||||
}
|
||||
func (Restriction_Operator) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{11, 0}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{11, 0}
|
||||
}
|
||||
|
||||
type Restriction_Operand int32
|
||||
@ -121,7 +121,7 @@ func (x Restriction_Operand) String() string {
|
||||
return proto.EnumName(Restriction_Operand_name, int32(x))
|
||||
}
|
||||
func (Restriction_Operand) EnumDescriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{11, 1}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{11, 1}
|
||||
}
|
||||
|
||||
// LookupRequest is is request message for the lookup rpc call
|
||||
@ -136,7 +136,7 @@ func (m *LookupRequest) Reset() { *m = LookupRequest{} }
|
||||
func (m *LookupRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*LookupRequest) ProtoMessage() {}
|
||||
func (*LookupRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{0}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{0}
|
||||
}
|
||||
func (m *LookupRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LookupRequest.Unmarshal(m, b)
|
||||
@ -175,7 +175,7 @@ func (m *LookupResponse) Reset() { *m = LookupResponse{} }
|
||||
func (m *LookupResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*LookupResponse) ProtoMessage() {}
|
||||
func (*LookupResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{1}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{1}
|
||||
}
|
||||
func (m *LookupResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_LookupResponse.Unmarshal(m, b)
|
||||
@ -214,7 +214,7 @@ func (m *FindStorageNodesResponse) Reset() { *m = FindStorageNodesRespon
|
||||
func (m *FindStorageNodesResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindStorageNodesResponse) ProtoMessage() {}
|
||||
func (*FindStorageNodesResponse) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{2}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{2}
|
||||
}
|
||||
func (m *FindStorageNodesResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FindStorageNodesResponse.Unmarshal(m, b)
|
||||
@ -255,7 +255,7 @@ func (m *FindStorageNodesRequest) Reset() { *m = FindStorageNodesRequest
|
||||
func (m *FindStorageNodesRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*FindStorageNodesRequest) ProtoMessage() {}
|
||||
func (*FindStorageNodesRequest) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{3}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{3}
|
||||
}
|
||||
func (m *FindStorageNodesRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_FindStorageNodesRequest.Unmarshal(m, b)
|
||||
@ -309,7 +309,7 @@ func (m *NodeAddress) Reset() { *m = NodeAddress{} }
|
||||
func (m *NodeAddress) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeAddress) ProtoMessage() {}
|
||||
func (*NodeAddress) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{4}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{4}
|
||||
}
|
||||
func (m *NodeAddress) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NodeAddress.Unmarshal(m, b)
|
||||
@ -359,7 +359,7 @@ func (m *OverlayOptions) Reset() { *m = OverlayOptions{} }
|
||||
func (m *OverlayOptions) String() string { return proto.CompactTextString(m) }
|
||||
func (*OverlayOptions) ProtoMessage() {}
|
||||
func (*OverlayOptions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{5}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{5}
|
||||
}
|
||||
func (m *OverlayOptions) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_OverlayOptions.Unmarshal(m, b)
|
||||
@ -425,7 +425,7 @@ func (m *NodeRep) Reset() { *m = NodeRep{} }
|
||||
func (m *NodeRep) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeRep) ProtoMessage() {}
|
||||
func (*NodeRep) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{6}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{6}
|
||||
}
|
||||
func (m *NodeRep) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NodeRep.Unmarshal(m, b)
|
||||
@ -458,7 +458,7 @@ func (m *NodeRestrictions) Reset() { *m = NodeRestrictions{} }
|
||||
func (m *NodeRestrictions) String() string { return proto.CompactTextString(m) }
|
||||
func (*NodeRestrictions) ProtoMessage() {}
|
||||
func (*NodeRestrictions) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{7}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{7}
|
||||
}
|
||||
func (m *NodeRestrictions) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_NodeRestrictions.Unmarshal(m, b)
|
||||
@ -507,7 +507,7 @@ func (m *Node) Reset() { *m = Node{} }
|
||||
func (m *Node) String() string { return proto.CompactTextString(m) }
|
||||
func (*Node) ProtoMessage() {}
|
||||
func (*Node) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{8}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{8}
|
||||
}
|
||||
func (m *Node) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Node.Unmarshal(m, b)
|
||||
@ -557,7 +557,8 @@ func (m *Node) GetRestrictions() *NodeRestrictions {
|
||||
|
||||
type QueryRequest struct {
|
||||
Sender *Node `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
Receiver *Node `protobuf:"bytes,2,opt,name=receiver,proto3" json:"receiver,omitempty"`
|
||||
Target *Node `protobuf:"bytes,2,opt,name=target,proto3" json:"target,omitempty"`
|
||||
Limit int64 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"`
|
||||
XXX_NoUnkeyedLiteral struct{} `json:"-"`
|
||||
XXX_unrecognized []byte `json:"-"`
|
||||
XXX_sizecache int32 `json:"-"`
|
||||
@ -567,7 +568,7 @@ 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_54bfbe46ae104a6e, []int{9}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{9}
|
||||
}
|
||||
func (m *QueryRequest) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_QueryRequest.Unmarshal(m, b)
|
||||
@ -594,13 +595,20 @@ func (m *QueryRequest) GetSender() *Node {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *QueryRequest) GetReceiver() *Node {
|
||||
func (m *QueryRequest) GetTarget() *Node {
|
||||
if m != nil {
|
||||
return m.Receiver
|
||||
return m.Target
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (m *QueryRequest) GetLimit() int64 {
|
||||
if m != nil {
|
||||
return m.Limit
|
||||
}
|
||||
return 0
|
||||
}
|
||||
|
||||
type QueryResponse struct {
|
||||
Sender *Node `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
|
||||
Response []*Node `protobuf:"bytes,2,rep,name=response,proto3" json:"response,omitempty"`
|
||||
@ -613,7 +621,7 @@ 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_54bfbe46ae104a6e, []int{10}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{10}
|
||||
}
|
||||
func (m *QueryResponse) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_QueryResponse.Unmarshal(m, b)
|
||||
@ -660,7 +668,7 @@ func (m *Restriction) Reset() { *m = Restriction{} }
|
||||
func (m *Restriction) String() string { return proto.CompactTextString(m) }
|
||||
func (*Restriction) ProtoMessage() {}
|
||||
func (*Restriction) Descriptor() ([]byte, []int) {
|
||||
return fileDescriptor_overlay_54bfbe46ae104a6e, []int{11}
|
||||
return fileDescriptor_overlay_1471bb43182d3596, []int{11}
|
||||
}
|
||||
func (m *Restriction) XXX_Unmarshal(b []byte) error {
|
||||
return xxx_messageInfo_Restriction.Unmarshal(m, b)
|
||||
@ -893,56 +901,57 @@ var _Nodes_serviceDesc = grpc.ServiceDesc{
|
||||
Metadata: "overlay.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("overlay.proto", fileDescriptor_overlay_54bfbe46ae104a6e) }
|
||||
func init() { proto.RegisterFile("overlay.proto", fileDescriptor_overlay_1471bb43182d3596) }
|
||||
|
||||
var fileDescriptor_overlay_54bfbe46ae104a6e = []byte{
|
||||
// 768 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xdd, 0x4e, 0xdb, 0x48,
|
||||
0x14, 0x8e, 0xf3, 0xe7, 0xe4, 0xe4, 0x47, 0x66, 0xc4, 0x82, 0x37, 0xda, 0x45, 0xe0, 0x5d, 0xb4,
|
||||
0xbb, 0xac, 0x14, 0xa4, 0x80, 0x90, 0xb8, 0x58, 0xa1, 0xec, 0x26, 0x8b, 0x50, 0x53, 0x52, 0x26,
|
||||
0x96, 0x7a, 0x55, 0xa9, 0x4e, 0x3c, 0x04, 0x17, 0x32, 0xe3, 0x8e, 0xc7, 0xb4, 0xe9, 0xbb, 0xf4,
|
||||
0x01, 0x2a, 0xf5, 0x01, 0x7b, 0x55, 0x55, 0x1e, 0x8f, 0x9d, 0x38, 0x01, 0x24, 0xae, 0xec, 0x39,
|
||||
0xdf, 0x77, 0xce, 0x7c, 0xe7, 0x67, 0x0e, 0x34, 0xd8, 0x3d, 0xe1, 0x77, 0xce, 0xbc, 0xed, 0x73,
|
||||
0x26, 0x18, 0xd2, 0xd5, 0xb1, 0xb5, 0x33, 0x65, 0x6c, 0x7a, 0x47, 0x0e, 0xa5, 0x79, 0x1c, 0x5e,
|
||||
0x1f, 0xba, 0x21, 0x77, 0x84, 0xc7, 0x68, 0x4c, 0xb4, 0xfe, 0x80, 0xc6, 0x80, 0xb1, 0xdb, 0xd0,
|
||||
0xc7, 0xe4, 0x7d, 0x48, 0x02, 0x81, 0xb6, 0xa0, 0x4c, 0x99, 0x4b, 0x2e, 0x7a, 0xa6, 0xb6, 0xab,
|
||||
0xfd, 0x59, 0xc5, 0xea, 0x64, 0x1d, 0x41, 0x33, 0x21, 0x06, 0x3e, 0xa3, 0x01, 0x41, 0x7b, 0x50,
|
||||
0x8c, 0x30, 0xc9, 0xab, 0x75, 0x1a, 0xed, 0x44, 0xc1, 0x25, 0x73, 0x09, 0x96, 0x90, 0x75, 0x06,
|
||||
0xe6, 0xff, 0x1e, 0x75, 0x47, 0x82, 0x71, 0x67, 0x4a, 0x22, 0x20, 0x48, 0xdd, 0x7f, 0x83, 0x52,
|
||||
0xc4, 0x09, 0x4c, 0x6d, 0xb7, 0xb0, 0xee, 0x1f, 0x63, 0xd6, 0x17, 0x0d, 0xb6, 0xd7, 0x23, 0xc4,
|
||||
0x4a, 0x77, 0x00, 0xd8, 0xf8, 0x1d, 0x99, 0x88, 0x91, 0xf7, 0x29, 0x56, 0x51, 0xc0, 0x4b, 0x16,
|
||||
0xd4, 0x85, 0xe6, 0x84, 0x51, 0xc1, 0x9d, 0x89, 0x18, 0x10, 0x3a, 0x15, 0x37, 0x66, 0x5e, 0x2a,
|
||||
0xfd, 0xb9, 0x1d, 0xd7, 0xa4, 0x9d, 0xd4, 0xa4, 0xdd, 0x53, 0x35, 0xc1, 0x2b, 0x0e, 0xe8, 0x6f,
|
||||
0x28, 0x32, 0x5f, 0x04, 0x66, 0x41, 0x3a, 0x6e, 0xa7, 0x12, 0x87, 0xf1, 0x77, 0xe8, 0x47, 0x5e,
|
||||
0x01, 0x96, 0x24, 0xeb, 0x0d, 0xd4, 0x22, 0x7d, 0x5d, 0xd7, 0xe5, 0x24, 0x08, 0xd0, 0x31, 0x54,
|
||||
0x05, 0x77, 0x68, 0xe0, 0x33, 0x2e, 0xa4, 0xba, 0x66, 0x67, 0x2b, 0x93, 0xa3, 0x9d, 0xa0, 0x78,
|
||||
0x41, 0x44, 0x26, 0xe8, 0x4e, 0x1c, 0x40, 0xaa, 0xad, 0xe2, 0xe4, 0x68, 0x7d, 0xd7, 0xa0, 0x99,
|
||||
0xbd, 0x17, 0x9d, 0x02, 0xcc, 0x9c, 0x8f, 0x03, 0x47, 0x10, 0x3a, 0x99, 0xab, 0x3e, 0x3c, 0x91,
|
||||
0xdd, 0x12, 0x19, 0x9d, 0x40, 0x63, 0xe6, 0x51, 0x4c, 0xfc, 0x50, 0x48, 0x50, 0xd5, 0xc6, 0xc8,
|
||||
0x76, 0x81, 0xf8, 0x38, 0x4b, 0x43, 0x16, 0xd4, 0x67, 0x1e, 0x1d, 0xf9, 0x84, 0xb8, 0x2f, 0xc6,
|
||||
0x7e, 0x5c, 0x99, 0x02, 0xce, 0xd8, 0xa2, 0x11, 0x72, 0x66, 0x2c, 0xa4, 0xc2, 0x2c, 0x4a, 0x54,
|
||||
0x9d, 0xd0, 0x3f, 0x50, 0xe7, 0x24, 0x10, 0xdc, 0x9b, 0x48, 0xf9, 0x66, 0x49, 0x09, 0xce, 0x5e,
|
||||
0xb9, 0x20, 0xe0, 0x0c, 0xdd, 0xaa, 0x82, 0xae, 0x44, 0x59, 0x36, 0x18, 0xab, 0x64, 0xf4, 0x3b,
|
||||
0x34, 0xae, 0x39, 0x21, 0xff, 0x3a, 0xd4, 0xfd, 0xe0, 0xb9, 0xe2, 0x46, 0x4d, 0x44, 0xd6, 0x88,
|
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, 0x21,
|
||||
0x3f, 0xb0, 0x8d, 0x5c, 0xf4, 0xed, 0x5f, 0x19, 0x5a, 0xf4, 0x3d, 0xb7, 0x8d, 0x3c, 0xd2, 0xa1,
|
||||
0x30, 0xb0, 0xfb, 0x46, 0x21, 0xfa, 0x39, 0xb7, 0xfb, 0x46, 0xd1, 0x3a, 0x00, 0x5d, 0xc5, 0x47,
|
||||
0x1b, 0x2b, 0xf3, 0x68, 0xe4, 0x50, 0x7d, 0x31, 0x7c, 0x86, 0x76, 0x60, 0x42, 0x23, 0xb3, 0x06,
|
||||
0xa2, 0x28, 0xf6, 0x7f, 0xaf, 0x8c, 0xdc, 0x81, 0x05, 0x95, 0x64, 0x54, 0x50, 0x15, 0x4a, 0xdd,
|
||||
0xde, 0xcb, 0x8b, 0x4b, 0x23, 0x87, 0x6a, 0xa0, 0x8f, 0xec, 0x21, 0xee, 0x9e, 0xf7, 0x0d, 0xad,
|
||||
0xf3, 0x59, 0x03, 0x5d, 0xad, 0x03, 0x74, 0x0a, 0xe5, 0x78, 0x37, 0xa3, 0xc5, 0x86, 0xc9, 0x6c,
|
||||
0xf5, 0xd6, 0xf6, 0x9a, 0x5d, 0x75, 0xf4, 0x35, 0x18, 0xab, 0xfb, 0x15, 0xed, 0xa6, 0xe4, 0x47,
|
||||
0x56, 0x6f, 0x6b, 0xef, 0x09, 0x46, 0x1c, 0xb8, 0x73, 0x06, 0xa5, 0x38, 0xda, 0x09, 0x94, 0xe4,
|
||||
0x10, 0xa1, 0x9f, 0x52, 0xa7, 0xe5, 0xb1, 0x6d, 0x6d, 0xad, 0x9a, 0xe3, 0x00, 0xe3, 0xb2, 0x5c,
|
||||
0x60, 0x47, 0x3f, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdf, 0xb1, 0xda, 0x32, 0xda, 0x06, 0x00, 0x00,
|
||||
var fileDescriptor_overlay_1471bb43182d3596 = []byte{
|
||||
// 771 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x54, 0xcd, 0x6e, 0xd3, 0x40,
|
||||
0x10, 0x8e, 0xf3, 0xe7, 0x64, 0xf2, 0x23, 0x77, 0x55, 0x5a, 0x13, 0x41, 0xd5, 0x1a, 0x2a, 0xa0,
|
||||
0x48, 0xa9, 0x94, 0x56, 0x95, 0x7a, 0x40, 0x55, 0x20, 0xa1, 0xaa, 0x08, 0x0d, 0xdd, 0x58, 0xe2,
|
||||
0xc4, 0xc1, 0x89, 0xb7, 0xa9, 0x69, 0xe2, 0x35, 0xeb, 0x75, 0x21, 0xbc, 0x0b, 0x0f, 0x80, 0xc4,
|
||||
0x03, 0x72, 0x42, 0xc8, 0xeb, 0xb5, 0x13, 0x27, 0x6d, 0x05, 0x27, 0x7b, 0x66, 0xbe, 0x99, 0xfd,
|
||||
0xe6, 0x17, 0x6a, 0xf4, 0x86, 0xb0, 0x89, 0x35, 0x6b, 0x7a, 0x8c, 0x72, 0x8a, 0x54, 0x29, 0x36,
|
||||
0xb6, 0xc6, 0x94, 0x8e, 0x27, 0x64, 0x5f, 0xa8, 0x87, 0xc1, 0xe5, 0xbe, 0x1d, 0x30, 0x8b, 0x3b,
|
||||
0xd4, 0x8d, 0x80, 0xc6, 0x33, 0xa8, 0xf5, 0x28, 0xbd, 0x0e, 0x3c, 0x4c, 0xbe, 0x04, 0xc4, 0xe7,
|
||||
0x68, 0x03, 0x8a, 0x2e, 0xb5, 0xc9, 0x59, 0x47, 0x57, 0xb6, 0x95, 0xe7, 0x65, 0x2c, 0x25, 0xe3,
|
||||
0x00, 0xea, 0x31, 0xd0, 0xf7, 0xa8, 0xeb, 0x13, 0xb4, 0x03, 0xf9, 0xd0, 0x26, 0x70, 0x95, 0x56,
|
||||
0xad, 0x19, 0x33, 0x38, 0xa7, 0x36, 0xc1, 0xc2, 0x64, 0x9c, 0x80, 0xfe, 0xd6, 0x71, 0xed, 0x01,
|
||||
0xa7, 0xcc, 0x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 0x32, 0xa0, 0x3a, 0x75, 0xdc, 0x81, 0x47, 0x88, 0xfd, 0x6e, 0xe8, 0x45, 0x95, 0xc9, 0xe1,
|
||||
0x94, 0x2e, 0x1c, 0x21, 0x6b, 0x4a, 0x03, 0x97, 0xeb, 0x79, 0x61, 0x95, 0x12, 0x7a, 0x05, 0x55,
|
||||
0x46, 0x7c, 0xce, 0x9c, 0x91, 0xa0, 0xaf, 0x17, 0x24, 0xe1, 0xf4, 0x93, 0x73, 0x00, 0x4e, 0xc1,
|
||||
0x8d, 0x32, 0xa8, 0x92, 0x94, 0x61, 0x82, 0xb6, 0x0c, 0x46, 0x4f, 0xa1, 0x76, 0xc9, 0x08, 0x79,
|
||||
0x6d, 0xb9, 0xf6, 0x57, 0xc7, 0xe6, 0x57, 0x72, 0x22, 0xd2, 0x4a, 0xd4, 0x80, 0x52, 0xa8, 0xe8,
|
||||
0x38, 0xfe, 0xb5, 0x48, 0x39, 0x87, 0x13, 0xd9, 0xf8, 0xa5, 0x40, 0x3e, 0x0c, 0x8b, 0xea, 0x90,
|
||||
0x75, 0x6c, 0x39, 0xff, 0x59, 0xc7, 0x46, 0xcd, 0x74, 0x53, 0x2a, 0xad, 0xf5, 0x14, 0x67, 0xd9,
|
||||
0xf1, 0xa4, 0x55, 0x68, 0x17, 0xf2, 0x7c, 0xe6, 0x11, 0x51, 0x9c, 0x7a, 0x6b, 0x2d, 0xdd, 0xf5,
|
||||
0x99, 0x47, 0xb0, 0x30, 0xaf, 0xd4, 0x23, 0xff, 0x7f, 0xf5, 0x60, 0x50, 0xbd, 0x08, 0x08, 0x9b,
|
||||
0xc5, 0xfb, 0xb0, 0x0b, 0x45, 0x9f, 0xb8, 0x36, 0x61, 0xb7, 0x6f, 0xa4, 0x34, 0x86, 0x30, 0x6e,
|
||||
0xb1, 0x31, 0xe1, 0x32, 0x97, 0x65, 0x58, 0x64, 0x44, 0xeb, 0x50, 0x98, 0x38, 0x53, 0x87, 0xcb,
|
||||
0x0e, 0x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xdf, 0x9c, 0xd4, 0x9d, 0x6f, 0x6c, 0xae, 0xe8, 0x65, 0x47, 0x3f, 0x82, 0xb6, 0x7c, 0x71, 0xd1,
|
||||
0x76, 0x02, 0xbe, 0xe3, 0x18, 0x37, 0x76, 0xee, 0x41, 0x44, 0x81, 0x5b, 0x27, 0x50, 0x88, 0xa2,
|
||||
0x1d, 0x41, 0x41, 0x0c, 0x11, 0x7a, 0x90, 0x38, 0x2d, 0x0e, 0x72, 0x63, 0x63, 0x59, 0x1d, 0x05,
|
||||
0x18, 0x16, 0xc5, 0x49, 0x3b, 0xf8, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x12, 0x37, 0xf1, 0x9b, 0xec,
|
||||
0x06, 0x00, 0x00,
|
||||
}
|
||||
|
@ -86,7 +86,8 @@ enum NodeType {
|
||||
|
||||
message QueryRequest {
|
||||
overlay.Node sender = 1;
|
||||
overlay.Node receiver = 2;
|
||||
overlay.Node target = 2;
|
||||
int64 limit = 3;
|
||||
}
|
||||
|
||||
message QueryResponse {
|
||||
|
Loading…
Reference in New Issue
Block a user