repository

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnsupportedRepository = errors.New("Unsupported repository")

Functions

func CopyWithMeter

func CopyWithMeter(dest io.Writer, src io.Reader, meter *Meter) (int64, error)

func IsAzureStorageUrl added in v0.8.0

func IsAzureStorageUrl(repoUrl string) bool

func ParseAzureBlobUrl added in v0.8.0

func ParseAzureBlobUrl(urlString string) (storageAccount, container, prefix string, err error)

func ParseRepoName added in v0.10.0

func ParseRepoName(result RepoParseResult) (string, error)

Types

type AzureBlobRepository added in v0.8.0

type AzureBlobRepository struct {
	Client   *azblob.ContainerClient
	Prefix   string
	BasePath string
}

func NewAzureBlobRepository added in v0.8.0

func NewAzureBlobRepository(repo string) (*AzureBlobRepository, error)

func (*AzureBlobRepository) Delete added in v0.8.0

func (repo *AzureBlobRepository) Delete(repoPath string) error

func (*AzureBlobRepository) Download added in v0.8.0

func (repo *AzureBlobRepository) Download(repoPath, localPath string, m *Meter) error

func (*AzureBlobRepository) List added in v0.8.0

func (repo *AzureBlobRepository) List(repoPath string) ([]FileInfo, error)

func (*AzureBlobRepository) Stat added in v0.8.0

func (repo *AzureBlobRepository) Stat(repoPath string) (FileInfo, error)

func (*AzureBlobRepository) Upload added in v0.8.0

func (repo *AzureBlobRepository) Upload(localPath, repoPath string, m *Meter) error

type ByteSize

type ByteSize float64
const (
	KB ByteSize = 1 << (10 * iota)
	MB
	GB
	TB
	PB
	EB
	ZB
	YB
)

func (ByteSize) String

func (b ByteSize) String() string

type FileInfo

type FileInfo interface {
	Name() string
	IsDir() bool
}

type GCSFileInfo added in v0.8.0

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

func (*GCSFileInfo) IsDir added in v0.8.0

func (fi *GCSFileInfo) IsDir() bool

func (*GCSFileInfo) Name added in v0.8.0

func (fi *GCSFileInfo) Name() string

type GCSRepository added in v0.8.0

type GCSRepository struct {
	Bucket   string
	BasePath string
	Client   *storage.Client
}

Local Filesystem

func NewGCSRepository added in v0.8.0

func NewGCSRepository(bucket, basePath string) (*GCSRepository, error)

func (*GCSRepository) Delete added in v0.8.0

func (repo *GCSRepository) Delete(repoPath string) error

func (*GCSRepository) Download added in v0.8.0

func (repo *GCSRepository) Download(repoPath, localPath string, m *Meter) error

func (*GCSRepository) List added in v0.8.0

func (repo *GCSRepository) List(repoPath string) ([]FileInfo, error)

func (*GCSRepository) Stat added in v0.8.0

func (repo *GCSRepository) Stat(repoPath string) (FileInfo, error)

func (*GCSRepository) Upload added in v0.8.0

func (repo *GCSRepository) Upload(localPath, repoPath string, m *Meter) error

type HttpFileInfo

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

func (*HttpFileInfo) IsDir

func (info *HttpFileInfo) IsDir() bool

func (*HttpFileInfo) Name

func (info *HttpFileInfo) Name() string

type HttpRepository

type HttpRepository struct {
	RepoUrl string
}

func NewHttpRepository

func NewHttpRepository(repo string) (*HttpRepository, error)

func (*HttpRepository) Delete

func (repo *HttpRepository) Delete(repoPath string) error

func (*HttpRepository) Download

func (repo *HttpRepository) Download(repoPath, localPath string, m *Meter) error

func (*HttpRepository) List

func (repo *HttpRepository) List(repoPath string) ([]FileInfo, error)

func (*HttpRepository) Stat

func (repo *HttpRepository) Stat(repoPath string) (FileInfo, error)

func (*HttpRepository) Upload

func (repo *HttpRepository) Upload(localPath, repoPath string, meter *Meter) error

type LocalFileSystemRepository

type LocalFileSystemRepository struct {
	RepoDir string
}

Local Filesystem

func NewLocalFileSystemRepository

func NewLocalFileSystemRepository(repoDir string) (*LocalFileSystemRepository, error)

func (*LocalFileSystemRepository) Delete

func (repo *LocalFileSystemRepository) Delete(repoPath string) error

func (*LocalFileSystemRepository) Download

func (repo *LocalFileSystemRepository) Download(repoPath, localPath string, m *Meter) error

func (*LocalFileSystemRepository) List

func (repo *LocalFileSystemRepository) List(repoPath string) ([]FileInfo, error)

func (*LocalFileSystemRepository) Stat

func (repo *LocalFileSystemRepository) Stat(repoPath string) (FileInfo, error)

func (*LocalFileSystemRepository) Upload

