Documentation ¶
Index ¶
- Constants
- Variables
- func CopyFile(dest Storage, destName string, source Storage, sourceName string) error
- func LockFile(e Storage, name string, span time.Duration) (uint64, error)
- func ReadFile(e Storage, name string) ([]byte, error)
- func ReadJSON(e Storage, name string, v any, hash hash.Hash) error
- func UnlockFile(e Storage, name string, id uint64)
- func WriteFile(e Storage, name string, data []byte) error
- func WriteJSON(e Storage, name string, v any, hash hash.Hash) error
- type Firebase
- func (l *Firebase) Close() error
- func (l *Firebase) Delete(name string) error
- func (l *Firebase) GetCheckpoint(name string) int64
- func (l *Firebase) Read(name string, rang *Range, dest io.Writer, progress chan int64) error
- func (l *Firebase) ReadDir(dir string, opts ListOption) ([]fs.FileInfo, error)
- func (l *Firebase) Rename(old, new string) error
- func (l *Firebase) SetCheckpoint(name string) (int64, error)
- func (l *Firebase) Stat(name string) (os.FileInfo, error)
- func (l *Firebase) String() string
- func (l *Firebase) Write(name string, source io.ReadSeeker, size int64, progress chan int64) error
- type FirebaseConfig
- type ListOption
- type Local
- func (l *Local) Close() error
- func (l *Local) Delete(name string) error
- func (l *Local) GetCheckpoint(name string) int64
- func (l *Local) Read(name string, rang *Range, dest io.Writer, progress chan int64) error
- func (l *Local) ReadDir(dir string, opts ListOption) ([]fs.FileInfo, error)
- func (l *Local) Rename(old, new string) error
- func (l *Local) SetCheckpoint(name string) (int64, error)
- func (l *Local) Stat(name string) (os.FileInfo, error)
- func (l *Local) String() string
- func (l *Local) Write(name string, source io.ReadSeeker, size int64, progress chan int64) error
- type LocalConfig
- type Range
- type S3
- func (s *S3) Close() error
- func (s *S3) Delete(name string) error
- func (s *S3) GetCheckpoint(name string) int64
- func (s *S3) Read(name string, rang *Range, dest io.Writer, progress chan int64) error
- func (s *S3) ReadDir(dir string, opts ListOption) ([]fs.FileInfo, error)
- func (s *S3) Rename(old, new string) error
- func (s *S3) SetCheckpoint(name string) (int64, error)
- func (s *S3) Stat(name string) (fs.FileInfo, error)
- func (s *S3) String() string
- func (s *S3) Write(name string, source io.ReadSeeker, size int64, progress chan int64) error
- type SFTP
- func (s *SFTP) Close() error
- func (s *SFTP) Delete(name string) error
- func (s *SFTP) GetCheckpoint(name string) int64
- func (s *SFTP) Read(name string, rang *Range, dest io.Writer, progress chan int64) error
- func (s *SFTP) ReadDir(dir string, opts ListOption) ([]fs.FileInfo, error)
- func (s *SFTP) Rename(old, new string) error
- func (s *SFTP) SetCheckpoint(name string) (int64, error)
- func (s *SFTP) Stat(name string) (os.FileInfo, error)
- func (s *SFTP) String() string
- func (s *SFTP) Write(name string, source io.ReadSeeker, size int64, progress chan int64) error
- type Source
- type Storage
- func NewFirebase(connectionUrl string) (Storage, error)
- func OpenLocal(connectionUrl string) (Storage, error)
- func OpenS3(connectionUrl string) (Storage, error)
- func OpenSFTP(connectionUrl string) (Storage, error)
- func OpenStorage(connectionUrl string) (Storage, error)
- func OpenWebDAV(connectionUrl string) (Storage, error)
- type WebDAV
- func (w *WebDAV) Close() error
- func (w *WebDAV) Delete(name string) error
- func (w *WebDAV) Read(name string, rang *Range, dest io.Writer, progress chan int64) error
- func (w *WebDAV) ReadDir(dir string, opts ListOption) ([]fs.FileInfo, error)
- func (w *WebDAV) Rename(old, new string) error
- func (w *WebDAV) Stat(name string) (fs.FileInfo, error)
- func (w *WebDAV) String() string
- func (w *WebDAV) Write(name string, source io.ReadSeeker, size int64, progress chan int64) error
Constants ¶
View Source
const SizeAll = -1
Variables ¶
View Source
var SampleConfig = []string{
"sftp://username:password@hostname?key=key",
"s3://accessKey:secret@s3.eu-central-1.amazonaws.com/bucket",
"file://path",
}
Functions ¶
func UnlockFile ¶
Types ¶
type Firebase ¶
type Firebase struct {
// contains filtered or unexported fields
}
func (*Firebase) GetCheckpoint ¶
type FirebaseConfig ¶
type FirebaseConfig struct {
Base string `json:"base" yaml:"base"`
}
type ListOption ¶
type ListOption uint32
const ( // IncludeHiddenFiles includes hidden files in a list operation IncludeHiddenFiles ListOption = 1 )
type Local ¶
type Local struct {
// contains filtered or unexported fields
}
func (*Local) GetCheckpoint ¶
type LocalConfig ¶
type LocalConfig struct {
Base string `json:"base" yaml:"base"`
}
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
func (*S3) GetCheckpoint ¶
type SFTP ¶
type SFTP struct {
// contains filtered or unexported fields
}
func (*SFTP) GetCheckpoint ¶
type Storage ¶
type Storage interface { // Read reads data from a file into a writer Read(name string, rang *Range, dest io.Writer, progress chan int64) error // Write writes data to a file name. An existing file is overwritten Write(name string, source io.ReadSeeker, size int64, progress chan int64) error //ReadDir returns the entries of a folder content ReadDir(name string, opts ListOption) ([]fs.FileInfo, error) // Stat provides statistics about a file Stat(name string) (os.FileInfo, error) // Rename a file. Overwrite an existing file if present Rename(old, new string) error // Delete deletes a file Delete(name string) error // Close releases resources Close() error // String returns a human-readable representation of the storer (e.g. sftp://user@host.cc/path) String() string }
Storage is a low level interface to storage services such as S3 or SFTP
func NewFirebase ¶
func OpenStorage ¶
OpenStorage creates a new exchanger giving a provided configuration
func OpenWebDAV ¶
Click to show internal directories.
Click to hide internal directories.