Documentation ¶
Index ¶
- Constants
- func RemovePathWithEmptyParentDirsInsideScope(scopeDir, path string) error
- func RunGC(ctx context.Context, ...) error
- func ShouldPreserveGitDataEntryByLru(entry GitDataEntry) bool
- func ShouldRunAutoGC(ctx context.Context, allowedVolumeUsagePercentage float64) (bool, error)
- type ArchiveMetadata
- type GitArchiveDesc
- type GitDataEntry
- type GitDataLruSort
- type GitDataManager
- func (manager *GitDataManager) CreateArchiveFile(ctx context.Context, repoID string, opts git_repo.ArchiveOptions, ...) (*git_repo.ArchiveFile, error)
- func (manager *GitDataManager) CreatePatchFile(ctx context.Context, repoID string, opts git_repo.PatchOptions, tmpPath string, ...) (*git_repo.PatchFile, error)
- func (manager *GitDataManager) GetArchiveFile(ctx context.Context, repoID string, opts git_repo.ArchiveOptions) (*git_repo.ArchiveFile, error)
- func (manager *GitDataManager) GetArchivesCacheDir() string
- func (manager *GitDataManager) GetPatchFile(ctx context.Context, repoID string, opts git_repo.PatchOptions) (*git_repo.PatchFile, error)
- func (manager *GitDataManager) GetPatchesCacheDir() string
- func (manager *GitDataManager) LockGC(ctx context.Context, shared bool) (lockgate.LockHandle, error)
- func (manager *GitDataManager) NewTmpFile() (string, error)
- type GitPatchDesc
- type GitRepoDesc
- type GitWorktreeDesc
- type PatchMetadata
Constants ¶
const ( KeepGitWorkTreeCacheVersionV1_1 = "6" KeepGitRepoCacheVersionV1_1 = "3" )
const ( GitArchivesCacheVersion = "7" GitPatchesCacheVersion = "6" )
Variables ¶
This section is empty.
Functions ¶
func ShouldPreserveGitDataEntryByLru ¶ added in v1.2.28
func ShouldPreserveGitDataEntryByLru(entry GitDataEntry) bool
Types ¶
type ArchiveMetadata ¶
type ArchiveMetadata struct {
LastAccessTimestamp int64
}
type GitArchiveDesc ¶
type GitArchiveDesc struct { MetadataPath string ArchivePath string Metadata *ArchiveMetadata Size uint64 CacheBasePath string }
func GetGitArchivesAndRemoveInvalid ¶ added in v1.2.322
func GetGitArchivesAndRemoveInvalid(ctx context.Context, cacheVersionRoot string) ([]*GitArchiveDesc, error)
GetGitArchivesAndRemoveInvalid scans the given cacheVersionRoot directory and returns a list of GitArchiveDesc for each valid git archive found. It removes invalid entries and handles errors appropriately.
The directory structure expected is as follows: ├── 39e4985a993e1688a3a7e548e9bbf007ea53f4654d746e966b7b6a5011b72ffa/ │ ├── 29/ │ │ ├── 296f52bea4934b503f8141226900ab3798ce9eeeefcbde068bd316c687e40320.meta.json │ │ ├── 296f52bea4934b503f8141226900ab3798ce9eeeefcbde068bd316c687e40320.tar │ │ └── ... (other archive files) │ └── ... (other hash prefixes) └── ... (other repository hashes)
func (*GitArchiveDesc) GetCacheBasePath ¶ added in v1.2.141
func (entry *GitArchiveDesc) GetCacheBasePath() string
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 GetCacheBasePath() string }
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 ¶
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 CacheBasePath string }
func GetGitPatchesAndRemoveInvalid ¶ added in v1.2.322
func GetGitPatchesAndRemoveInvalid(ctx context.Context, cacheVersionRoot string) ([]*GitPatchDesc, error)
GetGitPatchesAndRemoveInvalid scans the given cacheVersionRoot directory and returns a list of GitPatchDesc for each valid .meta.json file found. It removes invalid entries and handles errors appropriately.
The directory structure expected is as follows: ├── 0f1ddce0c13406a1178a3e8df39e356fb0ab629e7b3f3db26f04cb668a2c3b2a/ │ ├── a3/ │ │ ├── a3be8a34b216b93516c0f50964a15cace97662cf20a278bb3f50f511649249bb.patch.92f0dd52eb4e3cc2deb6761be83a42fa9d1d07e1c6476a5ac2c2ba9e62b43c10.paths_list │ │ ├── a3d24f9f2203e37ce6400f8198246e1a8d28a69728e8873e785d0e9adbf1e85e.meta.json │ │ ├── a3d24f9f2203e37ce6400f8198246e1a8d28a69728e8873e785d0e9adbf1e85e.patch │ │ └── ... (other patch files) │ └── ... (other hash groups) └── ... (other repositories)
func (*GitPatchDesc) GetCacheBasePath ¶ added in v1.2.141
func (entry *GitPatchDesc) GetCacheBasePath() string
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 ¶
func GetGitReposAndRemoveInvalid ¶ added in v1.2.322
func GetGitReposAndRemoveInvalid(ctx context.Context, cacheVersionRoot string) ([]*GitRepoDesc, error)
GetGitReposAndRemoveInvalid scans the given cacheVersionRoot directory and returns a list of GitRepoDesc for each valid git repository found. It removes invalid entries and handles errors appropriately.
The directory structure expected is as follows: ├── c447df0d5918decb5d832cb4324e3e2cbe0670eb3fe9301f795be831a9175f47 │ └── ... (repository files) └── ... (other repositories)
func (*GitRepoDesc) GetCacheBasePath ¶ added in v1.2.141
func (entry *GitRepoDesc) GetCacheBasePath() string
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 ¶
func GetGitWorktreesAndRemoveInvalid ¶ added in v1.2.322
func GetGitWorktreesAndRemoveInvalid(ctx context.Context, cacheVersionRoot string) ([]*GitWorktreeDesc, error)
GetGitWorktreesAndRemoveInvalid scans the given cacheVersionRoot directory and returns a list of GitWorktreeDesc for each valid git worktree found. It removes invalid entries and handles errors appropriately.
The directory structure expected is as follows: ├── 9/ │ ├── local/ │ │ ├── <worktree_hash>/ │ │ │ └── ... (repository files) │ │ └── ... (other worktrees) │ ├── remote/ │ │ ├── <worktree_hash>/ │ │ │ └── ... (repository files) │ │ └── ... (other worktrees) └── ... (other cache versions)
func (*GitWorktreeDesc) GetCacheBasePath ¶ added in v1.2.141
func (entry *GitWorktreeDesc) GetCacheBasePath() string
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 }