func (repo *LocalFileSystemRepository) Upload(localPath, repoPath string, m *Meter) error

type Meter

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

func (*Meter) AddBytes

func (m *Meter) AddBytes(bytes int)

func (*Meter) SetBytes

func (m *Meter) SetBytes(bytes int64)

func (*Meter) Write

func (m *Meter) Write(p []byte) (n int, err error)

type RcloneFileInfo added in v0.7.0

type RcloneFileInfo struct {
	Name_  string `json:"Name"`
	IsDir_ bool   `json:"IsDir"`
}

func (*RcloneFileInfo) IsDir added in v0.7.0

func (e *RcloneFileInfo) IsDir() bool

func (*RcloneFileInfo) Name added in v0.7.0

func (e *RcloneFileInfo) Name() string

type RcloneRepository

type RcloneRepository struct {
	Remote  string
	BaseDir string
}

Local Filesystem

func NewRcloneRepository

func NewRcloneRepository(remote, basePath string) (*RcloneRepository, error)

func (*RcloneRepository) Delete

func (repo *RcloneRepository) Delete(repoPath string) error

func (*RcloneRepository) Download

func (repo *RcloneRepository) Download(repoPath, localPath string, m *Meter) error

func (*RcloneRepository) List

func (repo *RcloneRepository) List(repoPath string) ([]FileInfo, error)

func (*RcloneRepository) Stat

func (repo *RcloneRepository) Stat(repoPath string) (FileInfo, error)

func (*RcloneRepository) Upload

func (repo *RcloneRepository) Upload(localPath, repoPath string, m *Meter) error

type RepoParseResult added in v0.10.0

type RepoParseResult struct {
	Repo string
	// contains filtered or unexported fields
}

func ParseRepo added in v0.10.0

func ParseRepo(repo string) (RepoParseResult, error)

type Repository

type Repository interface {
	Upload(localPath, repoPath string, meter *Meter) error
	Download(repoPath, localPath string, meter *Meter) error
	Delete(repoPath string) error
	Stat(repoPath string) (FileInfo, error)
	List(repoPath string) ([]FileInfo, error)
}

func NewRepository

func NewRepository(result RepoParseResult) (Repository, error)

type S3FileInfo added in v0.7.0

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

func (*S3FileInfo) IsDir added in v0.7.0

func (fi *S3FileInfo) IsDir() bool

func (*S3FileInfo) Name added in v0.7.0

func (fi *S3FileInfo) Name() string

type S3Repository

type S3Repository struct {
	Bucket   string
	BasePath string
	// contains filtered or unexported fields
}

func NewS3Repository

func NewS3Repository(bucket, basePath string) (*S3Repository, error)

func (*S3Repository) Delete

func (repo *S3Repository) Delete(repoPath string) error

func (*S3Repository) Download

func (repo *S3Repository) Download(repoPath, localPath string, m *Meter) error

func (*S3Repository) List

func (repo *S3Repository) List(repoPath string) ([]FileInfo, error)

func (*S3Repository) Stat

func (repo *S3Repository) Stat(repoPath string) (FileInfo, error)

func (*S3Repository) Upload

func (repo *S3Repository) Upload(localPath, repoPath string, m *Meter) error

type SSHRepository added in v0.7.0

type SSHRepository struct {
	BaseDir    string
	SSHClient  *ssh.Client
	SFTPClient *sftp.Client
}

func NewSSHRepository added in v0.7.0

func NewSSHRepository(hostname, basePath string) (*SSHRepository, error)

func (*SSHRepository) Delete added in v0.7.0

func (repo *SSHRepository) Delete(repoPath string) error

func (*SSHRepository) Download added in v0.7.0

func (repo *SSHRepository) Download(repoPath, localPath string, m *Meter) error

func (*SSHRepository) List added in v0.7.0

func (repo *SSHRepository) List(repoPath string) ([]FileInfo, error)

func (*SSHRepository) Stat added in v0.7.0

func (repo *SSHRepository) Stat(repoPath string) (FileInfo, error)

func (*SSHRepository) Upload added in v0.7.0

func (repo *SSHRepository) Upload(localPath, repoPath string, m *Meter) error

type Session

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

func NewSession

func NewSession() *Session

func (*Session) CalculateSpeed

func (s *Session) CalculateSpeed() ByteSize

func (*Session) NewMeter

func (s *Session) NewMeter() *Meter

type SimpleFileInfo added in v0.8.0

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

func (*SimpleFileInfo) IsDir added in v0.8.0

func (fi *SimpleFileInfo) IsDir() bool

func (*SimpleFileInfo) Name added in v0.8.0

func (fi *SimpleFileInfo) Name() string

type UnsupportedRepositoryError

type UnsupportedRepositoryError struct {
	Message string
}

func (UnsupportedRepositoryError) Error

func (err UnsupportedRepositoryError) Error() string

Jump to

Keyboard shortcuts

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