workspacefs

package
v1.0.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 17, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Mount

func Mount(ctx context.Context, backend *FileSystem, mountpoint string) (*fuse.Server, error)

Types

type FileSystem

type FileSystem struct {
	// contains filtered or unexported fields
}

func New

func New(sftp SFTPClient, root string, log *slog.Logger) *FileSystem

func (*FileSystem) Chmod

func (f *FileSystem) Chmod(ctx context.Context, rel string, mode os.FileMode) syscall.Errno

func (*FileSystem) CreateFile

func (f *FileSystem) CreateFile(ctx context.Context, rel string) syscall.Errno

func (*FileSystem) MkDir

func (f *FileSystem) MkDir(ctx context.Context, rel string) syscall.Errno

func (*FileSystem) ReadDir

func (f *FileSystem) ReadDir(rel string) ([]os.FileInfo, syscall.Errno)

func (*FileSystem) ReadFile

func (f *FileSystem) ReadFile(ctx context.Context, rel string, off int64, size int) ([]byte, syscall.Errno)

func (*FileSystem) Rename

func (f *FileSystem) Rename(ctx context.Context, oldRel, newRel string) syscall.Errno

func (*FileSystem) Rmdir

func (f *FileSystem) Rmdir(ctx context.Context, rel string) syscall.Errno

func (*FileSystem) Stat

func (f *FileSystem) Stat(rel string) (os.FileInfo, syscall.Errno)

func (*FileSystem) Truncate

func (f *FileSystem) Truncate(ctx context.Context, rel string, size int64) syscall.Errno
func (f *FileSystem) Unlink(ctx context.Context, rel string) syscall.Errno

func (*FileSystem) WriteFile

func (f *FileSystem) WriteFile(ctx context.Context, rel string, data []byte, off int64) (uint32, syscall.Errno)

type RemoteFile

type RemoteFile interface {
	ReadAt(p []byte, off int64) (int, error)
	Close() error
}

type RemoteWriteFile

type RemoteWriteFile interface {
	WriteAt(p []byte, off int64) (int, error)
	Close() error
}

type SFTPAdapter

type SFTPAdapter struct {
	C *sftp.Client
}

SFTPAdapter wraps *sftp.Client so it satisfies the SFTPClient interface. The underlying sftp methods return *sftp.File, which implements both RemoteFile and RemoteWriteFile, but Go requires exact return-type matches for interface satisfaction, so we wrap the calls.

func (*SFTPAdapter) Chmod

func (a *SFTPAdapter) Chmod(path string, mode os.FileMode) error

func (*SFTPAdapter) Create

func (a *SFTPAdapter) Create(path string) (RemoteWriteFile, error)

func (*SFTPAdapter) Mkdir

func (a *SFTPAdapter) Mkdir(path string) error

func (*SFTPAdapter) Open

func (a *SFTPAdapter) Open(path string) (RemoteFile, error)

func (*SFTPAdapter) OpenFile

func (a *SFTPAdapter) OpenFile(path string, flags int) (RemoteWriteFile, error)

func (*SFTPAdapter) ReadDir

func (a *SFTPAdapter) ReadDir(path string) ([]os.FileInfo, error)

func (*SFTPAdapter) Remove

func (a *SFTPAdapter) Remove(path string) error

func (*SFTPAdapter) Rename

func (a *SFTPAdapter) Rename(oldpath, newpath string) error

func (*SFTPAdapter) Stat

func (a *SFTPAdapter) Stat(path string) (os.FileInfo, error)

func (*SFTPAdapter) Truncate

func (a *SFTPAdapter) Truncate(path string, size int64) error

type SFTPClient

type SFTPClient interface {
	Open(path string) (RemoteFile, error)
	Create(path string) (RemoteWriteFile, error)
	OpenFile(path string, flags int) (RemoteWriteFile, error)
	Stat(path string) (os.FileInfo, error)
	ReadDir(path string) ([]os.FileInfo, error)
	Mkdir(path string) error
	Remove(path string) error
	Rename(oldpath, newpath string) error
	Chmod(path string, mode os.FileMode) error
	Truncate(path string, size int64) error
}

SFTPClient is the subset of pkg/sftp client methods required by the filesystem.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL