Documentation ¶
Overview ¶
Package backend is a reverse proxy.
It translates gRPC into RESTful JSON APIs.
Index ¶
- Constants
- Variables
- func RegisterBackendHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
- func RegisterBackendHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackendClient) error
- func RegisterBackendHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, ...) (err error)
- func RegisterBackendHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BackendServer) error
- func RegisterBackendServer(s grpc.ServiceRegistrar, srv BackendServer)
- type BackendClient
- type BackendServer
- type StatusRequest
- type StatusResponse
- func (*StatusResponse) Descriptor() ([]byte, []int)deprecated
- func (x *StatusResponse) GetService() string
- func (x *StatusResponse) GetStatus() string
- func (x *StatusResponse) GetTimestamp() *timestamppb.Timestamp
- func (x *StatusResponse) GetVersion() string
- func (*StatusResponse) ProtoMessage()
- func (x *StatusResponse) ProtoReflect() protoreflect.Message
- func (x *StatusResponse) Reset()
- func (x *StatusResponse) String() string
- type UnimplementedBackendServer
- type UnsafeBackendServer
Constants ¶
const (
Backend_GetStatus_FullMethodName = "/com.skriptvalley.keyhouse.Backend/GetStatus"
)
Variables ¶
var Backend_ServiceDesc = grpc.ServiceDesc{ ServiceName: "com.skriptvalley.keyhouse.Backend", HandlerType: (*BackendServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "GetStatus", Handler: _Backend_GetStatus_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "backend.proto", }
Backend_ServiceDesc is the grpc.ServiceDesc for Backend service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
var File_backend_proto protoreflect.FileDescriptor
Functions ¶
func RegisterBackendHandler ¶
func RegisterBackendHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error
RegisterBackendHandler registers the http handlers for service Backend to "mux". The handlers forward requests to the grpc endpoint over "conn".
func RegisterBackendHandlerClient ¶
func RegisterBackendHandlerClient(ctx context.Context, mux *runtime.ServeMux, client BackendClient) error
RegisterBackendHandlerClient registers the http handlers for service Backend to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "BackendClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "BackendClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "BackendClient" to call the correct interceptors. This client ignores the HTTP middlewares.
func RegisterBackendHandlerFromEndpoint ¶
func RegisterBackendHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)
RegisterBackendHandlerFromEndpoint is same as RegisterBackendHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.
func RegisterBackendHandlerServer ¶
func RegisterBackendHandlerServer(ctx context.Context, mux *runtime.ServeMux, server BackendServer) error
RegisterBackendHandlerServer registers the http handlers for service Backend to "mux". UnaryRPC :call BackendServer 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 RegisterBackendHandlerFromEndpoint instead. GRPC interceptors will not work for this type of registration. To use interceptors, you must use the "runtime.WithMiddlewares" option in the "runtime.NewServeMux" call.
func RegisterBackendServer ¶
func RegisterBackendServer(s grpc.ServiceRegistrar, srv BackendServer)
Types ¶
type BackendClient ¶
type BackendClient interface { // GetStatus RPC // Returns the current status of the Keyhouse service GetStatus(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error) }
BackendClient is the client API for Backend 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.
Keyhouse service definition
func NewBackendClient ¶
func NewBackendClient(cc grpc.ClientConnInterface) BackendClient
type BackendServer ¶
type BackendServer interface { // GetStatus RPC // Returns the current status of the Keyhouse service GetStatus(context.Context, *StatusRequest) (*StatusResponse, error) // contains filtered or unexported methods }
BackendServer is the server API for Backend service. All implementations must embed UnimplementedBackendServer for forward compatibility.
Keyhouse service definition
type StatusRequest ¶
type StatusRequest struct {
// contains filtered or unexported fields
}
Request message for GetStatus
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 { // Name of the service Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"` // Version of the service Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // Current status of the service (e.g., "OK", "ERROR") Status string `protobuf:"bytes,3,opt,name=status,proto3" json:"status,omitempty"` // Timestamp when the status was retrieved Timestamp *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"` // contains filtered or unexported fields }
Response message for GetStatus
func (*StatusResponse) Descriptor
deprecated
func (*StatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
func (*StatusResponse) GetService ¶
func (x *StatusResponse) GetService() string
func (*StatusResponse) GetStatus ¶
func (x *StatusResponse) GetStatus() string
func (*StatusResponse) GetTimestamp ¶
func (x *StatusResponse) GetTimestamp() *timestamppb.Timestamp
func (*StatusResponse) GetVersion ¶
func (x *StatusResponse) GetVersion() string
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 UnimplementedBackendServer ¶
type UnimplementedBackendServer struct{}
UnimplementedBackendServer must be embedded to have forward compatible implementations.
NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.
func (UnimplementedBackendServer) GetStatus ¶
func (UnimplementedBackendServer) GetStatus(context.Context, *StatusRequest) (*StatusResponse, error)
type UnsafeBackendServer ¶
type UnsafeBackendServer interface {
// contains filtered or unexported methods
}
UnsafeBackendServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to BackendServer will result in compilation errors.