Documentation ¶
Index ¶
- Constants
- Variables
- type LastRenderedProcessor
- func (lrp *LastRenderedProcessor) JobHasImage(jobUUID string) bool
- func (lrp *LastRenderedProcessor) PathForJob(jobUUID string) string
- func (lrp *LastRenderedProcessor) QueueImage(payload Payload) error
- func (lrp *LastRenderedProcessor) Run(ctx context.Context)
- func (lrp *LastRenderedProcessor) ThumbSpecs() []Thumbspec
- type Payload
- type Storage
- type Thumbspec
Constants ¶
const ( // MaxImageSizeBytes is the maximum size in bytes allowed for to-be-processed images. MaxImageSizeBytes int64 = 25 * 1024 * 1024 )
Variables ¶
var (
ErrMimeTypeUnsupported = errors.New("mime type unsupported")
)
var (
ErrQueueFull = errors.New("queue full")
)
Functions ¶
This section is empty.
Types ¶
type LastRenderedProcessor ¶
type LastRenderedProcessor struct {
// contains filtered or unexported fields
}
LastRenderedProcessor processes "last-rendered" images and stores them with the job.
func New ¶
func New(storage Storage) *LastRenderedProcessor
func (*LastRenderedProcessor) JobHasImage ¶
func (lrp *LastRenderedProcessor) JobHasImage(jobUUID string) bool
JobHasImage returns true only if the job actually has a last-rendered image. Only the lowest-resolution image is tested for. Since images are processed in order, existence of the last one should imply existence of all of them.
func (*LastRenderedProcessor) PathForJob ¶
func (lrp *LastRenderedProcessor) PathForJob(jobUUID string) string
PathForJob returns the base path for this job's last-rendered images.
func (*LastRenderedProcessor) QueueImage ¶
func (lrp *LastRenderedProcessor) QueueImage(payload Payload) error
QueueImage queues an image for processing. Returns `ErrQueueFull` if there is no more space in the queue for new images.
func (*LastRenderedProcessor) Run ¶
func (lrp *LastRenderedProcessor) Run(ctx context.Context)
Run is the main loop for the processing of images. It will keep running until the context is closed.
func (*LastRenderedProcessor) ThumbSpecs ¶
func (lrp *LastRenderedProcessor) ThumbSpecs() []Thumbspec
ThumbSpecs returns the thumbnail specifications.
type Payload ¶
type Payload struct { JobUUID string // Used to determine the directory to store the image. WorkerUUID string // Just for logging. MimeType string Image []byte // Callback is called when the image processing is finished. Callback func(ctx context.Context) }
Payload contains the actual image to process.