lnrpc: add autopilotrpc subservice
This commit adds a new service lnrpc/autopilot, that is to be used to communicate with the running autopilot. Currently a RPC for getting the status of the agent is included, as well as enabling/disabling at runtime.
This commit is contained in:
parent
cff42e06c8
commit
db4bbe1c3a
226
lnrpc/autopilotrpc/autopilot.pb.go
Normal file
226
lnrpc/autopilotrpc/autopilot.pb.go
Normal file
@ -0,0 +1,226 @@
|
||||
// Code generated by protoc-gen-go. DO NOT EDIT.
|
||||
// source: autopilotrpc/autopilot.proto
|
||||
|
||||
/*
|
||||
Package autopilotrpc is a generated protocol buffer package.
|
||||
|
||||
It is generated from these files:
|
||||
autopilotrpc/autopilot.proto
|
||||
|
||||
It has these top-level messages:
|
||||
StatusRequest
|
||||
StatusResponse
|
||||
ModifyStatusRequest
|
||||
ModifyStatusResponse
|
||||
*/
|
||||
package autopilotrpc
|
||||
|
||||
import proto "github.com/golang/protobuf/proto"
|
||||
import fmt "fmt"
|
||||
import math "math"
|
||||
|
||||
import (
|
||||
context "golang.org/x/net/context"
|
||||
grpc "google.golang.org/grpc"
|
||||
)
|
||||
|
||||
// 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.ProtoPackageIsVersion2 // please upgrade the proto package
|
||||
|
||||
type StatusRequest struct {
|
||||
}
|
||||
|
||||
func (m *StatusRequest) Reset() { *m = StatusRequest{} }
|
||||
func (m *StatusRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatusRequest) ProtoMessage() {}
|
||||
func (*StatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} }
|
||||
|
||||
type StatusResponse struct {
|
||||
// / Indicates whether the autopilot is active or not.
|
||||
Active bool `protobuf:"varint,1,opt,name=active" json:"active,omitempty"`
|
||||
}
|
||||
|
||||
func (m *StatusResponse) Reset() { *m = StatusResponse{} }
|
||||
func (m *StatusResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*StatusResponse) ProtoMessage() {}
|
||||
func (*StatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} }
|
||||
|
||||
func (m *StatusResponse) GetActive() bool {
|
||||
if m != nil {
|
||||
return m.Active
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ModifyStatusRequest struct {
|
||||
// / Whether the autopilot agent should be enabled or not.
|
||||
Enable bool `protobuf:"varint,1,opt,name=enable" json:"enable,omitempty"`
|
||||
}
|
||||
|
||||
func (m *ModifyStatusRequest) Reset() { *m = ModifyStatusRequest{} }
|
||||
func (m *ModifyStatusRequest) String() string { return proto.CompactTextString(m) }
|
||||
func (*ModifyStatusRequest) ProtoMessage() {}
|
||||
func (*ModifyStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} }
|
||||
|
||||
func (m *ModifyStatusRequest) GetEnable() bool {
|
||||
if m != nil {
|
||||
return m.Enable
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
type ModifyStatusResponse struct {
|
||||
}
|
||||
|
||||
func (m *ModifyStatusResponse) Reset() { *m = ModifyStatusResponse{} }
|
||||
func (m *ModifyStatusResponse) String() string { return proto.CompactTextString(m) }
|
||||
func (*ModifyStatusResponse) ProtoMessage() {}
|
||||
func (*ModifyStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} }
|
||||
|
||||
func init() {
|
||||
proto.RegisterType((*StatusRequest)(nil), "autopilotrpc.StatusRequest")
|
||||
proto.RegisterType((*StatusResponse)(nil), "autopilotrpc.StatusResponse")
|
||||
proto.RegisterType((*ModifyStatusRequest)(nil), "autopilotrpc.ModifyStatusRequest")
|
||||
proto.RegisterType((*ModifyStatusResponse)(nil), "autopilotrpc.ModifyStatusResponse")
|
||||
}
|
||||
|
||||
// Reference imports to suppress errors if they are not otherwise used.
|
||||
var _ context.Context
|
||||
var _ grpc.ClientConn
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
const _ = grpc.SupportPackageIsVersion4
|
||||
|
||||
// Client API for Autopilot service
|
||||
|
||||
type AutopilotClient interface {
|
||||
// *
|
||||
// Status returns whether the daemon's autopilot agent is active.
|
||||
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
|
||||
// *
|
||||
// ModifyStatus is used to modify the status of the autopilot agent, like
|
||||
// enabling or disabling it.
|
||||
ModifyStatus(ctx context.Context, in *ModifyStatusRequest, opts ...grpc.CallOption) (*ModifyStatusResponse, error)
|
||||
}
|
||||
|
||||
type autopilotClient struct {
|
||||
cc *grpc.ClientConn
|
||||
}
|
||||
|
||||
func NewAutopilotClient(cc *grpc.ClientConn) AutopilotClient {
|
||||
return &autopilotClient{cc}
|
||||
}
|
||||
|
||||
func (c *autopilotClient) Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) {
|
||||
out := new(StatusResponse)
|
||||
err := grpc.Invoke(ctx, "/autopilotrpc.Autopilot/Status", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *autopilotClient) ModifyStatus(ctx context.Context, in *ModifyStatusRequest, opts ...grpc.CallOption) (*ModifyStatusResponse, error) {
|
||||
out := new(ModifyStatusResponse)
|
||||
err := grpc.Invoke(ctx, "/autopilotrpc.Autopilot/ModifyStatus", in, out, c.cc, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// Server API for Autopilot service
|
||||
|
||||
type AutopilotServer interface {
|
||||
// *
|
||||
// Status returns whether the daemon's autopilot agent is active.
|
||||
Status(context.Context, *StatusRequest) (*StatusResponse, error)
|
||||
// *
|
||||
// ModifyStatus is used to modify the status of the autopilot agent, like
|
||||
// enabling or disabling it.
|
||||
ModifyStatus(context.Context, *ModifyStatusRequest) (*ModifyStatusResponse, error)
|
||||
}
|
||||
|
||||
func RegisterAutopilotServer(s *grpc.Server, srv AutopilotServer) {
|
||||
s.RegisterService(&_Autopilot_serviceDesc, srv)
|
||||
}
|
||||
|
||||
func _Autopilot_Status_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(StatusRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AutopilotServer).Status(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/autopilotrpc.Autopilot/Status",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AutopilotServer).Status(ctx, req.(*StatusRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Autopilot_ModifyStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(ModifyStatusRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(AutopilotServer).ModifyStatus(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: "/autopilotrpc.Autopilot/ModifyStatus",
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(AutopilotServer).ModifyStatus(ctx, req.(*ModifyStatusRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
var _Autopilot_serviceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "autopilotrpc.Autopilot",
|
||||
HandlerType: (*AutopilotServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Status",
|
||||
Handler: _Autopilot_Status_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ModifyStatus",
|
||||
Handler: _Autopilot_ModifyStatus_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "autopilotrpc/autopilot.proto",
|
||||
}
|
||||
|
||||
func init() { proto.RegisterFile("autopilotrpc/autopilot.proto", fileDescriptor0) }
|
||||
|
||||
var fileDescriptor0 = []byte{
|
||||
// 183 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0x2c, 0x2d, 0xc9,
|
||||
0x2f, 0xc8, 0xcc, 0xc9, 0x2f, 0x29, 0x2a, 0x48, 0xd6, 0x87, 0x73, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b,
|
||||
0xf2, 0x85, 0x78, 0x90, 0x65, 0x95, 0xf8, 0xb9, 0x78, 0x83, 0x4b, 0x12, 0x4b, 0x4a, 0x8b, 0x83,
|
||||
0x52, 0x0b, 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x34, 0xb8, 0xf8, 0x60, 0x02, 0xc5, 0x05, 0xf9, 0x79,
|
||||
0xc5, 0xa9, 0x42, 0x62, 0x5c, 0x6c, 0x89, 0xc9, 0x25, 0x99, 0x65, 0xa9, 0x12, 0x8c, 0x0a, 0x8c,
|
||||
0x1a, 0x1c, 0x41, 0x50, 0x9e, 0x92, 0x2e, 0x97, 0xb0, 0x6f, 0x7e, 0x4a, 0x66, 0x5a, 0x25, 0x8a,
|
||||
0x01, 0x20, 0xe5, 0xa9, 0x79, 0x89, 0x49, 0x39, 0x70, 0xe5, 0x10, 0x9e, 0x92, 0x18, 0x97, 0x08,
|
||||
0xaa, 0x72, 0x88, 0xf1, 0x46, 0xcb, 0x19, 0xb9, 0x38, 0x1d, 0x61, 0x4e, 0x12, 0x72, 0xe6, 0x62,
|
||||
0x83, 0xc8, 0x0b, 0x49, 0xeb, 0x21, 0x3b, 0x54, 0x0f, 0xc5, 0x12, 0x29, 0x19, 0xec, 0x92, 0x50,
|
||||
0x17, 0x87, 0x72, 0xf1, 0x20, 0x5b, 0x25, 0xa4, 0x88, 0xaa, 0x1a, 0x8b, 0xab, 0xa5, 0x94, 0xf0,
|
||||
0x29, 0x81, 0x18, 0x9b, 0xc4, 0x06, 0x0e, 0x40, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xf8,
|
||||
0x0f, 0x84, 0xb8, 0x60, 0x01, 0x00, 0x00,
|
||||
}
|
34
lnrpc/autopilotrpc/autopilot.proto
Normal file
34
lnrpc/autopilotrpc/autopilot.proto
Normal file
@ -0,0 +1,34 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package autopilotrpc;
|
||||
|
||||
// Autopilot is a service that can be used to get information about the current
|
||||
// state of the daemon's autopilot agent, and also supply it with information
|
||||
// that can be used when deciding where to open channels.
|
||||
service Autopilot {
|
||||
/**
|
||||
Status returns whether the daemon's autopilot agent is active.
|
||||
*/
|
||||
rpc Status(StatusRequest) returns (StatusResponse);
|
||||
|
||||
/**
|
||||
ModifyStatus is used to modify the status of the autopilot agent, like
|
||||
enabling or disabling it.
|
||||
*/
|
||||
rpc ModifyStatus(ModifyStatusRequest) returns (ModifyStatusResponse);
|
||||
}
|
||||
|
||||
message StatusRequest{
|
||||
}
|
||||
|
||||
message StatusResponse{
|
||||
/// Indicates whether the autopilot is active or not.
|
||||
bool active = 1 [json_name = "active"];
|
||||
}
|
||||
|
||||
message ModifyStatusRequest{
|
||||
/// Whether the autopilot agent should be enabled or not.
|
||||
bool enable = 1 [json_name = "enable"];
|
||||
}
|
||||
|
||||
message ModifyStatusResponse {}
|
Loading…
Reference in New Issue
Block a user