glide up
This commit is contained in:
7
vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go
generated
vendored
7
vendor/github.com/go-kit/kit/examples/shipping/booking/endpoint.go
generated
vendored
@@ -1,9 +1,10 @@
|
||||
package booking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
|
||||
"github.com/go-kit/kit/examples/shipping/cargo"
|
||||
@@ -42,10 +43,10 @@ type loadCargoResponse struct {
|
||||
|
||||
func (r loadCargoResponse) error() error { return r.Err }
|
||||
|
||||
func makeLoadCargoEndpoint(s Service) endpoint.Endpoint {
|
||||
func makeLoadCargoEndpoint(bs Service) endpoint.Endpoint {
|
||||
return func(ctx context.Context, request interface{}) (interface{}, error) {
|
||||
req := request.(loadCargoRequest)
|
||||
c, err := s.LoadCargo(req.ID)
|
||||
c, err := bs.LoadCargo(req.ID)
|
||||
return loadCargoResponse{Cargo: &c, Err: err}, nil
|
||||
}
|
||||
}
|
||||
|
11
vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go
generated
vendored
11
vendor/github.com/go-kit/kit/examples/shipping/booking/transport.go
generated
vendored
@@ -1,13 +1,13 @@
|
||||
package booking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
kitlog "github.com/go-kit/kit/log"
|
||||
kithttp "github.com/go-kit/kit/transport/http"
|
||||
@@ -17,49 +17,56 @@ import (
|
||||
)
|
||||
|
||||
// MakeHandler returns a handler for the booking service.
|
||||
func MakeHandler(bs Service, logger kitlog.Logger) http.Handler {
|
||||
func MakeHandler(ctx context.Context, bs Service, logger kitlog.Logger) http.Handler {
|
||||
opts := []kithttp.ServerOption{
|
||||
kithttp.ServerErrorLogger(logger),
|
||||
kithttp.ServerErrorEncoder(encodeError),
|
||||
}
|
||||
|
||||
bookCargoHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeBookCargoEndpoint(bs),
|
||||
decodeBookCargoRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
loadCargoHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeLoadCargoEndpoint(bs),
|
||||
decodeLoadCargoRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
requestRoutesHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeRequestRoutesEndpoint(bs),
|
||||
decodeRequestRoutesRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
assignToRouteHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeAssignToRouteEndpoint(bs),
|
||||
decodeAssignToRouteRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
changeDestinationHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeChangeDestinationEndpoint(bs),
|
||||
decodeChangeDestinationRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
listCargosHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeListCargosEndpoint(bs),
|
||||
decodeListCargosRequest,
|
||||
encodeResponse,
|
||||
opts...,
|
||||
)
|
||||
listLocationsHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeListLocationsEndpoint(bs),
|
||||
decodeListLocationsRequest,
|
||||
encodeResponse,
|
||||
|
3
vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go
generated
vendored
3
vendor/github.com/go-kit/kit/examples/shipping/handling/endpoint.go
generated
vendored
@@ -1,9 +1,10 @@
|
||||
package handling
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
|
||||
"github.com/go-kit/kit/examples/shipping/cargo"
|
||||
|
5
vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go
generated
vendored
5
vendor/github.com/go-kit/kit/examples/shipping/handling/transport.go
generated
vendored
@@ -1,12 +1,12 @@
|
||||
package handling
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
kitlog "github.com/go-kit/kit/log"
|
||||
kithttp "github.com/go-kit/kit/transport/http"
|
||||
@@ -17,7 +17,7 @@ import (
|
||||
)
|
||||
|
||||
// MakeHandler returns a handler for the handling service.
|
||||
func MakeHandler(hs Service, logger kitlog.Logger) http.Handler {
|
||||
func MakeHandler(ctx context.Context, hs Service, logger kitlog.Logger) http.Handler {
|
||||
r := mux.NewRouter()
|
||||
|
||||
opts := []kithttp.ServerOption{
|
||||
@@ -26,6 +26,7 @@ func MakeHandler(hs Service, logger kitlog.Logger) http.Handler {
|
||||
}
|
||||
|
||||
registerIncidentHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeRegisterIncidentEndpoint(hs),
|
||||
decodeRegisterIncidentRequest,
|
||||
encodeResponse,
|
||||
|
4
vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go
generated
vendored
4
vendor/github.com/go-kit/kit/examples/shipping/inspection/inspection.go
generated
vendored
@@ -1,9 +1,7 @@
|
||||
// Package inspection provides means to inspect cargos.
|
||||
package inspection
|
||||
|
||||
import (
|
||||
"github.com/go-kit/kit/examples/shipping/cargo"
|
||||
)
|
||||
import "github.com/go-kit/kit/examples/shipping/cargo"
|
||||
|
||||
// EventHandler provides means of subscribing to inspection events.
|
||||
type EventHandler interface {
|
||||
|
4
vendor/github.com/go-kit/kit/examples/shipping/location/location.go
generated
vendored
4
vendor/github.com/go-kit/kit/examples/shipping/location/location.go
generated
vendored
@@ -1,9 +1,7 @@
|
||||
// Package location provides the Location aggregate.
|
||||
package location
|
||||
|
||||
import (
|
||||
"errors"
|
||||
)
|
||||
import "errors"
|
||||
|
||||
// UNLocode is the United Nations location code that uniquely identifies a
|
||||
// particular location.
|
||||
|
18
vendor/github.com/go-kit/kit/examples/shipping/main.go
generated
vendored
18
vendor/github.com/go-kit/kit/examples/shipping/main.go
generated
vendored
@@ -1,7 +1,6 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"net/http"
|
||||
@@ -12,6 +11,7 @@ import (
|
||||
"time"
|
||||
|
||||
stdprometheus "github.com/prometheus/client_golang/prometheus"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/go-kit/kit/log"
|
||||
kitprometheus "github.com/go-kit/kit/metrics/prometheus"
|
||||
@@ -47,7 +47,7 @@ func main() {
|
||||
var logger log.Logger
|
||||
logger = log.NewLogfmtLogger(os.Stderr)
|
||||
logger = &serializedLogger{Logger: logger}
|
||||
logger = log.With(logger, "ts", log.DefaultTimestampUTC)
|
||||
logger = log.NewContext(logger).With("ts", log.DefaultTimestampUTC)
|
||||
|
||||
var (
|
||||
cargos = inmem.NewCargoRepository()
|
||||
@@ -78,7 +78,7 @@ func main() {
|
||||
|
||||
var bs booking.Service
|
||||
bs = booking.NewService(cargos, locations, handlingEvents, rs)
|
||||
bs = booking.NewLoggingService(log.With(logger, "component", "booking"), bs)
|
||||
bs = booking.NewLoggingService(log.NewContext(logger).With("component", "booking"), bs)
|
||||
bs = booking.NewInstrumentingService(
|
||||
kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
||||
Namespace: "api",
|
||||
@@ -97,7 +97,7 @@ func main() {
|
||||
|
||||
var ts tracking.Service
|
||||
ts = tracking.NewService(cargos, handlingEvents)
|
||||
ts = tracking.NewLoggingService(log.With(logger, "component", "tracking"), ts)
|
||||
ts = tracking.NewLoggingService(log.NewContext(logger).With("component", "tracking"), ts)
|
||||
ts = tracking.NewInstrumentingService(
|
||||
kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
||||
Namespace: "api",
|
||||
@@ -116,7 +116,7 @@ func main() {
|
||||
|
||||
var hs handling.Service
|
||||
hs = handling.NewService(handlingEvents, handlingEventFactory, handlingEventHandler)
|
||||
hs = handling.NewLoggingService(log.With(logger, "component", "handling"), hs)
|
||||
hs = handling.NewLoggingService(log.NewContext(logger).With("component", "handling"), hs)
|
||||
hs = handling.NewInstrumentingService(
|
||||
kitprometheus.NewCounterFrom(stdprometheus.CounterOpts{
|
||||
Namespace: "api",
|
||||
@@ -133,13 +133,13 @@ func main() {
|
||||
hs,
|
||||
)
|
||||
|
||||
httpLogger := log.With(logger, "component", "http")
|
||||
httpLogger := log.NewContext(logger).With("component", "http")
|
||||
|
||||
mux := http.NewServeMux()
|
||||
|
||||
mux.Handle("/booking/v1/", booking.MakeHandler(bs, httpLogger))
|
||||
mux.Handle("/tracking/v1/", tracking.MakeHandler(ts, httpLogger))
|
||||
mux.Handle("/handling/v1/", handling.MakeHandler(hs, httpLogger))
|
||||
mux.Handle("/booking/v1/", booking.MakeHandler(ctx, bs, httpLogger))
|
||||
mux.Handle("/tracking/v1/", tracking.MakeHandler(ctx, ts, httpLogger))
|
||||
mux.Handle("/handling/v1/", handling.MakeHandler(ctx, hs, httpLogger))
|
||||
|
||||
http.Handle("/", accessControl(mux))
|
||||
http.Handle("/metrics", stdprometheus.Handler())
|
||||
|
3
vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go
generated
vendored
3
vendor/github.com/go-kit/kit/examples/shipping/routing/proxying.go
generated
vendored
@@ -1,12 +1,13 @@
|
||||
package routing
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/go-kit/kit/circuitbreaker"
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
kithttp "github.com/go-kit/kit/transport/http"
|
||||
|
4
vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go
generated
vendored
4
vendor/github.com/go-kit/kit/examples/shipping/routing/routing.go
generated
vendored
@@ -3,9 +3,7 @@
|
||||
// bounded context.
|
||||
package routing
|
||||
|
||||
import (
|
||||
"github.com/go-kit/kit/examples/shipping/cargo"
|
||||
)
|
||||
import "github.com/go-kit/kit/examples/shipping/cargo"
|
||||
|
||||
// Service provides access to an external routing service.
|
||||
type Service interface {
|
||||
|
2
vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go
generated
vendored
2
vendor/github.com/go-kit/kit/examples/shipping/tracking/endpoint.go
generated
vendored
@@ -1,7 +1,7 @@
|
||||
package tracking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
"github.com/go-kit/kit/endpoint"
|
||||
)
|
||||
|
5
vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go
generated
vendored
5
vendor/github.com/go-kit/kit/examples/shipping/tracking/transport.go
generated
vendored
@@ -1,12 +1,12 @@
|
||||
package tracking
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"net/http"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"golang.org/x/net/context"
|
||||
|
||||
kitlog "github.com/go-kit/kit/log"
|
||||
kithttp "github.com/go-kit/kit/transport/http"
|
||||
@@ -15,7 +15,7 @@ import (
|
||||
)
|
||||
|
||||
// MakeHandler returns a handler for the tracking service.
|
||||
func MakeHandler(ts Service, logger kitlog.Logger) http.Handler {
|
||||
func MakeHandler(ctx context.Context, ts Service, logger kitlog.Logger) http.Handler {
|
||||
r := mux.NewRouter()
|
||||
|
||||
opts := []kithttp.ServerOption{
|
||||
@@ -24,6 +24,7 @@ func MakeHandler(ts Service, logger kitlog.Logger) http.Handler {
|
||||
}
|
||||
|
||||
trackCargoHandler := kithttp.NewServer(
|
||||
ctx,
|
||||
makeTrackCargoEndpoint(ts),
|
||||
decodeTrackCargoRequest,
|
||||
encodeResponse,
|
||||
|
Reference in New Issue
Block a user