autopilotrpc

package
v0.12.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: MIT Imports: 15 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

This section is empty.

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.

func RegisterAutopilotServer

func RegisterAutopilotServer(s *grpc.Server, 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://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewAutopilotClient

func NewAutopilotClient(cc *grpc.ClientConn) 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)
}

AutopilotServer is the server API for Autopilot service.

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ModifyStatusRequest) Descriptor

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

func (*ModifyStatusRequest) GetEnable

func (m *ModifyStatusRequest) GetEnable() bool

func (*ModifyStatusRequest) ProtoMessage

func (*ModifyStatusRequest) ProtoMessage()

func (*ModifyStatusRequest) Reset

func (m *ModifyStatusRequest) Reset()

func (*ModifyStatusRequest) String

func (m *ModifyStatusRequest) String() string

func (*ModifyStatusRequest) XXX_DiscardUnknown

func (m *ModifyStatusRequest) XXX_DiscardUnknown()

func (*ModifyStatusRequest) XXX_Marshal

func (m *ModifyStatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ModifyStatusRequest) XXX_Merge

func (m *ModifyStatusRequest) XXX_Merge(src proto.Message)

func (*ModifyStatusRequest) XXX_Size

func (m *ModifyStatusRequest) XXX_Size() int

func (*ModifyStatusRequest) XXX_Unmarshal

func (m *ModifyStatusRequest) XXX_Unmarshal(b []byte) error

type ModifyStatusResponse

type ModifyStatusResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ModifyStatusResponse) Descriptor

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

func (*ModifyStatusResponse) ProtoMessage

func (*ModifyStatusResponse) ProtoMessage()

func (*ModifyStatusResponse) Reset

func (m *ModifyStatusResponse) Reset()

func (*ModifyStatusResponse) String

func (m *ModifyStatusResponse) String() string

func (*ModifyStatusResponse) XXX_DiscardUnknown

func (m *ModifyStatusResponse) XXX_DiscardUnknown()

func (*ModifyStatusResponse) XXX_Marshal

func (m *ModifyStatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ModifyStatusResponse) XXX_Merge

func (m *ModifyStatusResponse) XXX_Merge(src proto.Message)

func (*ModifyStatusResponse) XXX_Size

func (m *ModifyStatusResponse) XXX_Size() int

func (*ModifyStatusResponse) XXX_Unmarshal

func (m *ModifyStatusResponse) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*QueryScoresRequest) Descriptor

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

func (*QueryScoresRequest) GetIgnoreLocalState

func (m *QueryScoresRequest) GetIgnoreLocalState() bool

func (*QueryScoresRequest) GetPubkeys

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

func (*QueryScoresRequest) ProtoMessage

func (*QueryScoresRequest) ProtoMessage()

func (*QueryScoresRequest) Reset

func (m *QueryScoresRequest) Reset()

func (*QueryScoresRequest) String

func (m *QueryScoresRequest) String() string

func (*QueryScoresRequest) XXX_DiscardUnknown

func (m *QueryScoresRequest) XXX_DiscardUnknown()

func (*QueryScoresRequest) XXX_Marshal

func (m *QueryScoresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryScoresRequest) XXX_Merge

func (m *QueryScoresRequest) XXX_Merge(src proto.Message)

func (*QueryScoresRequest) XXX_Size

func (m *QueryScoresRequest) XXX_Size() int

func (*QueryScoresRequest) XXX_Unmarshal

func (m *QueryScoresRequest) XXX_Unmarshal(b []byte) error

type QueryScoresResponse

type QueryScoresResponse struct {
	Results              []*QueryScoresResponse_HeuristicResult `protobuf:"bytes,1,rep,name=results,proto3" json:"results,omitempty"`
	XXX_NoUnkeyedLiteral struct{}                               `json:"-"`
	XXX_unrecognized     []byte                                 `json:"-"`
	XXX_sizecache        int32                                  `json:"-"`
}

func (*QueryScoresResponse) Descriptor

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

func (*QueryScoresResponse) GetResults

func (*QueryScoresResponse) ProtoMessage

func (*QueryScoresResponse) ProtoMessage()

func (*QueryScoresResponse) Reset

func (m *QueryScoresResponse) Reset()

func (*QueryScoresResponse) String

func (m *QueryScoresResponse) String() string

func (*QueryScoresResponse) XXX_DiscardUnknown

func (m *QueryScoresResponse) XXX_DiscardUnknown()

func (*QueryScoresResponse) XXX_Marshal

func (m *QueryScoresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryScoresResponse) XXX_Merge

func (m *QueryScoresResponse) XXX_Merge(src proto.Message)

func (*QueryScoresResponse) XXX_Size

func (m *QueryScoresResponse) XXX_Size() int

func (*QueryScoresResponse) XXX_Unmarshal

func (m *QueryScoresResponse) XXX_Unmarshal(b []byte) error

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 */
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*QueryScoresResponse_HeuristicResult) Descriptor

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

func (*QueryScoresResponse_HeuristicResult) GetHeuristic

func (m *QueryScoresResponse_HeuristicResult) GetHeuristic() string

func (*QueryScoresResponse_HeuristicResult) GetScores

