Documentation ¶
Overview ¶
Package rigfs provides fs.FS implementations for remote filesystems.
Index ¶
- Variables
- type File
- type FileInfo
- func (f *FileInfo) FullPath() string
- func (f *FileInfo) Info() (fs.FileInfo, error)
- func (f *FileInfo) IsDir() bool
- func (f *FileInfo) ModTime() time.Time
- func (f *FileInfo) Mode() fs.FileMode
- func (f *FileInfo) Name() string
- func (f *FileInfo) Size() int64
- func (f *FileInfo) Sys() any
- func (f *FileInfo) Type() fs.FileMode
- func (f *FileInfo) UnmarshalJSON(b []byte) error
- type FileMode
- type Fsys
- type PosixDir
- type PosixFile
- func (f *PosixFile) Close() error
- func (f *PosixFile) Copy(dst io.Writer) (int64, error)
- func (f *PosixFile) CopyFromN(src io.Reader, num int64, alt io.Writer) (int64, error)
- func (f *PosixFile) Read(p []byte) (int, error)
- func (f *PosixFile) Seek(offset int64, whence int) (int64, error)
- func (f *PosixFile) Stat() (fs.FileInfo, error)
- func (f *PosixFile) Write(p []byte) (int, error)
- type PosixFsys
- func (fsys *PosixFsys) MkDirAll(name string, perm FileMode) error
- func (fsys *PosixFsys) Open(name string) (fs.File, error)
- func (fsys *PosixFsys) OpenFile(name string, mode FileMode, perm FileMode) (File, error)
- func (fsys *PosixFsys) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *PosixFsys) Remove(name string) error
- func (fsys *PosixFsys) RemoveAll(name string) error
- func (fsys *PosixFsys) Sha256(name string) (string, error)
- func (fsys *PosixFsys) Stat(name string) (fs.FileInfo, error)
- type Waiter
- type WinFsys
- func (fsys *WinFsys) MkDirAll(name string, _ FileMode) error
- func (fsys *WinFsys) Open(name string) (fs.File, error)
- func (fsys *WinFsys) OpenFile(name string, mode FileMode, _ FileMode) (File, error)
- func (fsys *WinFsys) ReadDir(name string) ([]fs.DirEntry, error)
- func (fsys *WinFsys) Remove(name string) error
- func (fsys *WinFsys) RemoveAll(name string) error
- func (fsys *WinFsys) Sha256(name string) (string, error)
- func (fsys *WinFsys) Stat(name string) (fs.FileInfo, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNotRunning is returned when the rigrcp process is not running ErrNotRunning = errors.New("rigrcp is not running") // ErrRcpCommandFailed is returned when a command to the rigrcp process fails ErrRcpCommandFailed = errors.New("rigrcp command failed") )
var ErrCommandFailed = errors.New("command failed")
ErrCommandFailed is returned when a remote command fails
Functions ¶
This section is empty.
Types ¶
type File ¶
type File interface { fs.File io.WriteCloser io.Seeker Copy(io.Writer) (int64, error) CopyFromN(io.Reader, int64, io.Writer) (int64, error) }
File is a file in the remote filesystem
type FileInfo ¶
type FileInfo struct { FName string `json:"name"` FSize int64 `json:"size"` FMode fs.FileMode `json:"mode"` FUnix fs.FileMode `json:"unixMode"` FModTime time.Time `json:"-"` FIsDir bool `json:"isDir"` ModtimeS int64 `json:"modTime"` // contains filtered or unexported fields }
FileInfo implements fs.FileInfo for stat on remote files
func (*FileInfo) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler
type FileMode ¶
type FileMode int
FileMode is used to set the type of allowed operations when opening remote files
const ( ModeRead FileMode = 1 // ModeRead = Read only ModeWrite FileMode = 2 // ModeWrite = Write only ModeReadWrite FileMode = ModeRead | ModeWrite // ModeReadWrite = Read and Write ModeCreate FileMode = 4 | ModeWrite // ModeCreate = Create a new file or truncate an existing one. Includes write permission. ModeAppend FileMode = 8 | ModeCreate // ModeAppend = Append to an existing file. Includes create and write permissions. )
type Fsys ¶
type Fsys interface { fs.FS OpenFile(string, FileMode, FileMode) (File, error) Sha256(string) (string, error) Stat(string) (fs.FileInfo, error) Remove(string) error RemoveAll(string) error MkDirAll(string, FileMode) error }
Fsys is a filesystem on the remote host
type PosixDir ¶
type PosixDir struct { PosixFile // contains filtered or unexported fields }
PosixDir implements fs.ReadDirFile for a remote directory
type PosixFile ¶
type PosixFile struct {
// contains filtered or unexported fields
}
PosixFile implements fs.File for a remote file
func (*PosixFile) Close ¶
Close closes the file, rendering it unusable for I/O. It returns an error, if any.
func (*PosixFile) CopyFromN ¶
CopyFromN copies n bytes from the remote file at src to the local file at dst
func (*PosixFile) Read ¶
Read reads up to len(p) bytes into p. It returns the number of bytes read (0 <= n <= len(p)) and any error encountered.
func (*PosixFile) Seek ¶
Seek sets the offset for the next Read or Write to offset, interpreted according to whence: 0 means relative to the origin of the file, 1 means relative to the current offset, and 2 means relative to the end. Seek returns the new offset relative to the start of the file and an error, if any.
type PosixFsys ¶
type PosixFsys struct {
// contains filtered or unexported fields
}
PosixFsys implements fs.FS for a remote filesystem that uses POSIX commands for access
func NewPosixFsys ¶
NewPosixFsys returns a fs.FS implementation for a remote filesystem that uses POSIX commands for access
func (*PosixFsys) MkDirAll ¶ added in v0.12.0
MkDirAll creates a new directory structure with the specified name and permission bits. If the directory already exists, MkDirAll does nothing and returns nil.
func (*PosixFsys) OpenFile ¶
OpenFile is the generalized open call; most users will use Open instead.
func (*PosixFsys) ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory entries
type Waiter ¶
type Waiter interface {
Wait() error
}
Waiter is an interface that has a Wait() function that blocks until a command is finished
type WinFsys ¶
type WinFsys struct {
// contains filtered or unexported fields
}
WinFsys is a fs.FS implementation for remote Windows hosts
func NewWindowsFsys ¶
NewWindowsFsys returns a new fs.FS implementing filesystem for Windows targets
func (*WinFsys) MkDirAll ¶ added in v0.12.0
MkDirAll creates a directory named path, along with any necessary parents. The permission bits perm are ignored on Windows.
func (*WinFsys) Open ¶
Open opens the named file for reading and returns fs.File. Use OpenFile to get a file that can be written to or if you need any of the methods not available on fs.File interface without type assertion.
func (*WinFsys) OpenFile ¶
OpenFile opens the named remote file with the specified FileMode. Permission bits are ignored on Windows.
func (*WinFsys) ReadDir ¶
ReadDir reads the directory named by dirname and returns a list of directory entries.
func (*WinFsys) RemoveAll ¶ added in v0.12.0
RemoveAll deletes the named file or directory and all its child items