2019-08-28 20:11:19 +01:00
|
|
|
// Code generated by protoc-gen-micro. DO NOT EDIT.
|
2020-01-09 17:49:06 +00:00
|
|
|
// source: network.proto
|
2019-08-28 20:11:19 +01:00
|
|
|
|
|
|
|
package go_micro_network
|
|
|
|
|
|
|
|
import (
|
|
|
|
fmt "fmt"
|
|
|
|
proto "github.com/golang/protobuf/proto"
|
2020-01-30 14:39:00 +03:00
|
|
|
_ "github.com/micro/go-micro/v2/router/service/proto"
|
2019-08-28 20:11:19 +01:00
|
|
|
math "math"
|
|
|
|
)
|
|
|
|
|
2019-08-30 12:29:26 +01:00
|
|
|
import (
|
|
|
|
context "context"
|
2020-01-30 14:39:00 +03:00
|
|
|
client "github.com/micro/go-micro/v2/client"
|
|
|
|
server "github.com/micro/go-micro/v2/server"
|
2019-08-30 12:29:26 +01:00
|
|
|
)
|
|
|
|
|
2019-08-28 20:11:19 +01:00
|
|
|
// 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
|
2019-08-30 12:29:26 +01:00
|
|
|
|
|
|
|
// 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 {
|
2019-10-13 12:37:39 +01:00
|
|
|
// Connect to the network
|
|
|
|
Connect(ctx context.Context, in *ConnectRequest, opts ...client.CallOption) (*ConnectResponse, error)
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns the entire network graph
|
2019-09-23 15:41:05 +01:00
|
|
|
Graph(ctx context.Context, in *GraphRequest, opts ...client.CallOption) (*GraphResponse, error)
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known nodes in the network
|
2019-09-23 15:41:05 +01:00
|
|
|
Nodes(ctx context.Context, in *NodesRequest, opts ...client.CallOption) (*NodesResponse, error)
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known routes in the network
|
2019-09-23 15:41:05 +01:00
|
|
|
Routes(ctx context.Context, in *RoutesRequest, opts ...client.CallOption) (*RoutesResponse, error)
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known services based on routes
|
|
|
|
Services(ctx context.Context, in *ServicesRequest, opts ...client.CallOption) (*ServicesResponse, error)
|
2020-01-14 18:12:36 +00:00
|
|
|
// Status returns network status
|
|
|
|
Status(ctx context.Context, in *StatusRequest, opts ...client.CallOption) (*StatusResponse, error)
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-10-13 12:37:39 +01:00
|
|
|
func (c *networkService) Connect(ctx context.Context, in *ConnectRequest, opts ...client.CallOption) (*ConnectResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Connect", in)
|
|
|
|
out := new(ConnectResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-09-23 15:41:05 +01:00
|
|
|
func (c *networkService) Graph(ctx context.Context, in *GraphRequest, opts ...client.CallOption) (*GraphResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Graph", in)
|
|
|
|
out := new(GraphResponse)
|
2019-08-30 12:29:26 +01:00
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-09-23 15:41:05 +01:00
|
|
|
func (c *networkService) Nodes(ctx context.Context, in *NodesRequest, opts ...client.CallOption) (*NodesResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Nodes", in)
|
|
|
|
out := new(NodesResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *networkService) Routes(ctx context.Context, in *RoutesRequest, opts ...client.CallOption) (*RoutesResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Routes", in)
|
|
|
|
out := new(RoutesResponse)
|
2019-08-30 12:29:26 +01:00
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-09-30 07:51:13 +01:00
|
|
|
func (c *networkService) Services(ctx context.Context, in *ServicesRequest, opts ...client.CallOption) (*ServicesResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Services", in)
|
|
|
|
out := new(ServicesResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2020-01-14 18:12:36 +00:00
|
|
|
func (c *networkService) Status(ctx context.Context, in *StatusRequest, opts ...client.CallOption) (*StatusResponse, error) {
|
|
|
|
req := c.c.NewRequest(c.name, "Network.Status", in)
|
|
|
|
out := new(StatusResponse)
|
|
|
|
err := c.c.Call(ctx, req, out, opts...)
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return out, nil
|
|
|
|
}
|
|
|
|
|
2019-08-30 12:29:26 +01:00
|
|
|
// Server API for Network service
|
|
|
|
|
|
|
|
type NetworkHandler interface {
|
2019-10-13 12:37:39 +01:00
|
|
|
// Connect to the network
|
|
|
|
Connect(context.Context, *ConnectRequest, *ConnectResponse) error
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns the entire network graph
|
2019-09-23 15:41:05 +01:00
|
|
|
Graph(context.Context, *GraphRequest, *GraphResponse) error
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known nodes in the network
|
2019-09-23 15:41:05 +01:00
|
|
|
Nodes(context.Context, *NodesRequest, *NodesResponse) error
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known routes in the network
|
2019-09-23 15:41:05 +01:00
|
|
|
Routes(context.Context, *RoutesRequest, *RoutesResponse) error
|
2019-09-30 07:51:13 +01:00
|
|
|
// Returns a list of known services based on routes
|
|
|
|
Services(context.Context, *ServicesRequest, *ServicesResponse) error
|
2020-01-14 18:12:36 +00:00
|
|
|
// Status returns network status
|
|
|
|
Status(context.Context, *StatusRequest, *StatusResponse) error
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
func RegisterNetworkHandler(s server.Server, hdlr NetworkHandler, opts ...server.HandlerOption) error {
|
|
|
|
type network interface {
|
2019-10-13 12:37:39 +01:00
|
|
|
Connect(ctx context.Context, in *ConnectRequest, out *ConnectResponse) error
|
2019-09-23 15:41:05 +01:00
|
|
|
Graph(ctx context.Context, in *GraphRequest, out *GraphResponse) error
|
|
|
|
Nodes(ctx context.Context, in *NodesRequest, out *NodesResponse) error
|
|
|
|
Routes(ctx context.Context, in *RoutesRequest, out *RoutesResponse) error
|
2019-09-30 07:51:13 +01:00
|
|
|
Services(ctx context.Context, in *ServicesRequest, out *ServicesResponse) error
|
2020-01-14 18:12:36 +00:00
|
|
|
Status(ctx context.Context, in *StatusRequest, out *StatusResponse) error
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
|
|
|
type Network struct {
|
|
|
|
network
|
|
|
|
}
|
|
|
|
h := &networkHandler{hdlr}
|
|
|
|
return s.Handle(s.NewHandler(&Network{h}, opts...))
|
|
|
|
}
|
|
|
|
|
|
|
|
type networkHandler struct {
|
|
|
|
NetworkHandler
|
|
|
|
}
|
|
|
|
|
2019-10-13 12:37:39 +01:00
|
|
|
func (h *networkHandler) Connect(ctx context.Context, in *ConnectRequest, out *ConnectResponse) error {
|
|
|
|
return h.NetworkHandler.Connect(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
2019-09-23 15:41:05 +01:00
|
|
|
func (h *networkHandler) Graph(ctx context.Context, in *GraphRequest, out *GraphResponse) error {
|
|
|
|
return h.NetworkHandler.Graph(ctx, in, out)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (h *networkHandler) Nodes(ctx context.Context, in *NodesRequest, out *NodesResponse) error {
|
|
|
|
return h.NetworkHandler.Nodes(ctx, in, out)
|
2019-08-30 12:29:26 +01:00
|
|
|
}
|
2019-09-09 18:47:10 +01:00
|
|
|
|
2019-09-23 15:41:05 +01:00
|
|
|
func (h *networkHandler) Routes(ctx context.Context, in *RoutesRequest, out *RoutesResponse) error {
|
|
|
|
return h.NetworkHandler.Routes(ctx, in, out)
|
2019-09-09 18:47:10 +01:00
|
|
|
}
|
2019-09-30 07:51:13 +01:00
|
|
|
|
|
|
|
func (h *networkHandler) Services(ctx context.Context, in *ServicesRequest, out *ServicesResponse) error {
|
|
|
|
return h.NetworkHandler.Services(ctx, in, out)
|
|
|
|
}
|
2020-01-14 18:12:36 +00:00
|
|
|
|
|
|
|
func (h *networkHandler) Status(ctx context.Context, in *StatusRequest, out *StatusResponse) error {
|
|
|
|
return h.NetworkHandler.Status(ctx, in, out)
|
|
|
|
}
|