autopilotrpc

package
v0.15.5-beta Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Overview

Package autopilotrpc is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

This section is empty.

Variables

View Source
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,
		},
		{
			MethodName: "QueryScores",
			Handler:    _Autopilot_QueryScores_Handler,
		},
		{
			MethodName: "SetScores",
			Handler:    _Autopilot_SetScores_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "autopilotrpc/autopilot.proto",
}

Autopilot_ServiceDesc is the grpc.ServiceDesc for Autopilot service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

View Source
var File_autopilotrpc_autopilot_proto protoreflect.FileDescriptor

Functions

func DisableLog

func DisableLog()

DisableLog disables all library log output. Logging output is disabled by by default until UseLogger is called.

func RegisterAutopilotHandler

func RegisterAutopilotHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterAutopilotHandler registers the http handlers for service Autopilot to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterAutopilotHandlerClient

func RegisterAutopilotHandlerClient(ctx context.Context, mux *runtime.ServeMux, client AutopilotClient) error

RegisterAutopilotHandlerClient registers the http handlers for service Autopilot to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "AutopilotClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "AutopilotClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "AutopilotClient" to call the correct interceptors.

func RegisterAutopilotHandlerFromEndpoint

func RegisterAutopilotHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterAutopilotHandlerFromEndpoint is same as RegisterAutopilotHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterAutopilotHandlerServer

func RegisterAutopilotHandlerServer(ctx context.Context, mux *runtime.ServeMux, server AutopilotServer) error

RegisterAutopilotHandlerServer registers the http handlers for service Autopilot to "mux". UnaryRPC :call AutopilotServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterAutopilotHandlerFromEndpoint instead.

func RegisterAutopilotJSONCallbacks

func RegisterAutopilotJSONCallbacks(registry map[string]func(ctx context.Context,
	conn *grpc.ClientConn, reqJSON string, callback func(string, error)))

func RegisterAutopilotServer

func RegisterAutopilotServer(s grpc.ServiceRegistrar, srv AutopilotServer)

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type AutopilotClient

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)
	//
	//QueryScores queries all available autopilot heuristics, in addition to any
	//active combination of these heruristics, for the scores they would give to
	//the given nodes.
	QueryScores(ctx context.Context, in *QueryScoresRequest, opts ...grpc.CallOption) (*QueryScoresResponse, error)
	//
	//SetScores attempts to set the scores used by the running autopilot agent,
	//if the external scoring heuristic is enabled.
	SetScores(ctx context.Context, in *SetScoresRequest, opts ...grpc.CallOption) (*SetScoresResponse, error)
}

AutopilotClient is the client API for Autopilot service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewAutopilotClient

func NewAutopilotClient(cc grpc.ClientConnInterface) AutopilotClient

type AutopilotServer

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)
	//
	//QueryScores queries all available autopilot heuristics, in addition to any
	//active combination of these heruristics, for the scores they would give to
	//the given nodes.
	QueryScores(context.Context, *QueryScoresRequest) (*QueryScoresResponse, error)
	//
	//SetScores attempts to set the scores used by the running autopilot agent,
	//if the external scoring heuristic is enabled.
	SetScores(context.Context, *SetScoresRequest) (*SetScoresResponse, error)
	// contains filtered or unexported methods
}

AutopilotServer is the server API for Autopilot service. All implementations must embed UnimplementedAutopilotServer for forward compatibility

type Config

type Config struct{}

Config is empty for non-autopilotrpc builds.

type ModifyStatusRequest

type ModifyStatusRequest struct {

	// Whether the autopilot agent should be enabled or not.
	Enable bool `protobuf:"varint,1,opt,name=enable,proto3" json:"enable,omitempty"`
	// contains filtered or unexported fields
}

func (*ModifyStatusRequest) Descriptor deprecated

