Documentation
¶
Index ¶
- Constants
- type File
- type Filesystem
- type FilesystemLocal
- type FilesystemMemory
- type FilesystemS3
- func (fs *FilesystemS3) Chroot(path string) (billy.Filesystem, error)
- func (fs *FilesystemS3) Create(filename string) (billy.File, error)
- func (fs *FilesystemS3) Join(elem ...string) string
- func (fs *FilesystemS3) ListFiles() ([]File, error)
- func (fs *FilesystemS3) Lstat(filename string) (os.FileInfo, error)
- func (fs *FilesystemS3) MkdirAll(filename string, perm os.FileMode) error
- func (fs *FilesystemS3) Open(filename string) (billy.File, error)
- func (fs *FilesystemS3) OpenFile(filename string, flag int, perm os.FileMode) (billy.File, error)
- func (fs *FilesystemS3) ReadDir(dirPath string) ([]os.FileInfo, error)
- func (fs *FilesystemS3) Readlink(link string) (string, error)
- func (fs *FilesystemS3) Remove(filename string) error
- func (fs *FilesystemS3) Rename(oldpath, newpath string) error
- func (fs *FilesystemS3) Root() string
- func (fs *FilesystemS3) Stat(filename string) (os.FileInfo, error)
- func (fs *FilesystemS3) Symlink(target, link string) error
- func (fs *FilesystemS3) TempFile(dir, prefix string) (billy.File, error)
- func (fs *FilesystemS3) Write(path string, reader io.Reader, size int64) error
- type S3Config
Constants ¶
const ( STORAGE_MODE_LOCAL = "local" STORAGE_MODE_S3 = "s3" STORAGE_MODE_MEMORY = "memory" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Filesystem ¶
type Filesystem interface {
billy.Filesystem
Write(path string, reader io.Reader, size int64) error
ListFiles() ([]File, error)
}
Filesystem extends billy.Filesystem with additional utility methods
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 NewFilesystemMemory ¶ added in v0.8.0
func NewFilesystemMemory() Filesystem
NewFilesystemMemory creates a new in-memory filesystem instance
func NewFilesystemS3 ¶
func NewFilesystemS3(cfg S3Config) (Filesystem, error)
NewFilesystemS3 creates a new S3 filesystem instance with the specified configuration
type FilesystemLocal ¶
type FilesystemLocal struct {
billy.Filesystem
// contains filtered or unexported fields
}
FilesystemLocal implements the Filesystem interface for local file storage using go-billy's osfs
func (*FilesystemLocal) ListFiles ¶
func (fs *FilesystemLocal) ListFiles() ([]File, error)
ListFiles returns a list of all files in the filesystem
type FilesystemMemory ¶ added in v0.8.0
type FilesystemMemory struct {
billy.Filesystem
}
FilesystemMemory implements the Filesystem interface for in-memory file storage using go-billy's memfs
func (*FilesystemMemory) ListFiles ¶ added in v0.8.0
func (fs *FilesystemMemory) ListFiles() ([]File, error)
ListFiles returns a list of all files in the filesystem
type FilesystemS3 ¶
type FilesystemS3 struct {
// contains filtered or unexported fields
}
FilesystemS3 implements the billy.Filesystem interface for S3-compatible storage
func (*FilesystemS3) Chroot ¶ added in v0.8.0
func (fs *FilesystemS3) Chroot(path string) (billy.Filesystem, error)
Chroot creates a new filesystem rooted at the given path
func (*FilesystemS3) Create ¶ added in v0.8.0
func (fs *FilesystemS3) Create(filename string) (billy.File, error)
Create creates a new file for writing
func (*FilesystemS3) Join ¶ added in v0.8.0
func (fs *FilesystemS3) Join(elem ...string) string
Join joins path elements
func (*FilesystemS3) ListFiles ¶
func (fs *FilesystemS3) ListFiles() ([]File, error)
ListFiles returns a list of all files in the S3 bucket
func (*FilesystemS3) Lstat ¶ added in v0.8.0
func (fs *FilesystemS3) Lstat(filename string) (os.FileInfo, error)
Lstat returns file info (same as Stat for S3)
func (*FilesystemS3) MkdirAll ¶ added in v0.8.0
func (fs *FilesystemS3) MkdirAll(filename string, perm os.FileMode) error
MkdirAll creates all directories in the path (no-op for S3)
func (*FilesystemS3) Open ¶
func (fs *FilesystemS3) Open(filename string) (billy.File, error)
Open opens a file for reading
func (*FilesystemS3) OpenFile ¶ added in v0.8.0
OpenFile opens a file with the specified flag and permissions
func (*FilesystemS3) ReadDir ¶ added in v0.8.0
func (fs *FilesystemS3) ReadDir(dirPath string) ([]os.FileInfo, error)
ReadDir lists files in a directory
func (*FilesystemS3) Readlink ¶ added in v0.8.0
func (fs *FilesystemS3) Readlink(link string) (string, error)
Readlink is not supported on S3
func (*FilesystemS3) Remove ¶ added in v0.8.0
func (fs *FilesystemS3) Remove(filename string) error
Remove deletes a file
func (*FilesystemS3) Rename ¶ added in v0.8.0
func (fs *FilesystemS3) Rename(oldpath, newpath string) error
Rename renames a file (not efficiently supported in S3)
func (*FilesystemS3) Root ¶ added in v0.8.0
func (fs *FilesystemS3) Root() string
Root returns the root path of the filesystem
func (*FilesystemS3) Stat ¶ added in v0.8.0
func (fs *FilesystemS3) Stat(filename string) (os.FileInfo, error)
Stat returns file info for the specified path
func (*FilesystemS3) Symlink ¶ added in v0.8.0
func (fs *FilesystemS3) Symlink(target, link string) error
Symlink is not supported on S3
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