object

package
v0.29.6 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 19 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
	AllowChangeKey bool                  // parser can allow or not changing key by this flag
	Debug          bool                  // flag for debug requests
	Ctx            context.Context       // context of request
	Range          string                // HTTP range in request
	RangeData      httpRange             // start, end for HTTP range
	// 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) AppendToKey added in v0.15.0

func (o *FileObject) AppendToKey(str string)

AppendToKey add string to key

func (*FileObject) Copy added in v0.15.0

func (o *FileObject) Copy() *FileObject

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"

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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