tracking

package
v0.5.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 8, 2017 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package tracking provides the use-case of tracking a cargo. Used by views facing the end-user.

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidArgument = errors.New("invalid argument")

ErrInvalidArgument is returned when one or more arguments are invalid.

Functions

func MakeHandler

func MakeHandler(ts Service, logger kitlog.Logger) http.Handler

MakeHandler returns a handler for the tracking service.

Types

type Cargo

type Cargo struct {
	TrackingID           string    `json:"tracking_id"`
	StatusText           string    `json:"status_text"`
	Origin               string    `json:"origin"`
	Destination          string    `json:"destination"`
	ETA                  time.Time `json:"eta"`
	NextExpectedActivity string    `json:"next_expected_activity"`
	ArrivalDeadline      time.Time `json:"arrival_deadline"`
	Events               []Event   `json:"events"`
}

Cargo is a read model for tracking views.

type Event

type Event struct {
	Description string `json:"description"`
	Expected    bool   `json:"expected"`
}

Event is a read model for tracking views.

type Leg

type Leg struct {
	VoyageNumber string    `json:"voyage_number"`
	From         string    `json:"from"`
	To           string    `json:"to"`
	LoadTime     time.Time `json:"load_time"`
	UnloadTime   time.Time `json:"unload_time"`
}

Leg is a read model for booking views.

type Service

type Service interface {
	// Track returns a cargo matching a tracking ID.
	Track(id string) (Cargo, error)
}

Service is the interface that provides the basic Track method.

func NewInstrumentingService

func NewInstrumentingService(counter metrics.Counter, latency metrics.Histogram, s Service) Service

NewInstrumentingService returns an instance of an instrumenting Service.

func NewLoggingService

func NewLoggingService(logger log.Logger, s Service) Service

NewLoggingService returns a new instance of a logging Service.

func NewService

func NewService(cargos cargo.Repository, events cargo.HandlingEventRepository) Service

NewService returns a new instance of the default Service.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL