bifrost_rpc_access

package
v0.12.5 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const SRPCAccessRpcServiceServiceID = "bifrost.rpc.access.AccessRpcService"

Variables

View Source
var (
	ErrInvalidLength        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflow          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
)
View Source
var File_github_com_aperturerobotics_bifrost_rpc_access_access_proto protoreflect.FileDescriptor

Functions

func DRPCRegisterAccessRpcService

func DRPCRegisterAccessRpcService(mux drpc.Mux, impl DRPCAccessRpcServiceServer) error

func NewSRPCAccessRpcServiceHandler

func NewSRPCAccessRpcServiceHandler(impl SRPCAccessRpcServiceServer, serviceID string) srpc.Handler

NewSRPCAccessRpcServiceHandler constructs a new RPC handler. serviceID: if empty, uses default: bifrost.rpc.access.AccessRpcService

func SRPCRegisterAccessRpcService

func SRPCRegisterAccessRpcService(mux srpc.Mux, impl SRPCAccessRpcServiceServer) error

SRPCRegisterAccessRpcService registers the implementation with the mux. Uses the default serviceID: bifrost.rpc.access.AccessRpcService

Types

type AccessClientFunc added in v0.9.4

type AccessClientFunc func(
	ctx context.Context,
	cb func(ctx context.Context, client SRPCAccessRpcServiceClient) error,
) error

AccessClientFunc is a function to access the AccessRpcServiceClient. The client should be released after the function returns. If the client is no longer valid, cancel the context.

func NewAccessClientFunc added in v0.9.4

func NewAccessClientFunc(svc SRPCAccessRpcServiceClient) AccessClientFunc

NewAccessClientFunc constructs a AccessClientFunc with a static client.

type AccessRpcServiceServer

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

AccessRpcServiceServer is the server for AccessRpcService. If waitOne is set, waits for at least one value before returning.

func NewAccessRpcServiceServer

func NewAccessRpcServiceServer(b bus.Bus, waitOne bool) *AccessRpcServiceServer

NewAccessRpcServiceServer builds a AccessRpcService server with a bus. If waitOne is set, waits for at least one value before returning.

func (*AccessRpcServiceServer) CallRpcService

CallRpcService looks up the rpc service with the request & invokes the RPC.

func (*AccessRpcServiceServer) LookupRpcService

LookupRpcService looks up the rpc service via the bus.

type ClientController

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

ClientController resolves LookupRpcService with an AccessRpcService client.

func NewClientController

func NewClientController(
	le *logrus.Entry,
	info *controller.Info,
	svc AccessClientFunc,
	serviceIDRe *regexp.Regexp,
	serverIDRe *regexp.Regexp,
	waitAck bool,
	bo backoff.BackOff,
) *ClientController

NewClientController constructs the controller. The regex fields can both be nil to accept any.

if waitAck is set, waits for ack from the remote before starting the proxied rpc. note: usually you do not need waitAck set to true.

if backoff is nil, uses a default backoff for retrying the rpc call.

func (*ClientController) AccessClient added in v0.9.4

func (c *ClientController) AccessClient(
	ctx context.Context,
	cb func(ctx context.Context, client SRPCAccessRpcServiceClient) error,
) error

AccessClient adds a reference to the client and waits for it to be built. Releases the client when the function returns.

func (*ClientController) Close

func (c *ClientController) Close() error

Close releases any resources used by the controller.

func (*ClientController) Execute

func (c *ClientController) Execute(ctx context.Context) error

Execute executes the given controller.

func (*ClientController) GetControllerInfo

func (c *ClientController) GetControllerInfo() *controller.Info

GetControllerInfo returns the controller info.

func (*ClientController) HandleDirective

func (c *ClientController) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)

HandleDirective asks if the handler can resolve the directive.

type DRPCAccessRpcServiceClient

