Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FileSystem ¶
type FileSystem struct {
// contains filtered or unexported fields
}
FileSystem represents a storage for the thumbnails using the local file system.
func NewFileSystemStorage ¶
func NewFileSystemStorage(cfg config.FileSystemStorage, logger log.Logger) FileSystem
NewFileSystemStorage creates a new instance of FileSystem
func (FileSystem) BuildKey ¶
func (s FileSystem) BuildKey(r Request) string
BuildKey generate the unique key for a thumbnail. The key is structure as follows:
<first two letters of checksum>/<next two letters of checksum>/<rest of checksum>/<width>x<height>.<filetype>
e.g. 97/9f/4c8db98f7b82e768ef478d3c8612/500x300.png
The key also represents the path to the thumbnail in the filesystem under the configured root directory.
func (FileSystem) Stat ¶
func (s FileSystem) Stat(key string) bool
type InMemory ¶
type InMemory struct {
// contains filtered or unexported fields
}
InMemory represents an in memory storage for thumbnails Can be used during development
func NewInMemoryStorage ¶
func NewInMemoryStorage() InMemory
NewInMemoryStorage creates a new InMemory instance.
type Request ¶
type Request struct { // The checksum of the source file // Will be used to determine if a thumbnail exists Checksum string // Types provided by the encoder. // Contains the mimetypes of the thumbnail. // In case of jpg/jpeg it will contain both. Types []string // The resolution of the thumbnail Resolution image.Rectangle }
Request combines different attributes needed for storage operations.