Replace sync with async fs#55
Conversation
Greptile SummaryThis PR replaces synchronous
Confidence Score: 5/5Safe to merge — all changed code paths are correct and the async migration is consistent throughout. The change is a mechanical but thorough conversion: blocking filesystem calls are moved off the async executor via spawn_blocking wrappers, and TOCTOU check-then-act patterns are replaced with operation-first + NotFound matching. The unusual implicit-return pattern used in save_reference and load_reference is already established elsewhere in the module and is correct. No logic paths were altered beyond the async/error-handling improvements. No files require special attention. src/store/mod.rs has the most churn but all changes are consistent with the pattern established earlier in the file. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Caller: pull / serve] --> B[AuthResolver::new_async]
B --> C[spawn_blocking: load_docker_config]
C -->|NotFound| D[Ok: None]
C -->|Ok| E[Ok: DockerConfig]
C -->|Other error| F[Err propagated]
A2[Store::open / open_active] --> G[ensure_directory_blocking]
G --> H{shared_lock?}
H -->|yes| I[acquire_shared_cache_lock]
H -->|no| J[lock = None]
I --> K[ensure_store_layout_blocking]
J --> K
K --> L[Store ready]
L --> M[save_blob_bytes]
M --> N[tokio_fs::try_exists]
N -->|exists + complete| O[return Ok early]
N -->|missing| P[atomic_write_bytes_blocking]
L --> Q[save_reference]
Q --> R[spawn_blocking: atomic_write_json]
L --> S[load_reference]
S --> T[spawn_blocking: read_json_if_exists]
T -->|NotFound| U[Ok: None]
T -->|Ok| V[Ok: Some record]
Reviews (1): Last reviewed commit: "Replace sync with async fs" | Re-trigger Greptile |
No description provided.