Documentation ¶
Index ¶
- Constants
- func NewSRPCAccessRpcServiceHandler(impl SRPCAccessRpcServiceServer, serviceID string) srpc.Handler
- func SRPCRegisterAccessRpcService(mux srpc.Mux, impl SRPCAccessRpcServiceServer) error
- type AccessClientFunc
- type AccessRpcServiceServer
- type ClientController
- func (c *ClientController) AccessClient(ctx context.Context, released func()) (SRPCAccessRpcServiceClient, func(), error)
- func (c *ClientController) Close() error
- func (c *ClientController) Execute(ctx context.Context) error
- func (c *ClientController) GetControllerInfo() *controller.Info
- func (c *ClientController) HandleDirective(ctx context.Context, di directive.Instance) ([]directive.Resolver, error)
- type LookupRpcServiceRequest
- func (m *LookupRpcServiceRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *LookupRpcServiceRequest) CloneVT() *LookupRpcServiceRequest
- func (this *LookupRpcServiceRequest) EqualMessageVT(thatMsg any) bool
- func (this *LookupRpcServiceRequest) EqualVT(that *LookupRpcServiceRequest) bool
- func (x *LookupRpcServiceRequest) GetServerId() string
- func (x *LookupRpcServiceRequest) GetServiceId() string
- func (r *LookupRpcServiceRequest) MarshalComponentID() (string, error)
- func (x *LookupRpcServiceRequest) MarshalJSON() ([]byte, error)
- func (x *LookupRpcServiceRequest) MarshalProtoJSON(s *json.MarshalState)
- func (x *LookupRpcServiceRequest) MarshalProtoText() string
- func (m *LookupRpcServiceRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *LookupRpcServiceRequest) MarshalToVT(dAtA []byte) (int, error)
- func (m *LookupRpcServiceRequest) MarshalVT() (dAtA []byte, err error)
- func (*LookupRpcServiceRequest) ProtoMessage()
- func (x *LookupRpcServiceRequest) Reset()
- func (m *LookupRpcServiceRequest) SizeVT() (n int)
- func (x *LookupRpcServiceRequest) String() string
- func (r *LookupRpcServiceRequest) ToDirective() bifrost_rpc.LookupRpcService
- func (r *LookupRpcServiceRequest) UnmarshalComponentID(componentID string) error
- func (x *LookupRpcServiceRequest) UnmarshalJSON(b []byte) error
- func (x *LookupRpcServiceRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *LookupRpcServiceRequest) UnmarshalVT(dAtA []byte) error
- func (r *LookupRpcServiceRequest) Validate() error
- type LookupRpcServiceResolver
- type LookupRpcServiceResponse
- func (m *LookupRpcServiceResponse) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *LookupRpcServiceResponse) CloneVT() *LookupRpcServiceResponse
- func (this *LookupRpcServiceResponse) EqualMessageVT(thatMsg any) bool
- func (this *LookupRpcServiceResponse) EqualVT(that *LookupRpcServiceResponse) bool
- func (x *LookupRpcServiceResponse) GetExists() bool
- func (x *LookupRpcServiceResponse) GetIdle() bool
- func (x *LookupRpcServiceResponse) GetRemoved() bool
- func (x *LookupRpcServiceResponse) MarshalJSON() ([]byte, error)
- func (x *LookupRpcServiceResponse) MarshalProtoJSON(s *json.MarshalState)
- func (x *LookupRpcServiceResponse) MarshalProtoText() string
- func (m *LookupRpcServiceResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *LookupRpcServiceResponse) MarshalToVT(dAtA []byte) (int, error)
- func (m *LookupRpcServiceResponse) MarshalVT() (dAtA []byte, err error)
- func (*LookupRpcServiceResponse) ProtoMessage()
- func (x *LookupRpcServiceResponse) Reset()
- func (m *LookupRpcServiceResponse) SizeVT() (n int)
- func (x *LookupRpcServiceResponse) String() string
- func (x *LookupRpcServiceResponse) UnmarshalJSON(b []byte) error
- func (x *LookupRpcServiceResponse) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *LookupRpcServiceResponse) UnmarshalVT(dAtA []byte) error
- type ProxyInvoker
- type SRPCAccessRpcServiceClient
- type SRPCAccessRpcServiceHandler
- func (SRPCAccessRpcServiceHandler) GetMethodIDs() []string
- func (d *SRPCAccessRpcServiceHandler) GetServiceID() string
- func (d *SRPCAccessRpcServiceHandler) InvokeMethod(serviceID, methodID string, strm srpc.Stream) (bool, error)
- func (SRPCAccessRpcServiceHandler) InvokeMethod_CallRpcService(impl SRPCAccessRpcServiceServer, strm srpc.Stream) error
- func (SRPCAccessRpcServiceHandler) InvokeMethod_LookupRpcService(impl SRPCAccessRpcServiceServer, strm srpc.Stream) error
- type SRPCAccessRpcServiceServer
- type SRPCAccessRpcService_CallRpcServiceClient
- type SRPCAccessRpcService_CallRpcServiceStream
- type SRPCAccessRpcService_LookupRpcServiceClient
- type SRPCAccessRpcService_LookupRpcServiceStream
Constants ¶
const SRPCAccessRpcServiceServiceID = "bifrost.rpc.access.AccessRpcService"
Variables ¶
This section is empty.
Functions ¶
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, released func(), ) (SRPCAccessRpcServiceClient, func(), error)
AccessClientFunc is a function to access the AccessRpcServiceClient. The client should be released after the function returns. Released is a function to call when the value is no longer valid. Returns a release function. If the client is nil, an err must be returned.
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, serverIdCb func(remoteServerID string) (string, error), ) *AccessRpcServiceServer
NewAccessRpcServiceServer builds a AccessRpcService server with a bus. If waitOne is set, waits for at least one value before returning. serverIdCb is an optional callback to override the ServerID.
func (*AccessRpcServiceServer) CallRpcService ¶
func (s *AccessRpcServiceServer) CallRpcService(strm SRPCAccessRpcService_CallRpcServiceStream) error
CallRpcService looks up the rpc service with the request & invokes the RPC.
func (*AccessRpcServiceServer) LookupRpcService ¶
func (s *AccessRpcServiceServer) LookupRpcService( req *LookupRpcServiceRequest, strm SRPCAccessRpcService_LookupRpcServiceStream, ) error
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, released func(), ) (SRPCAccessRpcServiceClient, func(), error)
AccessClient adds a reference to the client and waits for it to be built. The released function will be called if the value was released.
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 controller goroutine.
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 LookupRpcServiceRequest ¶
type LookupRpcServiceRequest struct { // ServiceId is the service identifier. ServiceId string `protobuf:"bytes,1,opt,name=service_id,json=serviceId,proto3" json:"serviceId,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:"serverId,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) CloneMessageVT ¶ added in v0.15.6
func (m *LookupRpcServiceRequest) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*LookupRpcServiceRequest) CloneVT ¶
func (m *LookupRpcServiceRequest) CloneVT() *LookupRpcServiceRequest
func (*LookupRpcServiceRequest) EqualMessageVT ¶ added in v0.15.6
func (this *LookupRpcServiceRequest) EqualMessageVT(thatMsg any) bool
func (*LookupRpcServiceRequest) EqualVT ¶
func (this *LookupRpcServiceRequest) EqualVT(that *LookupRpcServiceRequest) bool
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) MarshalJSON ¶ added in v0.29.0
func (x *LookupRpcServiceRequest) MarshalJSON() ([]byte, error)
MarshalJSON marshals the LookupRpcServiceRequest to JSON.
func (*LookupRpcServiceRequest) MarshalProtoJSON ¶ added in v0.29.0
func (x *LookupRpcServiceRequest) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the LookupRpcServiceRequest message to JSON.
func (*LookupRpcServiceRequest) MarshalProtoText ¶ added in v0.29.2
func (x *LookupRpcServiceRequest) MarshalProtoText() string
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) 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 ¶
func (r *LookupRpcServiceRequest) ToDirective() bifrost_rpc.LookupRpcService
ToDirective converts the request to a directive.
func (*LookupRpcServiceRequest) UnmarshalComponentID ¶
func (r *LookupRpcServiceRequest) UnmarshalComponentID(componentID string) error
UnmarshalComponentID unmarshals the component ID.
func (*LookupRpcServiceRequest) UnmarshalJSON ¶ added in v0.29.0
func (x *LookupRpcServiceRequest) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the LookupRpcServiceRequest from JSON.
func (*LookupRpcServiceRequest) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *LookupRpcServiceRequest) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the LookupRpcServiceRequest message from JSON.
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 ¶
func (r *LookupRpcServiceResolver) Resolve(ctx context.Context, handler directive.ResolverHandler) error
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) CloneMessageVT ¶ added in v0.15.6
func (m *LookupRpcServiceResponse) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*LookupRpcServiceResponse) CloneVT ¶
func (m *LookupRpcServiceResponse) CloneVT() *LookupRpcServiceResponse
func (*LookupRpcServiceResponse) EqualMessageVT ¶ added in v0.15.6
func (this *LookupRpcServiceResponse) EqualMessageVT(thatMsg any) bool
func (*LookupRpcServiceResponse) EqualVT ¶
func (this *LookupRpcServiceResponse) EqualVT(that *LookupRpcServiceResponse) bool
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) MarshalJSON ¶ added in v0.29.0
func (x *LookupRpcServiceResponse) MarshalJSON() ([]byte, error)
MarshalJSON marshals the LookupRpcServiceResponse to JSON.
func (*LookupRpcServiceResponse) MarshalProtoJSON ¶ added in v0.29.0
func (x *LookupRpcServiceResponse) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the LookupRpcServiceResponse message to JSON.
func (*LookupRpcServiceResponse) MarshalProtoText ¶ added in v0.29.2
func (x *LookupRpcServiceResponse) MarshalProtoText() string
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) Reset ¶
func (x *LookupRpcServiceResponse) Reset()
func (*LookupRpcServiceResponse) SizeVT ¶
func (m *LookupRpcServiceResponse) SizeVT() (n int)
func (*LookupRpcServiceResponse) String ¶
func (x *LookupRpcServiceResponse) String() string
func (*LookupRpcServiceResponse) UnmarshalJSON ¶ added in v0.29.0
func (x *LookupRpcServiceResponse) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the LookupRpcServiceResponse from JSON.
func (*LookupRpcServiceResponse) UnmarshalProtoJSON ¶ added in v0.29.0
func (x *LookupRpcServiceResponse) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the LookupRpcServiceResponse message from JSON.
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 ¶
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 returns the underlying SRPC client. SRPCClient() srpc.Client // LookupRpcService checks if a RPC service exists with the given info. // Usually translates to accessing the LookupRpcService directive. // If the service was not found (directive is idle) returns empty. LookupRpcService(ctx context.Context, in *LookupRpcServiceRequest) (SRPCAccessRpcService_LookupRpcServiceClient, error) // CallRpcService forwards an RPC call to the service with the component ID. // Component ID: json encoded LookupRpcServiceRequest. 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 (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 SRPCAccessRpcServiceServer ¶
type SRPCAccessRpcServiceServer interface { // LookupRpcService checks if a RPC service exists with the given info. // Usually translates to accessing the LookupRpcService directive. // If the service was not found (directive is idle) returns empty. LookupRpcService(*LookupRpcServiceRequest, SRPCAccessRpcService_LookupRpcServiceStream) error // CallRpcService forwards an RPC call to the service with the component ID. // Component ID: json encoded LookupRpcServiceRequest. CallRpcService(SRPCAccessRpcService_CallRpcServiceStream) error }
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) RecvTo(*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 }