1
0
mirror of https://github.com/mxpv/podsync.git synced 2024-05-11 05:55:04 +00:00
mxpv-podsync/pkg/fs/storage.go
Contextualist edade8d330 Add storage config section
This also deprecate `server.data_dir` in favor of `storage.local.data_dir`
2022-06-12 14:08:34 -04:00

31 lines
796 B
Go

package fs
import (
"context"
"io"
"net/http"
)
// Storage is a file system interface to host downloaded episodes and feeds.
type Storage interface {
// FileSystem must be implemented to in order to pass Storage interface to HTTP file server.
http.FileSystem
// Create will create a new file from reader
Create(ctx context.Context, name string, reader io.Reader) (int64, error)
// Delete deletes the file
Delete(ctx context.Context, name string) error
// Size returns a storage object's size in bytes
Size(ctx context.Context, name string) (int64, error)
}
// Config is a configuration for the file storage backend
type Config struct {
// Type is the type of file system to use
Type string `toml:"type"`
Local LocalConfig `toml:"local"`
S3 S3Config `toml:"s3"`
}