Help us shape the future of Go! Take the 2026 Go Developer Survey

fetch

package
v0.10.1 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRcloneConfig = "/etc/rclone.conf"

Variables

View Source
var LoadedRemotes []string

FetchContext holds global configuration settings for the fetch package.

Functions

func CleanConfig

func CleanConfig(tempPath string)

func CleanOperation

func CleanOperation(op *Operation)

func Copy

func Copy(remotes *pb.RcloneRemotes, srcStr, dstStr string) error

func CopyFilesWithProgress

func CopyFilesWithProgress(srcFs fs.Fs, srcPath string, dstFs fs.Fs, dstPath string) error

func GetMD5

func GetMD5(f fs.DirEntry) string

provide MD5

func Info

func Info(remotes *pb.RcloneRemotes, srcStr string) (fs.DirEntry, error)

func IsDir

func IsDir(f fs.DirEntry) bool

test if a DirEntry is a dir

func IsFile

func IsFile(f fs.DirEntry) bool

test if a DirEntry is a file

func Join

func Join(path, file string) string

func List

func List(remotes *pb.RcloneRemotes, srcStr string) ([]string, error)

func Purge added in v0.9.3

func Purge(ctx context.Context, uriStr string) error

Purge recursively removes everything under the given URI. Used by workflow-lifetime output cleanup (spec: outputs.lifetime = workflow): once a workflow reaches S, the server sweeps the workspace copies of intermediate outputs the author declared as ephemeral.

Purge is idempotent-ish: rclone returns fs.ErrorDirNotFound (or the backend's equivalent) when the directory is already gone, which we treat as success. Any other error is bubbled up so the caller can log it / raise an event.

The URI is resolved through the same ParseURI + uriToRcloneString path the copy code uses, so any backend rclone knows about (via /etc/rclone.conf) works. The trailing slash convention on the URI doesn't matter — Purge operates on a directory prefix either way.

func RawList

func RawList(remotes *pb.RcloneRemotes, srcStr string) (fs.DirEntries, error)

Types

type AsperaBackend

type AsperaBackend struct{}

AsperaBackend represents an Aspera (FASP) backend that supports only copying to LocalBackend.

func NewAsperaBackend

func NewAsperaBackend() *AsperaBackend

NewAsperaBackend initializes an AsperaBackend.

func (*AsperaBackend) Copy

func (ab *AsperaBackend) Copy(otherFs FileSystemInterface, src, dst URI, selfIsSource bool) error

Copy implements the Copy method for AsperaBackend. Supports only copying to a local backend.

func (*AsperaBackend) Info

func (rb *AsperaBackend) Info(path string) (fs.DirEntry, error)

func (*AsperaBackend) List

func (ab *AsperaBackend) List(path string) (fs.DirEntries, error)

func (*AsperaBackend) Mkdir

func (rb *AsperaBackend) Mkdir(path string) error

type FastqBackend

type FastqBackend struct{}

FastqBackend handles downloading FASTQ files using FTP, Aspera, or SRA.

func NewFastqBackend

func NewFastqBackend() *FastqBackend

NewFastqBackend initializes a FastqBackend.

func (*FastqBackend) Copy

func (fb *FastqBackend) Copy(otherFs FileSystemInterface, src, dst URI, selfIsSource bool) error

Copy implements the Copy method for FastqBackend.

func (*FastqBackend) Info

func (fb *FastqBackend) Info(path string) (fs.DirEntry, error)

func (*FastqBackend) List

func (fb *FastqBackend) List(path string) (fs.DirEntries, error)

List, Mkdir and Info are not supported for FastqBackend

func (*FastqBackend) Mkdir

func (fb *FastqBackend) Mkdir(path string) error

type FileSystemInterface

type FileSystemInterface interface {
	Copy(otherFs FileSystemInterface, src, dst URI, isSelfSource bool) error
	List(path string) (fs.DirEntries, error)
	Mkdir(path string) error
	Info(path string) (fs.DirEntry, error)
}

FileSystemInterface defines the methods for file operations.

type LocalBackend

type LocalBackend struct {
	RcloneBackend
	// contains filtered or unexported fields
}

LocalBackend implements a local FileSystemInterface using rclone but is also capable of working with other backends

func NewLocalBackend

func NewLocalBackend(ctx context.Context, component string) (*LocalBackend, error)

NewLocalBackend creates a new LocalBackend.

func (LocalBackend) AbsolutePath

func (lb LocalBackend) AbsolutePath(path string) (string, error)

type MetaFileSystem

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

MetaFileSystem provides common functionality for file operations using any FileSystemInterface.

func NewMetaFileSystem

func NewMetaFileSystem(fs FileSystemInterface, err error) (*MetaFileSystem, error)

NewMetaFileSystem creates a new MetaFileSystem with the given FileSystemInterface.

func (*MetaFileSystem) RecursiveCopy

func (mfs *MetaFileSystem) RecursiveCopy(otherFs MetaFileSystem, src, dst URI, isSelfSource bool) error

RecursiveCopy performs a recursive copy using the embedded FileSystemInterface.

type Operation

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

func NewOperation

func NewOperation(remotes *pb.RcloneRemotes, srcStr, dstStr string) (*Operation, error)

func (*Operation) Copy

func (op *Operation) Copy() error

func (*Operation) Info

func (op *Operation) Info() (fs.DirEntry, error)

func (*Operation) List

func (op *Operation) List() (fs.DirEntries, error)

func (*Operation) SrcBase

func (op *Operation) SrcBase() string

type RcloneBackend

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

RcloneBackend implements the FileSystemInterface using rclone.

func NewRcloneBackend

func NewRcloneBackend(ctx context.Context, remote string) (*RcloneBackend, error)

NewRcloneBackend creates a new RcloneBackend.

func (*RcloneBackend) Copy

func (rb *RcloneBackend) Copy(otherFsInterface FileSystemInterface, src, dst URI, selfIsSource bool) error

Copy implements the Copy method for RcloneBackend.

func (*RcloneBackend) Info

func (rb *RcloneBackend) Info(path string) (fs.DirEntry, error)

func (*RcloneBackend) List

func (rb *RcloneBackend) List(path string) (fs.DirEntries, error)

func (*RcloneBackend) Mkdir

func (rb *RcloneBackend) Mkdir(path string) error

Mkdir implements the Mkdir method for RcloneBackend.

type URI

type URI struct {
	Proto     string
	Options   []string
	User      string
	Password  string
	Component string
	Path      string
	File      string
	Separator string
	Actions   []string
}

func ParseURI

func ParseURI(uri_string string) (*URI, error)

ParseURI parses a URI using a regular expression and returns the appropriate backend and path.

func (URI) CompletePath

func (uri URI) CompletePath() string

func (URI) String

func (uri URI) String() string

func (URI) Subpath

func (uri URI) Subpath(path string) URI

Jump to

Keyboard shortcuts

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