Documentation ¶
Index ¶
- Variables
- func ContextValuesToGRPCMetadata(keys []string) grpctransport.ClientRequestFunc
- func CtxValuesToSend(keys ...string) httptransport.ClientOption
- func DecodeGRPCStatusRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCStatusResponse(_ context.Context, grpcReply interface{}) (interface{}, error)
- func DecodeHTTPStatusResponse(_ context.Context, r *http.Response) (interface{}, error)
- func DecodeHTTPStatusZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeNATSStatusRequest(ctx context.Context, msg *nats.Msg) (interface{}, error)
- func DecodeNATSStatusResponse(ctx context.Context, msg *nats.Msg) (interface{}, error)
- func EncodeGRPCStatusRequest(_ context.Context, request interface{}) (interface{}, error)
- func EncodeGRPCStatusResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func EncodeHTTPStatusZeroRequest(_ context.Context, r *http.Request, request interface{}) error
- func EncodeNATSGenericRequest(ctx context.Context, msg *nats.Msg, request interface{}) error
- func EncodeNATSGenericResponse(ctx context.Context, reply string, nc *nats.Conn, response interface{}) error
- func GRPCMetadataToContext(ctx context.Context, md metadata.MD) context.Context
- func HTTPHeadersToContext(ctx context.Context, r *http.Request) context.Context
- func MakeHTTPHandler(endpoints Endpoints, options ...httptransport.ServerOption) http.Handler
- func MakeNATSServer(endpoints Endpoints, options ...natstransport.SubscriberOption) *natsServer
- func MakeStatusEndpoint(s StartServer) endpoint.Endpoint
- func RegisterStartServer(s grpc.ServiceRegistrar, srv StartServer)
- func ServeNATS(conn *nats.Conn, srv *natsServer) error
- type Endpoints
- type LabeledMiddleware
- type ServiceStatus
- func (ServiceStatus) Descriptor() protoreflect.EnumDescriptor
- func (x ServiceStatus) Enum() *ServiceStatus
- func (ServiceStatus) EnumDescriptor() ([]byte, []int)deprecated
- func (x ServiceStatus) Number() protoreflect.EnumNumber
- func (x ServiceStatus) String() string
- func (ServiceStatus) Type() protoreflect.EnumType
- type StartClient
- type StartServer
- func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) StartServer
- func NewGRPCClient(conn *grpc.ClientConn, options ...grpctransport.ClientOption) (StartServer, error)
- func NewHTTPClient(instance string, options ...httptransport.ClientOption) (StartServer, error)
- func NewNATSClient(conn *nats.Conn, options ...natstransport.PublisherOption) (StartServer, error)
- type StatusRequest
- func (*StatusRequest) Descriptor() ([]byte, []int)deprecated
- func (x *StatusRequest) GetFull() bool
- func (x *StatusRequest) GetMsg() string
- func (*StatusRequest) ProtoMessage()
- func (x *StatusRequest) ProtoReflect() protoreflect.Message
- func (x *StatusRequest) Reset()
- func (x *StatusRequest) String() string
- type StatusResponse
- type UnimplementedStartServer
- type UnsafeStartServer
Constants ¶
This section is empty.
Variables ¶
var ( ServiceStatus_name = map[int32]string{ 0: "FAIL", 1: "OK", } ServiceStatus_value = map[string]int32{ "FAIL": 0, "OK": 1, } )
Enum value maps for ServiceStatus.
var File_start_proto protoreflect.FileDescriptor
Functions ¶
func ContextValuesToGRPCMetadata ¶
func ContextValuesToGRPCMetadata(keys []string) grpctransport.ClientRequestFunc
ContextValuesToGRPCMetadata is a grpctransport.ClientRequestFunc
func CtxValuesToSend ¶
func CtxValuesToSend(keys ...string) httptransport.ClientOption
CtxValuesToSend configures the http client to pull the specified keys out of the context and add them to the http request as headers. Note that keys will have net/http.CanonicalHeaderKey called on them before being send over the wire and that is the form they will be available in the server context.
func DecodeGRPCStatusRequest ¶
DecodeGRPCStatusRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC status request to a user-domain status request. Primarily useful in a server.
func DecodeGRPCStatusResponse ¶
DecodeGRPCStatusResponse is a transport/grpc.DecodeResponseFunc that converts a gRPC status reply to a user-domain status response. Primarily useful in a client.
func DecodeHTTPStatusResponse ¶
DecodeHTTPStatusResponse is a transport/http.DecodeResponseFunc that decodes a JSON-encoded StatusResponse response from the HTTP response body. If the response has a non-200 status code, we will interpret that as an error and attempt to decode the specific error message from the response body. Primarily useful in a client.
func DecodeHTTPStatusZeroRequest ¶
DecodeHTTPStatusZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded status request from the HTTP request body. Primarily useful in a server.
func DecodeNATSStatusRequest ¶
func DecodeNATSStatusResponse ¶
DecodeNATSStatusResponse is a transport/nats.DecodeResponseFunc that converts a nats.Msg to a user-domain status response. Primarily useful in a client.
func EncodeGRPCStatusRequest ¶
EncodeGRPCStatusRequest is a transport/grpc.EncodeRequestFunc that converts a user-domain status request to a gRPC status request. Primarily useful in a client.
func EncodeGRPCStatusResponse ¶
EncodeGRPCStatusResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain status response to a gRPC status reply. Primarily useful in a server.
func EncodeHTTPGenericResponse ¶
func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
EncodeHTTPGenericResponse is a transport/http.EncodeResponseFunc that encodes the response as JSON to the response writer. Primarily useful in a server.
func EncodeHTTPStatusZeroRequest ¶
EncodeHTTPStatusZeroRequest is a transport/http.EncodeRequestFunc that encodes a status request into the various portions of the http request (path, query, and body).
func EncodeNATSGenericRequest ¶
NATS Client Encode EncodeNATSGenericRequest is a transport/nats.EncodeRequestFunc that serializes the request as a JSON object to the Data of the Msg. Many JSON-over-NATS services can use it as a sensible default.
func EncodeNATSGenericResponse ¶
func EncodeNATSGenericResponse(ctx context.Context, reply string, nc *nats.Conn, response interface{}) error
EncodeNATSGenericResponse is a transport/nats.EncodeResponseFunc that encodes JSON object to the subscriber reply. Many JSON-over services can use it as a sensible default.
func GRPCMetadataToContext ¶
func HTTPHeadersToContext ¶
func MakeHTTPHandler ¶
func MakeHTTPHandler(endpoints Endpoints, options ...httptransport.ServerOption) http.Handler
MakeHTTPHandler returns a handler that makes a set of endpoints available on predefined paths.
func MakeNATSServer ¶
func MakeNATSServer(endpoints Endpoints, options ...natstransport.SubscriberOption) *natsServer
MakeNATSServer makes a set of endpoints available as a NATS StartServer.
func MakeStatusEndpoint ¶
func MakeStatusEndpoint(s StartServer) endpoint.Endpoint
func RegisterStartServer ¶
func RegisterStartServer(s grpc.ServiceRegistrar, srv StartServer)
Types ¶
type Endpoints ¶
type Endpoints struct { UnimplementedStartServer StatusEndpoint endpoint.Endpoint }
In a server, it's useful for functions that need to operate on a per-endpoint basis. For example, you might pass an Endpoints to a function that produces an http.Handler, with each method (endpoint) wired up to a specific path. (It is probably a mistake in design to invoke the Service methods on the Endpoints struct in a server.)
In a client, it's useful to collect individually constructed endpoints into a single type that implements the Service interface. For example, you might construct individual endpoints using transport/http.NewClient, combine them into an Endpoints, and return it to the caller as a Service.
func (Endpoints) Status ¶
func (e Endpoints) Status(ctx context.Context, in *StatusRequest) (*StatusResponse, error)
func (*Endpoints) WrapAllExcept ¶
func (e *Endpoints) WrapAllExcept(middleware endpoint.Middleware, excluded ...string)
WrapAllExcept wraps each Endpoint field of struct Endpoints with a go-kit/kit/endpoint.Middleware. Use this for applying a set of middlewares to every endpoint in the service. Optionally, endpoints can be passed in by name to be excluded from being wrapped. WrapAllExcept(middleware, "Status", "Ping")
func (*Endpoints) WrapAllLabeledExcept ¶
func (e *Endpoints) WrapAllLabeledExcept(middleware func(string, endpoint.Endpoint) endpoint.Endpoint, excluded ...string)
WrapAllLabeledExcept wraps each Endpoint field of struct Endpoints with a LabeledMiddleware, which will receive the name of the endpoint. See LabeldMiddleware. See method WrapAllExept for details on excluded functionality.
type LabeledMiddleware ¶
LabeledMiddleware will get passed the endpoint name when passed to WrapAllLabeledExcept, this can be used to write a generic metrics middleware which can send the endpoint name to the metrics collector.
type ServiceStatus ¶
type ServiceStatus int32
const ( ServiceStatus_FAIL ServiceStatus = 0 ServiceStatus_OK ServiceStatus = 1 )
func (ServiceStatus) Descriptor ¶
func (ServiceStatus) Descriptor() protoreflect.EnumDescriptor
func (ServiceStatus) Enum ¶
func (x ServiceStatus) Enum() *ServiceStatus
func (ServiceStatus) EnumDescriptor
deprecated
func (ServiceStatus) EnumDescriptor() ([]byte, []int)
Deprecated: Use ServiceStatus.Descriptor instead.
func (ServiceStatus) Number ¶
func (x ServiceStatus) Number() protoreflect.EnumNumber
func (ServiceStatus) String ¶
func (x ServiceStatus) String() string
func (ServiceStatus) Type ¶
func (ServiceStatus) Type() protoreflect.EnumType
type StartClient ¶
type StartClient interface {
Status(ctx context.Context, in *StatusRequest, opts ...grpc.CallOption) (*StatusResponse, error)
}
StartClient is the client API for Start 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 NewStartClient ¶
func NewStartClient(cc grpc.ClientConnInterface) StartClient
type StartServer ¶
type StartServer interface { Status(context.Context, *StatusRequest) (*StatusResponse, error) // contains filtered or unexported methods }
StartServer is the server API for Start service. All implementations must embed UnimplementedStartServer for forward compatibility
func MakeGRPCServer ¶
func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) StartServer
MakeGRPCServer makes a set of endpoints available as a gRPC StartServer.
func NewGRPCClient ¶
func NewGRPCClient(conn *grpc.ClientConn, options ...grpctransport.ClientOption) (StartServer, error)
NewGRPCClient returns an service backed by a gRPC client connection. It is the responsibility of the caller to dial, and later close, the connection.
func NewHTTPClient ¶
func NewHTTPClient(instance string, options ...httptransport.ClientOption) (StartServer, error)
NewHTTPClient returns a service backed by an HTTP server living at the remote instance. We expect instance to come from a service discovery system, so likely of the form "host:port".
func NewNATSClient ¶
func NewNATSClient(conn *nats.Conn, options ...natstransport.PublisherOption) (StartServer, error)
NewNATSClient returns an service backed by a nats client connection. It is the responsibility of the caller to dial, and later close, the connection.
type StatusRequest ¶
type StatusRequest struct { Full bool `protobuf:"varint,1,opt,name=full,proto3" json:"full,omitempty"` Msg *string `protobuf:"bytes,2,opt,name=msg,proto3,oneof" json:"msg,omitempty"` // contains filtered or unexported fields }
func (*StatusRequest) Descriptor
deprecated
func (*StatusRequest) Descriptor() ([]byte, []int)
Deprecated: Use StatusRequest.ProtoReflect.Descriptor instead.
func (*StatusRequest) GetFull ¶
func (x *StatusRequest) GetFull() bool
func (*StatusRequest) GetMsg ¶
func (x *StatusRequest) GetMsg() string
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 { Status ServiceStatus `protobuf:"varint,1,opt,name=status,proto3,enum=start.ServiceStatus" json:"status,omitempty"` // contains filtered or unexported fields }
func (*StatusResponse) Descriptor
deprecated
func (*StatusResponse) Descriptor() ([]byte, []int)
Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.
func (*StatusResponse) GetStatus ¶
func (x *StatusResponse) GetStatus() ServiceStatus
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 UnimplementedStartServer ¶
type UnimplementedStartServer struct { }
UnimplementedStartServer must be embedded to have forward compatible implementations.
func (UnimplementedStartServer) Status ¶
func (UnimplementedStartServer) Status(context.Context, *StatusRequest) (*StatusResponse, error)
type UnsafeStartServer ¶
type UnsafeStartServer interface {
// contains filtered or unexported methods
}
UnsafeStartServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to StartServer will result in compilation errors.