func (*QueryScoresResponse_HeuristicResult) ProtoMessage

func (*QueryScoresResponse_HeuristicResult) ProtoMessage()

func (*QueryScoresResponse_HeuristicResult) Reset

func (*QueryScoresResponse_HeuristicResult) String

func (*QueryScoresResponse_HeuristicResult) XXX_DiscardUnknown

func (m *QueryScoresResponse_HeuristicResult) XXX_DiscardUnknown()

func (*QueryScoresResponse_HeuristicResult) XXX_Marshal

func (m *QueryScoresResponse_HeuristicResult) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*QueryScoresResponse_HeuristicResult) XXX_Merge

func (*QueryScoresResponse_HeuristicResult) XXX_Size

func (*QueryScoresResponse_HeuristicResult) XXX_Unmarshal

func (m *QueryScoresResponse_HeuristicResult) XXX_Unmarshal(b []byte) error

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 */
	XXX_NoUnkeyedLiteral struct{}           `json:"-"`
	XXX_unrecognized     []byte             `json:"-"`
	XXX_sizecache        int32              `json:"-"`
}

func (*SetScoresRequest) Descriptor

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

func (*SetScoresRequest) GetHeuristic

func (m *SetScoresRequest) GetHeuristic() string

func (*SetScoresRequest) GetScores

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

func (*SetScoresRequest) ProtoMessage

func (*SetScoresRequest) ProtoMessage()

func (*SetScoresRequest) Reset

func (m *SetScoresRequest) Reset()

func (*SetScoresRequest) String

func (m *SetScoresRequest) String() string

func (*SetScoresRequest) XXX_DiscardUnknown

func (m *SetScoresRequest) XXX_DiscardUnknown()

func (*SetScoresRequest) XXX_Marshal

func (m *SetScoresRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetScoresRequest) XXX_Merge

func (m *SetScoresRequest) XXX_Merge(src proto.Message)

func (*SetScoresRequest) XXX_Size

func (m *SetScoresRequest) XXX_Size() int

func (*SetScoresRequest) XXX_Unmarshal

func (m *SetScoresRequest) XXX_Unmarshal(b []byte) error

type SetScoresResponse

type SetScoresResponse struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*SetScoresResponse) Descriptor

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

func (*SetScoresResponse) ProtoMessage

func (*SetScoresResponse) ProtoMessage()

func (*SetScoresResponse) Reset

func (m *SetScoresResponse) Reset()

func (*SetScoresResponse) String

func (m *SetScoresResponse) String() string

func (*SetScoresResponse) XXX_DiscardUnknown

func (m *SetScoresResponse) XXX_DiscardUnknown()

func (*SetScoresResponse) XXX_Marshal

func (m *SetScoresResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SetScoresResponse) XXX_Merge

func (m *SetScoresResponse) XXX_Merge(src proto.Message)

func (*SetScoresResponse) XXX_Size

func (m *SetScoresResponse) XXX_Size() int

func (*SetScoresResponse) XXX_Unmarshal

func (m *SetScoresResponse) XXX_Unmarshal(b []byte) error

type StatusRequest

type StatusRequest struct {
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatusRequest) Descriptor

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

func (*StatusRequest) ProtoMessage

func (*StatusRequest) ProtoMessage()

func (*StatusRequest) Reset

func (m *StatusRequest) Reset()

func (*StatusRequest) String

func (m *StatusRequest) String() string

func (*StatusRequest) XXX_DiscardUnknown

func (m *StatusRequest) XXX_DiscardUnknown()

func (*StatusRequest) XXX_Marshal

func (m *StatusRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatusRequest) XXX_Merge

func (m *StatusRequest) XXX_Merge(src proto.Message)

func (*StatusRequest) XXX_Size

func (m *StatusRequest) XXX_Size() int

func (*StatusRequest) XXX_Unmarshal

func (m *StatusRequest) XXX_Unmarshal(b []byte) error

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"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*StatusResponse) Descriptor

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

func (*StatusResponse) GetActive

func (m *StatusResponse) GetActive() bool

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) Reset

func (m *StatusResponse) Reset()

func (*StatusResponse) String

func (m *StatusResponse) String() string

func (*StatusResponse) XXX_DiscardUnknown

func (m *StatusResponse) XXX_DiscardUnknown()

func (*StatusResponse) XXX_Marshal

func (m *StatusResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*StatusResponse) XXX_Merge

func (m *StatusResponse) XXX_Merge(src proto.Message)

func (*StatusResponse) XXX_Size

func (m *StatusResponse) XXX_Size() int

func (*StatusResponse) XXX_Unmarshal

func (m *StatusResponse) XXX_Unmarshal(b []byte) error

type UnimplementedAutopilotServer

type UnimplementedAutopilotServer struct {
}

UnimplementedAutopilotServer can be embedded to have forward compatible implementations.

func (*UnimplementedAutopilotServer) ModifyStatus

func (*UnimplementedAutopilotServer) QueryScores

func (*UnimplementedAutopilotServer) SetScores

func (*UnimplementedAutopilotServer) Status

Jump to

Keyboard shortcuts

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