func (*ModifyStatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use ModifyStatusRequest.ProtoReflect.Descriptor instead.

func (*ModifyStatusRequest) GetEnable

func (x *ModifyStatusRequest) GetEnable() bool

func (*ModifyStatusRequest) ProtoMessage

func (*ModifyStatusRequest) ProtoMessage()

func (*ModifyStatusRequest) ProtoReflect

func (x *ModifyStatusRequest) ProtoReflect() protoreflect.Message

func (*ModifyStatusRequest) Reset

func (x *ModifyStatusRequest) Reset()

func (*ModifyStatusRequest) String

func (x *ModifyStatusRequest) String() string

type ModifyStatusResponse

type ModifyStatusResponse struct {
	// contains filtered or unexported fields
}

func (*ModifyStatusResponse) Descriptor deprecated

func (*ModifyStatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use ModifyStatusResponse.ProtoReflect.Descriptor instead.

func (*ModifyStatusResponse) ProtoMessage

func (*ModifyStatusResponse) ProtoMessage()

func (*ModifyStatusResponse) ProtoReflect

func (x *ModifyStatusResponse) ProtoReflect() protoreflect.Message

func (*ModifyStatusResponse) Reset

func (x *ModifyStatusResponse) Reset()

func (*ModifyStatusResponse) String

func (x *ModifyStatusResponse) String() string

type QueryScoresRequest

type QueryScoresRequest struct {
	Pubkeys []string `protobuf:"bytes,1,rep,name=pubkeys,proto3" json:"pubkeys,omitempty"`
	// If set, we will ignore the local channel state when calculating scores.
	IgnoreLocalState bool `protobuf:"varint,2,opt,name=ignore_local_state,json=ignoreLocalState,proto3" json:"ignore_local_state,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryScoresRequest) Descriptor deprecated

func (*QueryScoresRequest) Descriptor() ([]byte, []int)

Deprecated: Use QueryScoresRequest.ProtoReflect.Descriptor instead.

func (*QueryScoresRequest) GetIgnoreLocalState

func (x *QueryScoresRequest) GetIgnoreLocalState() bool

func (*QueryScoresRequest) GetPubkeys

func (x *QueryScoresRequest) GetPubkeys() []string

func (*QueryScoresRequest) ProtoMessage

func (*QueryScoresRequest) ProtoMessage()

func (*QueryScoresRequest) ProtoReflect

func (x *QueryScoresRequest) ProtoReflect() protoreflect.Message

func (*QueryScoresRequest) Reset

func (x *QueryScoresRequest) Reset()

func (*QueryScoresRequest) String

func (x *QueryScoresRequest) String() string

type QueryScoresResponse

type QueryScoresResponse struct {
	Results []*QueryScoresResponse_HeuristicResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	// contains filtered or unexported fields
}

func (*QueryScoresResponse) Descriptor deprecated

func (*QueryScoresResponse) Descriptor() ([]byte, []int)

Deprecated: Use QueryScoresResponse.ProtoReflect.Descriptor instead.

func (*QueryScoresResponse) GetResults

func (*QueryScoresResponse) ProtoMessage

func (*QueryScoresResponse) ProtoMessage()

func (*QueryScoresResponse) ProtoReflect

func (x *QueryScoresResponse) ProtoReflect() protoreflect.Message

func (*QueryScoresResponse) Reset

func (x *QueryScoresResponse) Reset()

func (*QueryScoresResponse) String

func (x *QueryScoresResponse) String() string

type QueryScoresResponse_HeuristicResult

type QueryScoresResponse_HeuristicResult struct {
	Heuristic string             `protobuf:"bytes,1,opt,name=heuristic,proto3" json:"heuristic,omitempty"`
	Scores    map[string]float64 `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*QueryScoresResponse_HeuristicResult) Descriptor deprecated

func (*QueryScoresResponse_HeuristicResult) Descriptor() ([]byte, []int)

Deprecated: Use QueryScoresResponse_HeuristicResult.ProtoReflect.Descriptor instead.

func (*QueryScoresResponse_HeuristicResult) GetHeuristic

func (x *QueryScoresResponse_HeuristicResult) GetHeuristic() string

func (*QueryScoresResponse_HeuristicResult) GetScores

func (*QueryScoresResponse_HeuristicResult) ProtoMessage

func (*QueryScoresResponse_HeuristicResult) ProtoMessage()

func (*QueryScoresResponse_HeuristicResult) ProtoReflect

func (*QueryScoresResponse_HeuristicResult) Reset

func (*QueryScoresResponse_HeuristicResult) String

type SetScoresRequest

type SetScoresRequest struct {

	// The name of the heuristic to provide scores to.
	Heuristic string `protobuf:"bytes,1,opt,name=heuristic,proto3" json:"heuristic,omitempty"`
	//
	//A map from hex-encoded public keys to scores. Scores must be in the range
	//[0.0, 1.0].
	Scores map[string]float64 `` /* 155-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*SetScoresRequest) Descriptor deprecated

func (*SetScoresRequest) Descriptor() ([]byte, []int)

Deprecated: Use SetScoresRequest.ProtoReflect.Descriptor instead.

func (*SetScoresRequest) GetHeuristic

func (x *SetScoresRequest) GetHeuristic() string

func (*SetScoresRequest) GetScores

func (x *SetScoresRequest) GetScores() map[string]float64

func (*SetScoresRequest) ProtoMessage

func (*SetScoresRequest) ProtoMessage()

func (*SetScoresRequest) ProtoReflect

func (x *SetScoresRequest) ProtoReflect() protoreflect.Message

func (*SetScoresRequest) Reset

func (x *SetScoresRequest) Reset()

func (*SetScoresRequest) String

func (x *SetScoresRequest) String() string

type SetScoresResponse

type SetScoresResponse struct {
	// contains filtered or unexported fields
}

func (*SetScoresResponse) Descriptor deprecated

func (*SetScoresResponse) Descriptor() ([]byte, []int)

Deprecated: Use SetScoresResponse.ProtoReflect.Descriptor instead.

func (*SetScoresResponse) ProtoMessage

func (*SetScoresResponse) ProtoMessage()

func (*SetScoresResponse) ProtoReflect

func (x *SetScoresResponse) ProtoReflect() protoreflect.Message

func (*SetScoresResponse) Reset

func (x *SetScoresResponse) Reset()

func (*SetScoresResponse) String

func (x *SetScoresResponse) String() string

type StatusRequest

type StatusRequest struct {
	// contains filtered or unexported fields
}

func (*StatusRequest) Descriptor deprecated

func (*StatusRequest) Descriptor() ([]byte, []int)

Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) ProtoReflect

func (x *StatusRequest) ProtoReflect() protoreflect.Message

func (*StatusRequest) Reset

func (x *StatusRequest) Reset()

func (*StatusRequest) String

func (x *StatusRequest) String() string

type StatusResponse

type StatusResponse struct {

	// Indicates whether the autopilot is active or not.
	Active bool `protobuf:"varint,1,opt,name=active,proto3" json:"active,omitempty"`
	// contains filtered or unexported fields
}

func (*StatusResponse) Descriptor deprecated

func (*StatusResponse) Descriptor() ([]byte, []int)

Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.

func (*StatusResponse) GetActive

func (x *StatusResponse) GetActive() bool

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) ProtoReflect

func (x *StatusResponse) ProtoReflect() protoreflect.Message

func (*StatusResponse) Reset

func (x *StatusResponse) Reset()

func (*StatusResponse) String

func (x *StatusResponse) String() string

type UnimplementedAutopilotServer

type UnimplementedAutopilotServer struct {
}

UnimplementedAutopilotServer must be embedded to have forward compatible implementations.

func (UnimplementedAutopilotServer) ModifyStatus

func (UnimplementedAutopilotServer) QueryScores

func (UnimplementedAutopilotServer) SetScores

func (UnimplementedAutopilotServer) Status

type UnsafeAutopilotServer

type UnsafeAutopilotServer interface {
	// contains filtered or unexported methods
}

UnsafeAutopilotServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to AutopilotServer will result in compilation errors.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL