remote

package
v0.163.1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CacheDir

func CacheDir() string

func HttpFileExists added in v0.158.0

func HttpFileExists(path string) error

func IsRemote

func IsRemote(goGetterSrc string) bool

func ParseNormalProtocol added in v0.158.0

func ParseNormalProtocol(path string) (string, error)

func ParseS3Url added in v0.158.0

func ParseS3Url(s3URL string) (string, string, error)

Types

type Getter

type Getter interface {
	Get(wd, src, dst string) error
}

type GoGetter

type GoGetter struct {
	Logger *zap.SugaredLogger
}

func (*GoGetter) Get

func (g *GoGetter) Get(wd, src, dst string) error

type HttpGetter added in v0.158.0

type HttpGetter struct {
	Logger *zap.SugaredLogger
}

func (*HttpGetter) Get added in v0.158.0

func (g *HttpGetter) Get(wd, src, dst string) error

type InvalidURLError

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

func (InvalidURLError) Error

func (e InvalidURLError) Error() string

type Remote

type Remote struct {
	Logger *zap.SugaredLogger

	// Home is the directory in which remote downloads files. If empty, user cache directory is used
	Home string

	// Getter is the underlying implementation of getter used for fetching remote files
	Getter Getter

	S3Getter Getter

	HttpGetter Getter
	// contains filtered or unexported fields
}

func NewRemote

func NewRemote(logger *zap.SugaredLogger, homeDir string, fs *filesystem.FileSystem) *Remote

func (*Remote) Fetch

func (r *Remote) Fetch(path string, cacheDirOpt ...string) (string, error)

func (*Remote) Locate

func (r *Remote) Locate(urlOrPath string, cacheDirOpt ...string) (string, error)

Locate takes an URL to a remote file or a path to a local file. If the argument was an URL, it fetches the remote directory contained within the URL, and returns the path to the file in the fetched directory

type S3Getter added in v0.158.0

type S3Getter struct {
	Logger *zap.SugaredLogger
}

func (*S3Getter) Get added in v0.158.0

func (g *S3Getter) Get(wd, src, dst string) error

func (*S3Getter) S3FileExists added in v0.158.0

func (g *S3Getter) S3FileExists(path string) (string, error)

type Source

type Source struct {
	Getter, Scheme, User, Host, Dir, File, RawQuery string
}

func Parse

func Parse(goGetterSrc string) (*Source, error)

func ParseNormal added in v0.158.0

func ParseNormal(path string) (*Source, error)

Jump to

Keyboard shortcuts

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