imageservice

package
v0.0.0-...-6ed391b Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OperationError    = errors.New("service respond with error")
	InconsistentRoute = errors.New("required route params not found in URI")
)

Functions

func DecodeCreateImageRequest

func DecodeCreateImageRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeDeleteImageRequest

func DecodeDeleteImageRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeGetImageRequest

func DecodeGetImageRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeGetResizeJobRequest

func DecodeGetResizeJobRequest(ctx context.Context, r *http.Request) (interface{}, error)

func DecodeScheduleResizeJobRequest

func DecodeScheduleResizeJobRequest(ctx context.Context, r *http.Request) (interface{}, error)

func EncodeGetResizeJobResponse

func EncodeGetResizeJobResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func EncodeImageResponse

func EncodeImageResponse(ctx context.Context, w http.ResponseWriter, response interface{}) error

func MakeCreateImageEndpoint

func MakeCreateImageEndpoint(svc resizer.ImageService) endpoint.Endpoint

func MakeDeleteImageEndpoint

func MakeDeleteImageEndpoint(svc resizer.ImageService) endpoint.Endpoint

func MakeGetImageEndpoint

func MakeGetImageEndpoint(svc resizer.ImageService) endpoint.Endpoint

func MakeGetResizeJobEndpoint

func MakeGetResizeJobEndpoint(svc resizer.ImageService) endpoint.Endpoint

func MakeHTTPHandler

func MakeHTTPHandler(is resizer.ImageService) http.Handler

func MakeScheduleResizeJobEndpoint

func MakeScheduleResizeJobEndpoint(svc resizer.ImageService) endpoint.Endpoint

Types

type Endpoints

type Endpoints struct {
	CreateImageEndpoint       endpoint.Endpoint
	GetImageEndpoint          endpoint.Endpoint
	DeleteImageEndpoint       endpoint.Endpoint
	ScheduleResizeJobEndpoint endpoint.Endpoint
	GetResizeJobEndpoint      endpoint.Endpoint
}

func MakeServerEndpoint

func MakeServerEndpoint(svc resizer.ImageService) Endpoints

type ImageService

type ImageService struct {
	Storage   storage.Storage
	Clock     resizer.Clocker
	Hash      resizer.Hasher
	Converter resizer.Converter
	ResizeSvc resizer.ResizeService
}

func (*ImageService) Create

func (is *ImageService) Create(ctx context.Context, raw *[]byte) (*resizer.Image, error)

func (*ImageService) Delete

func (is *ImageService) Delete(ctx context.Context, id string) error

func (*ImageService) GetResizeJob

func (is *ImageService) GetResizeJob(ctx context.Context, jobId uint64) (*resizer.ResizeJob, error)

func (*ImageService) Read

func (is *ImageService) Read(ctx context.Context, id string) (*resizer.Image, error)

func (*ImageService) ScheduleResizeJob

func (is *ImageService) ScheduleResizeJob(ctx context.Context, imgId string, width, height uint) (*resizer.ResizeJob, error)

Jump to

Keyboard shortcuts

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