* Nodes/Topology removed from public methods from Network interface * Peers() returns max depth 3 topology * handler.Topology rpc endpoint removed * handler.Peers rpc endpoint accept "depth" param to return max depth peers
		
			
				
	
	
		
			110 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			3.0 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| // Code generated by protoc-gen-micro. DO NOT EDIT.
 | |
| // source: network.proto
 | |
| 
 | |
| package go_micro_network
 | |
| 
 | |
| import (
 | |
| 	fmt "fmt"
 | |
| 	proto "github.com/golang/protobuf/proto"
 | |
| 	proto1 "github.com/micro/go-micro/router/proto"
 | |
| 	math "math"
 | |
| )
 | |
| 
 | |
| import (
 | |
| 	context "context"
 | |
| 	client "github.com/micro/go-micro/client"
 | |
| 	server "github.com/micro/go-micro/server"
 | |
| )
 | |
| 
 | |
| // Reference imports to suppress errors if they are not otherwise used.
 | |
| var _ = proto.Marshal
 | |
| var _ = fmt.Errorf
 | |
| var _ = math.Inf
 | |
| 
 | |
| // This is a compile-time assertion to ensure that this generated file
 | |
| // is compatible with the proto package it is being compiled against.
 | |
| // A compilation error at this line likely means your copy of the
 | |
| // proto package needs to be updated.
 | |
| const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package
 | |
| 
 | |
| // Reference imports to suppress errors if they are not otherwise used.
 | |
| var _ context.Context
 | |
| var _ client.Option
 | |
| var _ server.Option
 | |
| 
 | |
| // Client API for Network service
 | |
| 
 | |
| type NetworkService interface {
 | |
| 	ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error)
 | |
| 	ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error)
 | |
| }
 | |
| 
 | |
| type networkService struct {
 | |
| 	c    client.Client
 | |
| 	name string
 | |
| }
 | |
| 
 | |
| func NewNetworkService(name string, c client.Client) NetworkService {
 | |
| 	if c == nil {
 | |
| 		c = client.NewClient()
 | |
| 	}
 | |
| 	if len(name) == 0 {
 | |
| 		name = "go.micro.network"
 | |
| 	}
 | |
| 	return &networkService{
 | |
| 		c:    c,
 | |
| 		name: name,
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func (c *networkService) ListPeers(ctx context.Context, in *PeerRequest, opts ...client.CallOption) (*PeerResponse, error) {
 | |
| 	req := c.c.NewRequest(c.name, "Network.ListPeers", in)
 | |
| 	out := new(PeerResponse)
 | |
| 	err := c.c.Call(ctx, req, out, opts...)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 	return out, nil
 | |
| }
 | |
| 
 | |
| func (c *networkService) ListRoutes(ctx context.Context, in *proto1.Request, opts ...client.CallOption) (*proto1.ListResponse, error) {
 | |
| 	req := c.c.NewRequest(c.name, "Network.ListRoutes", in)
 | |
| 	out := new(proto1.ListResponse)
 | |
| 	err := c.c.Call(ctx, req, out, opts...)
 | |
| 	if err != nil {
 | |
| 		return nil, err
 | |
| 	}
 | |
| 	return out, nil
 | |
| }
 | |
| 
 | |
| // Server API for Network service
 | |
| 
 | |
| type NetworkHandler interface {
 | |
| 	ListPeers(context.Context, *PeerRequest, *PeerResponse) error
 | |
| 	ListRoutes(context.Context, *proto1.Request, *proto1.ListResponse) error
 | |
| }
 | |
| 
 | |
| func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error {
 | |
| 	type network interface {
 | |
| 		ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error
 | |
| 		ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error
 | |
| 	}
 | |
| 	type Network struct {
 | |
| 		network
 | |
| 	}
 | |
| 	h := &networkHandler{hdlr}
 | |
| 	return s.Handle(s.NewHandler(&Network{h}, opts...))
 | |
| }
 | |
| 
 | |
| type networkHandler struct {
 | |
| 	NetworkHandler
 | |
| }
 | |
| 
 | |
| func (h *networkHandler) ListPeers(ctx context.Context, in *PeerRequest, out *PeerResponse) error {
 | |
| 	return h.NetworkHandler.ListPeers(ctx, in, out)
 | |
| }
 | |
| 
 | |
| func (h *networkHandler) ListRoutes(ctx context.Context, in *proto1.Request, out *proto1.ListResponse) error {
 | |
| 	return h.NetworkHandler.ListRoutes(ctx, in, out)
 | |
| }
 |