Documentation ¶
Overview ¶
Package service contains the service definitions used by the handler
Index ¶
- func CleanFloat(input string, bound float64) float64
- func CleanInt(input string) int
- func GetCropPoint(input string) processor.Point
- func NewCloudfrontStorage(c config.Cloudfront, hc base.HystrixCommand) *cloudfront.Storage
- func NewGoogleCloudStorage(b config.GoogleCloudStorage, hc base.HystrixCommand) (*gcs.Storage, error)
- func NewS3Storage(b config.S3Bucket, hc base.HystrixCommand) *s3.Storage
- func NewWebFolderStorage(wf config.WebFolder, hc base.HystrixCommand) *webfolder.Storage
- type Dependencies
- type Manipulator
- type MockManipulator
- type ProcessSpec
- type SpecBuilder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanFloat ¶ added in v0.0.5
CleanFloat takes a string and return a float64 not greater than bound
func GetCropPoint ¶
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 ¶
NewS3Storage create a new s3.Storage struct from the config.S3Bucket and the HystrixCommand
func NewWebFolderStorage ¶
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
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