rclonecli

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExitCode

func ExitCode(err error) (int, bool)

ExitCode returns the numeric exit code when available.

func TestConnection

func TestConnection(
	ctx context.Context,
	rcUrl string,
	rcUser string,
	rcPass string,
	vfsName string,
	httpClient *http.Client,
) error

func WasHardTerminated

func WasHardTerminated(err error) bool

WasHardTerminated reports true iff the process was ended by SIGKILL or SIGTERM.

Types

type Manager

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

Manager handles the rclone RC server and provides mount operations

func NewManager

func NewManager(cfm *config.Manager) *Manager

NewManager creates a new rclone RC manager

func (*Manager) GetAllMounts

func (m *Manager) GetAllMounts() map[string]*MountInfo

GetAllMounts returns information about all mounts

func (*Manager) GetLogger

func (m *Manager) GetLogger() *slog.Logger

func (*Manager) GetMountInfo

func (m *Manager) GetMountInfo(provider string) (*MountInfo, bool)

GetMountInfo returns information about a specific mount

func (*Manager) IsMounted

func (m *Manager) IsMounted(provider string) bool

IsMounted checks if a provider is mounted

func (*Manager) IsReady

func (m *Manager) IsReady() bool

IsReady returns true if the RC server is ready

func (*Manager) MonitorMounts

func (m *Manager) MonitorMounts(ctx context.Context)

MonitorMounts continuously monitors mount health and attempts recovery

func (*Manager) Mount

func (m *Manager) Mount(ctx context.Context, provider, mountPath, webdavURL string) error

Mount creates a mount using the rclone RC API with retry logic

func (*Manager) RecoverMount

func (m *Manager) RecoverMount(ctx context.Context, provider string) error

RecoverMount attempts to recover a failed mount

func (*Manager) RefreshDir

func (m *Manager) RefreshDir(ctx context.Context, provider string, dirs []string) error

RefreshDir refreshes directories in the VFS cache

func (*Manager) Start

func (m *Manager) Start(ctx context.Context) error

Start starts the rclone RC server

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops the rclone RC server and unmounts all mounts

func (*Manager) Unmount

func (m *Manager) Unmount(ctx context.Context, provider string) error

Unmount unmounts a specific provider

func (*Manager) UnmountAll

func (m *Manager) UnmountAll(ctx context.Context) error

UnmountAll unmounts all mounts

func (*Manager) WaitForReady

func (m *Manager) WaitForReady(timeout time.Duration) error

WaitForReady waits for the RC server to be ready

type Mount

type Mount struct {
	Provider  string
	LocalPath string
	WebDAVURL string
	// contains filtered or unexported fields
}

Mount represents a mount using the rclone RC client

func NewMount

func NewMount(provider, mountPath, webdavURL string, rcManager *Manager) *Mount

NewMount creates a new RC-based mount

func (*Mount) GetMountInfo

func (m *Mount) GetMountInfo() (*MountInfo, bool)

GetMountInfo returns mount information

func (*Mount) IsMounted

func (m *Mount) IsMounted() bool

IsMounted checks if the mount is active via RC

func (*Mount) Mount

func (m *Mount) Mount(ctx context.Context) error

Mount creates the mount using rclone RC

func (*Mount) Unmount

func (m *Mount) Unmount(ctx context.Context) error

Unmount removes the mount using rclone RC

type MountInfo

type MountInfo struct {
	Provider   string `json:"provider"`
	LocalPath  string `json:"local_path"`
	WebDAVURL  string `json:"webdav_url"`
	Mounted    bool   `json:"mounted"`
	MountedAt  string `json:"mounted_at,omitempty"`
	ConfigName string `json:"config_name"`
	Error      string `json:"error,omitempty"`
}

type RCRequest

type RCRequest struct {
	Command string         `json:"command"`
	Args    map[string]any `json:"args,omitempty"`
}

type RCResponse

type RCResponse struct {
	Result any    `json:"result,omitempty"`
	Error  string `json:"error,omitempty"`
}

type RcloneRcClient

type RcloneRcClient interface {
	RefreshDir(ctx context.Context, provider string, dirs []string) error
}

func NewRcloneRcClient

func NewRcloneRcClient(
	config *config.Manager,
	httpClient *http.Client,
) RcloneRcClient

Jump to

Keyboard shortcuts

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