gitdata

package
v1.2.62 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeepGitWorkTreeCacheVersionV1_1 = "6"
	KeepGitRepoCacheVersionV1_1     = "3"
)
View Source
const (
	GitArchivesCacheVersion = "7"
	GitPatchesCacheVersion  = "6"
)

Variables

This section is empty.

Functions

func RemovePathWithEmptyParentDirsInsideScope

func RemovePathWithEmptyParentDirsInsideScope(scopeDir, path string) error

func RunGC

func RunGC(ctx context.Context, allowedVolumeUsagePercentage, allowedVolumeUsageMarginPercentage float64) error

func ShouldPreserveGitDataEntryByLru added in v1.2.28

func ShouldPreserveGitDataEntryByLru(entry GitDataEntry) bool

func ShouldRunAutoGC

func ShouldRunAutoGC(ctx context.Context, allowedVolumeUsagePercentage float64) (bool, error)

Types

type ArchiveMetadata

type ArchiveMetadata struct {
	LastAccessTimestamp int64
}

type GitArchiveDesc

type GitArchiveDesc struct {
	MetadataPath string
	ArchivePath  string
	Metadata     *ArchiveMetadata
	Size         uint64
}

func GetExistingGitArchives

func GetExistingGitArchives(cacheVersionRoot string) ([]*GitArchiveDesc, error)

func (*GitArchiveDesc) GetLastAccessAt

func (entry *GitArchiveDesc) GetLastAccessAt() time.Time

func (*GitArchiveDesc) GetPaths

func (entry *GitArchiveDesc) GetPaths() []string

func (*GitArchiveDesc) GetSize

func (entry *GitArchiveDesc) GetSize() uint64

type GitDataEntry

type GitDataEntry interface {
	GetPaths() []string
	GetSize() uint64
	GetLastAccessAt() time.Time
}

func PreserveGitDataByLru added in v1.2.28

func PreserveGitDataByLru(entries []GitDataEntry) []GitDataEntry

type GitDataLruSort

type GitDataLruSort []GitDataEntry

func (GitDataLruSort) Len

func (a GitDataLruSort) Len() int

func (GitDataLruSort) Less

func (a GitDataLruSort) Less(i, j int) bool

func (GitDataLruSort) Swap

func (a GitDataLruSort) Swap(i, j int)

type GitDataManager

type GitDataManager struct {
	ArchivesCacheDir string
	PatchesCacheDir  string
	TmpDir           string
}

func GetHostGitDataManager

func GetHostGitDataManager(ctx context.Context) (*GitDataManager, error)

func NewGitDataManager

func NewGitDataManager(archivesCacheDir, patchesCacheDir, tmpDir string) *GitDataManager

func (*GitDataManager) CreateArchiveFile

func (manager *GitDataManager) CreateArchiveFile(ctx context.Context, repoID string, opts git_repo.ArchiveOptions, tmpPath string) (*git_repo.ArchiveFile, error)

func (*GitDataManager) CreatePatchFile

func (manager *GitDataManager) CreatePatchFile(ctx context.Context, repoID string, opts git_repo.PatchOptions, tmpPath string, desc *true_git.PatchDescriptor) (*git_repo.PatchFile, error)

func (*GitDataManager) GetArchiveFile

func (manager *GitDataManager) GetArchiveFile(ctx context.Context, repoID string, opts git_repo.ArchiveOptions) (*git_repo.ArchiveFile, error)

func (*GitDataManager) GetArchivesCacheDir

func (manager *GitDataManager) GetArchivesCacheDir() string

func (*GitDataManager) GetPatchFile

func (manager *GitDataManager) GetPatchFile(ctx context.Context, repoID string, opts git_repo.PatchOptions) (*git_repo.PatchFile, error)

func (*GitDataManager) GetPatchesCacheDir

func (manager *GitDataManager) GetPatchesCacheDir() string

func (*GitDataManager) LockGC

func (manager *GitDataManager) LockGC(ctx context.Context, shared bool) (lockgate.LockHandle, error)

func (*GitDataManager) NewTmpFile

func (manager *GitDataManager) NewTmpFile() (string, error)

type GitPatchDesc

type GitPatchDesc struct {
	MetadataPath string
	PatchPath    string
	Metadata     *PatchMetadata
	Size         uint64
}

func GetExistingGitPatches

func GetExistingGitPatches(cacheVersionRoot string) ([]*GitPatchDesc, error)

func (*GitPatchDesc) GetLastAccessAt

func (entry *GitPatchDesc) GetLastAccessAt() time.Time

func (*GitPatchDesc) GetPaths

func (entry *GitPatchDesc) GetPaths() []string

func (*GitPatchDesc) GetSize

func (entry *GitPatchDesc) GetSize() uint64

type GitRepoDesc

type GitRepoDesc struct {
	Path         string
	LastAccessAt time.Time
	Size         uint64
}

func GetExistingGitRepos

func GetExistingGitRepos(cacheVersionRoot string) ([]*GitRepoDesc, error)

func (*GitRepoDesc) GetLastAccessAt

func (entry *GitRepoDesc) GetLastAccessAt() time.Time

func (*GitRepoDesc) GetPaths

func (entry *GitRepoDesc) GetPaths() []string

func (*GitRepoDesc) GetSize

func (entry *GitRepoDesc) GetSize() uint64

type GitWorktreeDesc

type GitWorktreeDesc struct {
	Path         string
	LastAccessAt time.Time
	Size         uint64
}

func GetExistingGitWorktrees

func GetExistingGitWorktrees(cacheVersionRoot string) ([]*GitWorktreeDesc, error)

func (*GitWorktreeDesc) GetLastAccessAt

func (entry *GitWorktreeDesc) GetLastAccessAt() time.Time

func (*GitWorktreeDesc) GetPaths

func (entry *GitWorktreeDesc) GetPaths() []string

func (*GitWorktreeDesc) GetSize

func (entry *GitWorktreeDesc) GetSize() uint64

type PatchMetadata

type PatchMetadata struct {
	Descriptor          *true_git.PatchDescriptor
	LastAccessTimestamp int64
}

Jump to

Keyboard shortcuts

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