fs

package
v2.2.0-20240131 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveAndUploadFilesToS3

func ArchiveAndUploadFilesToS3(fileTree fs.FS, names []string, s3Base string, logger *zap.SugaredLogger) error

func ArchiveAndUploadFilesToSpecifiedS3

func ArchiveAndUploadFilesToSpecifiedS3(fileTree fs.FS, names []string, s3Base, s3Id string, logger *zap.SugaredLogger) error

func CopyAndUploadFiles

func CopyAndUploadFiles(names []string, localBase, s3Base, zipPath, currentChartPath string, logger *zap.SugaredLogger) error

CopyAndUploadFiles copy a tree of files to other dir, at the same time, archives them and uploads to object storage.

func DeleteArchivedFileFromS3

func DeleteArchivedFileFromS3(names []string, s3Base string, logger *zap.SugaredLogger) error

func DownloadAndCopyFilesFromGerrit

func DownloadAndCopyFilesFromGerrit(name, localBase string, logger *zap.SugaredLogger) error

func DownloadAndCopyFilesFromGitee

func DownloadAndCopyFilesFromGitee(name, localBase string, logger *zap.SugaredLogger) error

func DownloadAndExtractFilesFromS3

func DownloadAndExtractFilesFromS3(name, localBase, s3Base string, logger *zap.SugaredLogger) error

func DownloadFileFromSource

func DownloadFileFromSource(args *DownloadFromSourceArgs) ([]byte, error)

func DownloadFilesFromSource

func DownloadFilesFromSource(args *DownloadFromSourceArgs, rootNameGetter func(afero.Fs) (string, error)) (fs.FS, error)

func PreloadFiles

func PreloadFiles(name, localBase, s3Base, source string, logger *zap.SugaredLogger) error

PreloadFiles downloads a tarball from object storage and extracts it to a local path for further usage. It happens only if files do not exist in local disk.

func SaveAndUploadFiles

func SaveAndUploadFiles(fileTree fs.FS, names []string, localBase, s3Base string, logger *zap.SugaredLogger) error

SaveAndUploadFiles saves a tree of files to local disk, at the same time, archives them and uploads to object storage.

Types

type DownloadFromSourceArgs

type DownloadFromSourceArgs struct {
	CodehostID int    `json:"codeHostID"`
	Owner      string `json:"owner"`
	Namespace  string `json:"namespace"`
	Repo       string `json:"repo"`
	Path       string `json:"path"`
	Branch     string `json:"branch"`
	RepoLink   string `json:"repoLink"`
}

func (*DownloadFromSourceArgs) GetNamespace

func (args *DownloadFromSourceArgs) GetNamespace() string

type FileInfo

type FileInfo struct {
	Path  string `json:"path"`
	Name  string `json:"name"`
	Size  int64  `json:"size"`
	IsDir bool   `json:"is_dir"`
}

func GetFileInfos

func GetFileInfos(fileTree fs.FS) ([]*FileInfo, error)

type TreeGetter

type TreeGetter interface {
	GetTreeContents(owner, repo, path, branch string) (afero.Fs, error)
	GetFileContent(owner, repo, path, branch string) ([]byte, error)
	GetTree(owner, repo, path, branch string) ([]*git.TreeNode, error)
	GetYAMLContents(owner, repo, path, branch string, isDir, split bool) ([]string, error)
}

func GetPublicTreeGetter

func GetPublicTreeGetter(repoLink string) (TreeGetter, error)

func GetTreeGetter

func GetTreeGetter(codeHostID int) (TreeGetter, error)

Jump to

Keyboard shortcuts

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