object

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(url *url.URL, mortConfig *config.Config, obj *FileObject) error

Parse pare given url using appropriate parser it set object Key, Bucket, Parent and transforms

func RegisterParser

func RegisterParser(kind string, fn ParseFnc)

RegisterParser add new kind of function to map of decoders and for config validator

Types

type FileObject

type FileObject struct {
	Uri    *url.URL `json:"uri"`    // original request path
	Bucket string   `json:"bucket"` // request matched bucket
	Key    string   `json:"key"`    // storage path for file with leading slash

	Transforms  transforms.Transforms `json:"transforms"` // list of transform that should be performed
	Storage     config.Storage        `json:"storage"`    // selected storage that should be used
	Parent      *FileObject           // original image for transformed image
	CheckParent bool                  // boolean if we should always check if parent exists

	Debug bool            // flag for debug requests
	Ctx   context.Context // context of request
	Range string          // HTTP range in request
	// contains filtered or unexported fields
}

FileObject is representing parsed request for image or file

func NewFileErrorObject added in v0.13.0

func NewFileErrorObject(parent string, erroredObject *FileObject) (*FileObject, error)

func NewFileObject

func NewFileObject(uri *url.URL, mortConfig *config.Config) (*FileObject, error)

NewFileObject create new instance of FileObject uri is request URL mortConfig should be pointer to current buckets config

func NewFileObjectFromPath

func NewFileObjectFromPath(path string, mortConfig *config.Config) (*FileObject, error)

NewFileObjectFromPath create new instance of FileObject path should be request path mortConfig should be pointer to current buckets config

func (*FileObject) FillWithRequest added in v0.13.0

func (o *FileObject) FillWithRequest(req *http.Request, ctx context.Context)

FillWithRequest assign to object request and HTTP range data

func (*FileObject) GetResponseCacheKey added in v0.13.0

func (o *FileObject) GetResponseCacheKey() string

func (*FileObject) HasParent

func (o *FileObject) HasParent() bool

HasParent inform if object has parent

func (*FileObject) HasTransform

func (o *FileObject) HasTransform() bool

HasTransform inform if object has transform

func (*FileObject) LogData added in v0.13.0

func (obj *FileObject) LogData(fields ...zapcore.Field) []zapcore.Field

LogData log data for given object

func (*FileObject) Type added in v0.13.0

func (o *FileObject) Type() string

Type returns type of object "parent" or "transform"

func (*FileObject) UpdateKey added in v0.11.0

func (o *FileObject) UpdateKey(str string)

UpdateKey add string to ky

type ParseFnc

type ParseFnc func(url *url.URL, bucketConfig config.Bucket, obj *FileObject) (string, error)

ParseFnc is a function that create object from request url

Jump to

Keyboard shortcuts

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