Module lock

Module lock 

Source
Expand description

File-based locking mechanism for cache operations

This module provides thread-safe and process-safe locking for cache operations through OS-level file locks, ensuring data consistency when multiple AGPM processes access the same cache directory. File locking utilities for cache operations.

This module provides thread-safe and process-safe file locking for cache directories to prevent corruption during concurrent cache operations. The locks are automatically released when the lock object is dropped.

§Async Safety

All file operations are wrapped in spawn_blocking to avoid blocking the tokio runtime. This is critical for preventing worker thread starvation under high parallelism with slow I/O (e.g., network-attached storage).

Structs§

CacheLock
A file lock for cache operations.

Functions§

cleanup_stale_locks
Cleans up stale lock files in the cache directory.