tracking

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2016 License: MIT Imports: 13 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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(ctx context.Context, 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