Module cache

Module cache 

Source
Expand description

Git repository cache management with worktree-based parallel operations.

Provides caching for Git repositories with safe parallel resource installation via worktrees.

§Architecture

  • Cache: Core repository management and worktree orchestration
  • CacheLock: File-based locking for process-safe concurrent access
  • SHA-based worktrees: One worktree per unique commit for maximum deduplication
  • Notification-based coordination: tokio::sync::Notify eliminates polling

§Cache Structure

~/.agpm/cache/
├── sources/       # Bare repositories
├── worktrees/     # SHA-based worktrees with .state.json registry
└── .locks/        # Per-repository and per-worktree locks

§Key Features

  • Fsync-based verification ensures files readable after worktree creation
  • DashMap for lock-free concurrent worktree access
  • Command-instance fetch caching (single fetch per repo per command)
  • Cross-platform path handling and cache locations

Re-exports§

pub use lock::CacheLock;

Modules§

lock
File-based locking mechanism for cache operations

Structs§

Cache
Git repository cache for efficient resource management.