Documentation
¶
Overview ¶
Package fileop provides a collection of file operation helpers with abstraction interfaces for various file systems.
Index ¶
- Variables
- func IsUnhandledFileReaderError(err error) bool
- func NewCompressReader(file io.Reader, ct CompressType) (io.ReadCloser, error)
- func NewCompressWriter(buf io.Writer, ct CompressType) (io.WriteCloser, error)
- type Cleaner
- type CompressType
- type DirCreator
- type DirReader
- type FileReader
- type FileReaderInterface
- type FileSystem
- type FileSystemSimple
- type FileSystemSimpleBucket
- type FileSystemWithCloser
- type FileWriter
- type FileWriterInterface
- type ISourceLister
- type ISourceReader
- type ITargetUploader
- type NewReaderFunc
- type NewWriterFunc
- type Reader
- type Stater
- type Walker
- type Writer
Constants ¶
This section is empty.
Variables ¶
var ( UsePGZIP bool PGZIPBlocks = 4 )
Functions ¶
func NewCompressReader ¶
func NewCompressReader(file io.Reader, ct CompressType) (io.ReadCloser, error)
func NewCompressWriter ¶
func NewCompressWriter(buf io.Writer, ct CompressType) (io.WriteCloser, error)
Types ¶
type CompressType ¶
type CompressType int
CompressType represents the type of compression to be used.
const ( NONE CompressType = iota // No compression GZIP // GZIP compression ZLIB // ZLIB compression SNAPPY // SNAPPY compression )
Supported compression types.
func (CompressType) String ¶
func (ct CompressType) String() string
String returns the string representation of the compression type.
type DirCreator ¶
type DirCreator interface {
Mkdir(dirname string, perm fs.FileMode) error
MkdirAll(dirname string, perm fs.FileMode) error
}
DirCreator provides directory creation operations.
type DirReader ¶
type DirReader interface {
Readdir(dirname string, n int) ([]fs.FileInfo, error)
Readdirnames(dirname string, n int) ([]string, error)
}
DirReader provides directory reading operations.
type FileReader ¶
func NewFileReader ¶
func NewFileReader(fri FileReaderInterface, srcPath string, ct CompressType) (*FileReader, error)
NewFileReader create *FileReader on any FileReaderInterface. NOTE: you can call IsUnhandledFileReaderError judge errors can not solve by retry.
func (*FileReader) Close ¶
func (fr *FileReader) Close() error
func (*FileReader) ReadLine ¶
func (fr *FileReader) ReadLine() ([]byte, error)
type FileReaderInterface ¶
type FileReaderInterface Reader
FileReaderInterface is an alias for Reader interface.
type FileSystem ¶
FileSystem combines all file system operations.
type FileSystemSimple ¶
type FileSystemSimple interface {
ISourceReader
ITargetUploader
}
FileSystemSimple combines basic source reader and target uploader interfaces.
type FileSystemSimpleBucket ¶
type FileSystemSimpleBucket interface {
FileSystemSimple
Bucket(name string) FileSystemSimpleBucket
PutStreamWithContentType(reader io.Reader, remote string, contentType string) error
}
FileSystemSimpleBucket extends FileSystemSimple with bucket operations and content type support for object storage systems.
type FileSystemWithCloser ¶
type FileSystemWithCloser interface {
FileSystem
io.Closer
}
FileSystemWithCloser extends FileSystem with a Close method.
type FileWriter ¶
type FileWriter struct {
Path string
// contains filtered or unexported fields
}
func NewFileWriter ¶
func NewFileWriter(fwi FileWriterInterface, dstPath string, bufSize int, ct CompressType) (*FileWriter, error)
func (*FileWriter) Close ¶
func (fw *FileWriter) Close() error
type FileWriterInterface ¶
type FileWriterInterface interface {
MkdirAll(dirname string, perm fs.FileMode) error
Create(name string) (io.WriteCloser, error)
}
FileWriterInterface provides basic file writing operations.
type ISourceLister ¶
ISourceLister provides directory listing operations for source file systems.
type ISourceReader ¶
type ISourceReader interface {
ISourceLister
Reader
}
ISourceReader combines source listing and reading operations.
type ITargetUploader ¶
type ITargetUploader interface {
io.Closer
Put(local, remote string) error
PutStream(reader io.Reader, remote string) error
PutEmpty(remote string) error
Exist(remote string) bool
}
ITargetUploader provides upload operations for target file systems.
type NewReaderFunc ¶
type NewReaderFunc func(fri FileReaderInterface, path string, ct CompressType) (io.ReadCloser, error)
NewReaderFunc is a function type for creating new readers with compression support.
type NewWriterFunc ¶
type NewWriterFunc func(fwi FileWriterInterface, path string, bufSize int, ct CompressType) (io.WriteCloser, error)
NewWriterFunc is a function type for creating new writers with compression and buffer support.
type Reader ¶
type Reader interface {
Open(name string) (io.ReadCloser, error)
}
Reader provides read operations for files.
type Writer ¶
type Writer interface {
DirCreator
Create(name string) (io.WriteCloser, error)
Rename(oldPath, newPath string) error
}
Writer provides write operations for files and directories.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
_example
|
|
|
extend_filesource
command
|
|
|
file_writer_reader
command
|
|
|
fileutil_write_read
command
|
|
|
integration
|
|