Documentation
¶
Overview ¶
Package storage provides blob storage for media files.
Index ¶
- type Blob
- type S3
- func (store *S3) ClipPath(id string) string
- func (store *S3) DeleteFile(path string) error
- func (store *S3) FileExists(path string) bool
- func (store *S3) Get(ctx context.Context, path string) error
- func (store *S3) GifPath(id string) string
- func (store *S3) PreviewPath(id string) string
- func (store *S3) Put(ctx context.Context, path string) error
- func (store *S3) ScreenshotPath(id string) string
- func (store *S3) ThumbnailPath(id string) string
- func (store *S3) WriteThumbnail(id string, data []byte) error
- type Storage
- func (s *Storage) BasePath() string
- func (s *Storage) ClipPath(id string) string
- func (s *Storage) ClipsDir() string
- func (*Storage) DeleteFile(path string) error
- func (*Storage) FileExists(path string) bool
- func (*Storage) Get(_ context.Context, _ string) error
- func (s *Storage) GifPath(id string) string
- func (s *Storage) GifsDir() string
- func (s *Storage) PreviewPath(id string) string
- func (s *Storage) PreviewsDir() string
- func (*Storage) Put(_ context.Context, _ string) error
- func (s *Storage) ScreenshotPath(id string) string
- func (s *Storage) ScreenshotsDir() string
- func (s *Storage) ThumbnailPath(id string) string
- func (s *Storage) ThumbnailsDir() string
- func (s *Storage) WriteThumbnail(id string, data []byte) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Blob ¶
type Blob interface {
// ClipPath returns the local path for a clip file.
ClipPath(id string) string
// DeleteFile deletes the object identified by path.
DeleteFile(path string) error
// FileExists reports whether the object identified by path exists.
FileExists(path string) bool
// Get downloads the object to the local path for ffmpeg or HTTP serving.
Get(ctx context.Context, path string) error
// GifPath returns the local path for a GIF file.
GifPath(id string) string
// PreviewPath returns the local path for a preview file.
PreviewPath(id string) string
// Put uploads the local path after ffmpeg writes it.
Put(ctx context.Context, path string) error
// ScreenshotPath returns the local path for a screenshot file.
ScreenshotPath(id string) string
// ThumbnailPath returns the local path for a thumbnail file.
ThumbnailPath(id string) string
// WriteThumbnail stores thumbnail bytes under the given id.
WriteThumbnail(id string, data []byte) error
}
Blob is the media object store used by the application.
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
S3 stores objects on an S3-compatible endpoint.
func (*S3) DeleteFile ¶
DeleteFile removes the object from S3 and the local scratch copy.
func (*S3) FileExists ¶
FileExists reports whether the object exists, hydrating the local copy when needed.
func (*S3) PreviewPath ¶
PreviewPath returns the local scratch path for a preview file.
func (*S3) ScreenshotPath ¶
ScreenshotPath returns the local scratch path for a screenshot file.
func (*S3) ThumbnailPath ¶
ThumbnailPath returns the local scratch path for a thumbnail file.
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
Storage provides filesystem storage.
func NewStorage ¶
NewStorage creates a new storage instance.
func (*Storage) DeleteFile ¶
DeleteFile deletes a file.
func (*Storage) FileExists ¶
FileExists checks if a file exists.
func (*Storage) Get ¶
Get is a no-op on the filesystem backend because objects already live on disk.
func (*Storage) PreviewPath ¶
PreviewPath returns the path for a temporary preview file.
func (*Storage) PreviewsDir ¶
PreviewsDir returns the previews directory.
func (*Storage) Put ¶
Put is a no-op on the filesystem backend because objects already live on disk.
func (*Storage) ScreenshotPath ¶
ScreenshotPath returns the path for a screenshot file.
func (*Storage) ScreenshotsDir ¶
ScreenshotsDir returns the screenshots directory.
func (*Storage) ThumbnailPath ¶
ThumbnailPath returns the path for a thumbnail file.
func (*Storage) ThumbnailsDir ¶
ThumbnailsDir returns the thumbnails directory.