type DRPCAccessRpcServiceClient interface {
	DRPCConn() drpc.Conn

	LookupRpcService(ctx context.Context, in *LookupRpcServiceRequest) (DRPCAccessRpcService_LookupRpcServiceClient, error)
	CallRpcService(ctx context.Context) (DRPCAccessRpcService_CallRpcServiceClient, error)
}

func NewDRPCAccessRpcServiceClient

func NewDRPCAccessRpcServiceClient(cc drpc.Conn) DRPCAccessRpcServiceClient

type DRPCAccessRpcServiceDescription

type DRPCAccessRpcServiceDescription struct{}

func (DRPCAccessRpcServiceDescription) Method

func (DRPCAccessRpcServiceDescription) NumMethods

func (DRPCAccessRpcServiceDescription) NumMethods() int

type DRPCAccessRpcServiceUnimplementedServer

type DRPCAccessRpcServiceUnimplementedServer struct{}

func (*DRPCAccessRpcServiceUnimplementedServer) CallRpcService

type DRPCAccessRpcService_CallRpcServiceClient

type DRPCAccessRpcService_CallRpcServiceClient interface {
	drpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
}

type DRPCAccessRpcService_CallRpcServiceStream

type DRPCAccessRpcService_CallRpcServiceStream interface {
	drpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
}

type DRPCAccessRpcService_LookupRpcServiceClient

type DRPCAccessRpcService_LookupRpcServiceClient interface {
	drpc.Stream
	Recv() (*LookupRpcServiceResponse, error)
}

type DRPCAccessRpcService_LookupRpcServiceStream

type DRPCAccessRpcService_LookupRpcServiceStream interface {
	drpc.Stream
	Send(*LookupRpcServiceResponse) error
}

type LookupRpcServiceRequest

