Documentation
¶
Overview ¶
Package command provides utilities for creating MDM Payloads.
Index ¶
- Constants
- func EncodeError(ctx context.Context, err error, w http.ResponseWriter)
- func EndpointInstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
- func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
- func MakeNewCommandEndpoint(svc Service) endpoint.Endpoint
- func MarshalEvent(e *Event) ([]byte, error)
- func UnmarshalEvent(data []byte, e *Event) error
- type Command
- type Endpoints
- type Event
- type HTTPHandlers
- type Middleware
- type Service
Constants ¶
const ( // CommandBucket is the *bolt.DB bucket where commands are archived. CommandBucket = "mdm.Command.ARCHIVE" // CommandTopic is a PubSub topic that events are published to. CommandTopic = "mdm.Command" )
Variables ¶
This section is empty.
Functions ¶
func EncodeError ¶
func EncodeError(ctx context.Context, err error, w http.ResponseWriter)
EncodeError is used by the HTTP transport to encode service errors in HTTP. The EncodeError should be passed to the Go-Kit httptransport as the ServerErrorEncoder to encode error responses with JSON.
func EndpointInstrumentingMiddleware ¶
func EndpointInstrumentingMiddleware(duration metrics.Histogram) endpoint.Middleware
EndpointInstrumentingMiddleware returns an endpoint middleware that records the duration of each invocation to the passed histogram. The middleware adds a single field: "success", which is "true" if no error is returned, and "false" otherwise.
func EndpointLoggingMiddleware ¶
func EndpointLoggingMiddleware(logger log.Logger) endpoint.Middleware
EndpointLoggingMiddleware returns an endpoint middleware that logs the duration of each invocation, and the resulting error, if any.
func MakeNewCommandEndpoint ¶
MakeNewCommandEndpoint creates an endpoint which creates new MDM Commands.
func MarshalEvent ¶
MarshalEvent serializes an event to a protocol buffer wire format.
func UnmarshalEvent ¶
UnmarshalEvent parses a protocol buffer representation of data into the Event.
Types ¶
type Command ¶
type Command struct {
// contains filtered or unexported fields
}
func (*Command) NewCommand ¶
type HTTPHandlers ¶
func MakeHTTPHandlers ¶
func MakeHTTPHandlers(ctx context.Context, endpoints Endpoints, opts ...httptransport.ServerOption) HTTPHandlers
type Middleware ¶
Middleware describes a service (as opposed to endpoint) middleware.
func ServiceInstrumentingMiddleware ¶
func ServiceInstrumentingMiddleware(p metrics.Counter) Middleware
ServiceInstrumentingMiddleware returns a service middleware that tracks the number of payloads created by the service.
func ServiceLoggingMiddleware ¶
func ServiceLoggingMiddleware(logger log.Logger) Middleware
ServiceLoggingMiddleware returns a service middleware that logs the parameters and result of each method invocation.
Directories
¶
Path | Synopsis |
---|---|
internal
|
|
commandproto
Package commandproto is a generated protocol buffer package.
|
Package commandproto is a generated protocol buffer package. |