service

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package service contains the service definitions used by the handler

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CleanFloat added in v0.0.5

func CleanFloat(input string, bound float64) float64

CleanFloat takes a string and return a float64 not greater than bound

func CleanInt

func CleanInt(input string) int

CleanInt takes a string and return an int not greater than 9999

func GetCropPoint

func GetCropPoint(input string) processor.Point

GetCropPoint takes a string and returns the type Point

func NewCloudfrontStorage

func NewCloudfrontStorage(c config.Cloudfront, hc base.HystrixCommand) *cloudfront.Storage

NewCloudfrontStorage create a new cloudfront.Storage struct from the config.Cloudfront and the HystrixCommand

func NewGoogleCloudStorage added in v0.3.1

func NewGoogleCloudStorage(b config.GoogleCloudStorage, hc base.HystrixCommand) (*gcs.Storage, error)

NewGoogleCloudStorage create a new gcs.Storage struct from the config.GoogleCloudStorage and the HystrixCommand

func NewS3Storage

func NewS3Storage(b config.S3Bucket, hc base.HystrixCommand) *s3.Storage

NewS3Storage create a new s3.Storage struct from the config.S3Bucket and the HystrixCommand

func NewWebFolderStorage

func NewWebFolderStorage(wf config.WebFolder, hc base.HystrixCommand) *webfolder.Storage

NewWebFolderStorage create a new webfolder.Storage struct from the config.WebFolder and the HystrixCommand

Types

type Dependencies

type Dependencies struct {
	Storage       base.Storage
	Manipulator   Manipulator
	MetricService metrics.MetricService
}

Dependencies struct holds the reference to the Storage and the Manipulator interface implementations

func NewDependencies

func NewDependencies(registry *prometheus.Registry) (deps *Dependencies, err error)

NewDependencies constructs new Dependencies based on the config.DataSource().Kind Currently, it supports only one Manipulator

type Manipulator

type Manipulator interface {
	// Process takes ProcessSpec as an argument and returns []byte, error
	Process(spec processSpec) ([]byte, error)

	// HasDefaultParams returns true if defaultParams are present, returns false otherwise
	HasDefaultParams() bool
}

Manipulator interface sets the contract on the implementation for common processing support in darkroom

func NewManipulator

func NewManipulator(processor processor.Processor, defaultParams map[string]string,
	metricService metrics.MetricService) Manipulator

NewManipulator takes in a Processor interface and returns a new Manipulator

type MockManipulator added in v0.0.5

type MockManipulator struct {
	mock.Mock
}

func (*MockManipulator) HasDefaultParams added in v0.3.0

func (m *MockManipulator) HasDefaultParams() bool

func (*MockManipulator) Process added in v0.0.5

func (m *MockManipulator) Process(spec processSpec) ([]byte, error)

type ProcessSpec

type ProcessSpec interface {
	// IsWebPSupported() will tell if WebP is supported based on the accepted formats
	IsWebPSupported() bool
}

type SpecBuilder added in v0.0.5

type SpecBuilder interface {
	WithScope(scope string) SpecBuilder
	WithImageData(img []byte) SpecBuilder
	WithParams(params map[string]string) SpecBuilder
	WithFormats(formats []string) SpecBuilder
	Build() processSpec
}

func NewSpecBuilder added in v0.0.5

func NewSpecBuilder() SpecBuilder

Jump to

Keyboard shortcuts

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