Documentation
¶
Index ¶
Constants ¶
const ( STORAGE_MODE_LOCAL = "local" STORAGE_MODE_S3 = "s3" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filesystem ¶
type Filesystem interface {
Write(path string, reader io.Reader, size int64) error
Open(path string) (io.ReadCloser, error)
Delete(path string) error
ListFiles() ([]File, error)
}
func CreateFilesystemFromEnv ¶
func CreateFilesystemFromEnv() (Filesystem, error)
CreateFilesystemFromEnv creates a filesystem based on environment variables
func NewFilesystemLocal ¶
func NewFilesystemLocal(basePath string) Filesystem
NewFilesystemLocal creates a new local filesystem instance with the specified base path
func NewFilesystemS3 ¶
func NewFilesystemS3(cfg S3Config) (Filesystem, error)
NewFilesystemS3 creates a new S3 filesystem instance with the specified configuration
type FilesystemLocal ¶
type FilesystemLocal struct {
// contains filtered or unexported fields
}
FilesystemLocal implements the Filesystem interface for local file storage
func (*FilesystemLocal) Delete ¶
func (fs *FilesystemLocal) Delete(path string) error
Delete removes the file at the specified path
func (*FilesystemLocal) ListFiles ¶
func (fs *FilesystemLocal) ListFiles() ([]File, error)
ListFiles returns a list of all files in the base path
func (*FilesystemLocal) Open ¶
func (fs *FilesystemLocal) Open(path string) (io.ReadCloser, error)
Open opens a file at the specified path and returns a ReadCloser
type FilesystemS3 ¶
type FilesystemS3 struct {
// contains filtered or unexported fields
}
FilesystemS3 implements the Filesystem interface for S3-compatible storage
func (*FilesystemS3) Delete ¶
func (fs *FilesystemS3) Delete(path string) error
Delete removes a file from S3
func (*FilesystemS3) ListFiles ¶
func (fs *FilesystemS3) ListFiles() ([]File, error)
ListFiles returns a list of all files in the S3 bucket
func (*FilesystemS3) Open ¶
func (fs *FilesystemS3) Open(path string) (io.ReadCloser, error)
Open downloads a file from S3 and returns a ReadCloser
type S3Config ¶
type S3Config struct {
Endpoint string // S3 endpoint URL (for S3-compatible services)
Region string // AWS region
BucketName string // S3 bucket name
AccessKeyID string // AWS access key ID
SecretAccessKey string // AWS secret access key
UseSSL bool // Whether to use SSL/TLS
}
S3Config holds the configuration for S3 filesystem