Documentation ¶
Index ¶
- func DecodeGRPCPingRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCSubmitMultipleRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeGRPCSubmitSingleRequest(_ context.Context, grpcReq interface{}) (interface{}, error)
- func DecodeHTTPPingZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPSubmitMultipleZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func DecodeHTTPSubmitSingleZeroRequest(_ context.Context, r *http.Request) (interface{}, error)
- func EncodeGRPCPingResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeGRPCSubmitMultipleResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeGRPCSubmitSingleResponse(_ context.Context, response interface{}) (interface{}, error)
- func EncodeHTTPGenericResponse(_ context.Context, w http.ResponseWriter, response interface{}) error
- func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) pb.LogServiceServer
- func MakeHTTPHandler(endpoints Endpoints, options ...httptransport.ServerOption) http.Handler
- func MakePingEndpoint(s pb.LogServiceServer) endpoint.Endpoint
- func MakeSubmitMultipleEndpoint(s pb.LogServiceServer) endpoint.Endpoint
- func MakeSubmitSingleEndpoint(s pb.LogServiceServer) endpoint.Endpoint
- type Endpoints
- func (e Endpoints) Ping(ctx context.Context, in *pb.Empty) (*pb.Response, error)
- func (e Endpoints) SubmitMultiple(ctx context.Context, in *pb.EventLogs) (*pb.Response, error)
- func (e Endpoints) SubmitSingle(ctx context.Context, in *pb.EventLog) (*pb.Response, error)
- func (e *Endpoints) WrapAllExcept(middleware endpoint.Middleware, excluded ...string)
- func (e *Endpoints) WrapAllLabeledExcept(middleware func(string, endpoint.Endpoint) endpoint.Endpoint, ...)
- type ErrorCoder
- type LabeledMiddleware
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeGRPCPingRequest ¶
DecodeGRPCPingRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC ping request to a user-domain ping request. Primarily useful in a server.
func DecodeGRPCSubmitMultipleRequest ¶
DecodeGRPCSubmitMultipleRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC submitmultiple request to a user-domain submitmultiple request. Primarily useful in a server.
func DecodeGRPCSubmitSingleRequest ¶
DecodeGRPCSubmitSingleRequest is a transport/grpc.DecodeRequestFunc that converts a gRPC submitsingle request to a user-domain submitsingle request. Primarily useful in a server.
func DecodeHTTPPingZeroRequest ¶
DecodeHTTPPingZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded ping request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPSubmitMultipleZeroRequest ¶
DecodeHTTPSubmitMultipleZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded submitmultiple request from the HTTP request body. Primarily useful in a server.
func DecodeHTTPSubmitSingleZeroRequest ¶
DecodeHTTPSubmitSingleZeroRequest is a transport/http.DecodeRequestFunc that decodes a JSON-encoded submitsingle request from the HTTP request body. Primarily useful in a server.
func EncodeGRPCPingResponse ¶
EncodeGRPCPingResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain ping response to a gRPC ping reply. Primarily useful in a server.
func EncodeGRPCSubmitMultipleResponse ¶
EncodeGRPCSubmitMultipleResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain submitmultiple response to a gRPC submitmultiple reply. Primarily useful in a server.
func EncodeGRPCSubmitSingleResponse ¶
EncodeGRPCSubmitSingleResponse is a transport/grpc.EncodeResponseFunc that converts a user-domain submitsingle response to a gRPC submitsingle 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 MakeGRPCServer ¶
func MakeGRPCServer(endpoints Endpoints, options ...grpctransport.ServerOption) pb.LogServiceServer
MakeGRPCServer makes a set of endpoints available as a gRPC LogServiceServer.
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 MakePingEndpoint ¶
func MakePingEndpoint(s pb.LogServiceServer) endpoint.Endpoint
func MakeSubmitMultipleEndpoint ¶
func MakeSubmitMultipleEndpoint(s pb.LogServiceServer) endpoint.Endpoint
func MakeSubmitSingleEndpoint ¶
func MakeSubmitSingleEndpoint(s pb.LogServiceServer) endpoint.Endpoint
Types ¶
type Endpoints ¶
type Endpoints struct { SubmitSingleEndpoint endpoint.Endpoint SubmitMultipleEndpoint endpoint.Endpoint PingEndpoint endpoint.Endpoint }
Endpoints collects all of the endpoints that compose an add service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.
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) SubmitMultiple ¶
func (Endpoints) SubmitSingle ¶
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 ErrorCoder ¶
type ErrorCoder interface {
ErrorCode() int16
}
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.
Directories ¶
Path | Synopsis |
---|---|
client
|
|
grpc
Package grpc provides a gRPC client for the LogService service.
|
Package grpc provides a gRPC client for the LogService service. |
http
Package http provides an HTTP client for the LogService service.
|
Package http provides an HTTP client for the LogService service. |