type LookupRpcServiceRequest struct {

	// ServiceId is the service identifier.
	ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"service_id,omitempty"`
	// ServerId is the identifier of the server requesting the service.
	// Can be empty.
	ServerId string `protobuf:"bytes,2,opt,name=server_id,json=serverId,proto3" json:"server_id,omitempty"`
	// contains filtered or unexported fields
}

LookupRpcServiceRequest is a request to lookup an rpc service.

func NewLookupRpcServiceRequest

func NewLookupRpcServiceRequest(serviceID, serverID string) *LookupRpcServiceRequest

NewLookupRpcServiceRequest constructs a new LookupRpcServiceRequest.

func RequestFromDirective

func RequestFromDirective(dir bifrost_rpc.LookupRpcService) *LookupRpcServiceRequest

RequestFromDirective converts a LookupRpcService directive to a request.

func (*LookupRpcServiceRequest) CloneGenericVT

func (m *LookupRpcServiceRequest) CloneGenericVT() proto.Message

func (*LookupRpcServiceRequest) CloneVT

func (*LookupRpcServiceRequest) Descriptor deprecated

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

Deprecated: Use LookupRpcServiceRequest.ProtoReflect.Descriptor instead.

func (*LookupRpcServiceRequest) EqualVT

func (*LookupRpcServiceRequest) GetServerId

func (x *LookupRpcServiceRequest) GetServerId() string

func (*LookupRpcServiceRequest) GetServiceId

func (x *LookupRpcServiceRequest) GetServiceId() string

func (*LookupRpcServiceRequest) MarshalComponentID

func (r *LookupRpcServiceRequest) MarshalComponentID() (string, error)

MarshalComponentID marshals the b58 component ID.

func (*LookupRpcServiceRequest) MarshalToSizedBufferVT

func (m *LookupRpcServiceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*LookupRpcServiceRequest) MarshalToVT

func (m *LookupRpcServiceRequest) MarshalToVT(dAtA []byte) (int, error)

func (*LookupRpcServiceRequest) MarshalVT

func (m *LookupRpcServiceRequest) MarshalVT() (dAtA []byte, err error)

func (*LookupRpcServiceRequest) ProtoMessage

func (*LookupRpcServiceRequest) ProtoMessage()

func (*LookupRpcServiceRequest) ProtoReflect

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

func (*LookupRpcServiceRequest) Reset

func (x *LookupRpcServiceRequest) Reset()

func (*LookupRpcServiceRequest) SizeVT

func (m *LookupRpcServiceRequest) SizeVT() (n int)

func (*LookupRpcServiceRequest) String

func (x *LookupRpcServiceRequest) String() string

func (*LookupRpcServiceRequest) ToDirective

ToDirective converts the request to a directive.

func (*LookupRpcServiceRequest) UnmarshalComponentID

func (r *LookupRpcServiceRequest) UnmarshalComponentID(componentID string) error

UnmarshalComponentID unmarshals the component ID.

func (*LookupRpcServiceRequest) UnmarshalVT

func (m *LookupRpcServiceRequest) UnmarshalVT(dAtA []byte) error

func (*LookupRpcServiceRequest) Validate

func (r *LookupRpcServiceRequest) Validate() error

Validate validates the LookupRpcServiceRequest.

type LookupRpcServiceResolver

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

LookupRpcServiceResolver resolves a LookupRpcService directive with a RPC service.

func NewLookupRpcServiceResolver

func NewLookupRpcServiceResolver(
	dir bifrost_rpc.LookupRpcService,
	svc AccessClientFunc,
	waitAck bool,
) *LookupRpcServiceResolver

NewLookupRpcServiceResolver constructs the directive resolver.

if waitAck is set, waits for ack from the remote before starting the proxied rpc. note: usually you do not need waitAck set to true.

func (*LookupRpcServiceResolver) Resolve

Resolve resolves the values, emitting them to the handler.

type LookupRpcServiceResponse

type LookupRpcServiceResponse struct {

	// Idle indicates the directive is now idle.
	Idle bool `protobuf:"varint,1,opt,name=idle,proto3" json:"idle,omitempty"`
	// Exists indicates we found the service on the remote.
	Exists bool `protobuf:"varint,2,opt,name=exists,proto3" json:"exists,omitempty"`
	// Removed indicates the value no longer exists.
	Removed bool `protobuf:"varint,3,opt,name=removed,proto3" json:"removed,omitempty"`
	// contains filtered or unexported fields
}

LookupRpcServiceResponse is a response to LookupRpcService

func (*LookupRpcServiceResponse) CloneGenericVT

func (m *LookupRpcServiceResponse) CloneGenericVT() proto.Message

func (*LookupRpcServiceResponse) CloneVT

func (*LookupRpcServiceResponse) Descriptor deprecated

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

Deprecated: Use LookupRpcServiceResponse.ProtoReflect.Descriptor instead.

func (*LookupRpcServiceResponse) EqualVT

func (*LookupRpcServiceResponse) GetExists

func (x *LookupRpcServiceResponse) GetExists() bool

func (*LookupRpcServiceResponse) GetIdle

func (x *LookupRpcServiceResponse) GetIdle() bool

func (*LookupRpcServiceResponse) GetRemoved

func (x *LookupRpcServiceResponse) GetRemoved() bool

func (*LookupRpcServiceResponse) MarshalToSizedBufferVT

func (m *LookupRpcServiceResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*LookupRpcServiceResponse) MarshalToVT

func (m *LookupRpcServiceResponse) MarshalToVT(dAtA []byte) (int, error)

func (*LookupRpcServiceResponse) MarshalVT

func (m *LookupRpcServiceResponse) MarshalVT() (dAtA []byte, err error)

func (*LookupRpcServiceResponse) ProtoMessage

func (*LookupRpcServiceResponse) ProtoMessage()

func (*LookupRpcServiceResponse) ProtoReflect

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

func (*LookupRpcServiceResponse) Reset

func (x *LookupRpcServiceResponse) Reset()

func (*LookupRpcServiceResponse) SizeVT

func (m *LookupRpcServiceResponse) SizeVT() (n int)

func (*LookupRpcServiceResponse) String

func (x *LookupRpcServiceResponse) String() string

func (*LookupRpcServiceResponse) UnmarshalVT

func (m *LookupRpcServiceResponse) UnmarshalVT(dAtA []byte) error

type ProxyInvoker

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

ProxyInvoker is an srpc.Invoker that invokes via the proxy client.

func NewProxyInvoker

func NewProxyInvoker(client SRPCAccessRpcServiceClient, req *LookupRpcServiceRequest, waitAck bool) *ProxyInvoker

NewProxyInvoker constructs a new srpc.Invoker with a client and request.

if waitAck is set, waits for ack from the remote before starting the proxied rpc. note: usually you do not need waitAck set to true.

func (*ProxyInvoker) InvokeMethod

func (r *ProxyInvoker) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)

InvokeMethod invokes the method matching the service & method ID. Returns false, nil if not found. If service string is empty, ignore it.

type SRPCAccessRpcServiceClient

type SRPCAccessRpcServiceClient interface {
	SRPCClient() srpc.Client

	LookupRpcService(ctx context.Context, in *LookupRpcServiceRequest) (SRPCAccessRpcService_LookupRpcServiceClient, error)
	CallRpcService(ctx context.Context) (SRPCAccessRpcService_CallRpcServiceClient, error)
}

func NewSRPCAccessRpcServiceClient

func NewSRPCAccessRpcServiceClient(cc srpc.Client) SRPCAccessRpcServiceClient

func NewSRPCAccessRpcServiceClientWithServiceID

func NewSRPCAccessRpcServiceClientWithServiceID(cc srpc.Client, serviceID string) SRPCAccessRpcServiceClient

type SRPCAccessRpcServiceHandler

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

func (SRPCAccessRpcServiceHandler) GetMethodIDs

func (SRPCAccessRpcServiceHandler) GetMethodIDs() []string

func (*SRPCAccessRpcServiceHandler) GetServiceID

func (d *SRPCAccessRpcServiceHandler) GetServiceID() string

func (*SRPCAccessRpcServiceHandler) InvokeMethod

func (d *SRPCAccessRpcServiceHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCAccessRpcServiceHandler) InvokeMethod_CallRpcService

func (SRPCAccessRpcServiceHandler) InvokeMethod_CallRpcService(impl SRPCAccessRpcServiceServer, strm srpc.Stream) error

func (SRPCAccessRpcServiceHandler) InvokeMethod_LookupRpcService

func (SRPCAccessRpcServiceHandler) InvokeMethod_LookupRpcService(impl SRPCAccessRpcServiceServer, strm srpc.Stream) error

type SRPCAccessRpcServiceUnimplementedServer

type SRPCAccessRpcServiceUnimplementedServer struct{}

func (*SRPCAccessRpcServiceUnimplementedServer) CallRpcService

type SRPCAccessRpcService_CallRpcServiceClient

type SRPCAccessRpcService_CallRpcServiceClient interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
	RecvTo(*rpcstream.RpcStreamPacket) error
}

type SRPCAccessRpcService_CallRpcServiceStream

type SRPCAccessRpcService_CallRpcServiceStream interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	SendAndClose(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
}

type SRPCAccessRpcService_LookupRpcServiceClient

type SRPCAccessRpcService_LookupRpcServiceClient interface {
	srpc.Stream
	Recv() (*LookupRpcServiceResponse, error)
	RecvTo(*LookupRpcServiceResponse) error
}

type SRPCAccessRpcService_LookupRpcServiceStream

type SRPCAccessRpcService_LookupRpcServiceStream interface {
	srpc.Stream
	Send(*LookupRpcServiceResponse) error
	SendAndClose(*LookupRpcServiceResponse) error
}

Jump to

Keyboard shortcuts

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