Skip to content

Comments

feat: segment cache implementation#309

Merged
javi11 merged 5 commits intomainfrom
claude/segment-cache-optimization-4qRsi
Feb 20, 2026
Merged

feat: segment cache implementation#309
javi11 merged 5 commits intomainfrom
claude/segment-cache-optimization-4qRsi

Conversation

@javi11
Copy link
Owner

@javi11 javi11 commented Feb 19, 2026

Adds a detailed plan for replacing the VFS byte-range cache with a
segment-aligned cache keyed by Usenet message ID, covering architecture,
new package layout, integration points, and migration strategy.

https://claude.ai/code/session_01WojqqWwBwnUnYBFLyYxGwY

claude and others added 4 commits February 19, 2026 08:10
Adds a detailed plan for replacing the VFS byte-range cache with a
segment-aligned cache keyed by Usenet message ID, covering architecture,
new package layout, integration points, and migration strategy.

https://claude.ai/code/session_01WojqqWwBwnUnYBFLyYxGwY
Adds a new `segcache` package that caches Usenet segments (keyed by
message ID, ~750KB each) on disk, so each NNTP article is fetched at
most once and reused across both FUSE and WebDAV access paths.

Key components:
- `segcache.SegmentCache`: disk-backed store with LRU eviction,
  atomic writes via temp-file+rename, and catalog.json persistence
- `segcache.SegmentCachedFile`: implements both ReadAt (FUSE) and
  Read/Seek/Close/Stat/Readdir/Write (WebDAV) so it can be returned
  directly as a webdav.File
- `segcache.Prefetcher`: detects sequential access (delta==1) and
  prefetches ahead; includes circuit breaker after 10 consecutive errors
- `segcache.Manager`: lifecycle owner for cache, prefetchers, and
  per-path singleflight groups; background cleanup/catalog-flush loops
- `NzbFilesystem.GetSegmentEntries`: new method that reads file
  metadata and returns []SegmentEntry with cumulative file offsets
- `config.SegmentCacheConfig`: new top-level config section
  (enabled, cache_path, max_size_gb, expiry_hours, read_ahead_segments,
   prefetch_concurrency)

Integration:
- A single *segcache.Manager is created at app startup and shared
  between FUSE and WebDAV, enabling cross-protocol segment reuse
- FUSE: segment cache branch runs before VFS cache in File.Open;
  Handle reads use ReadAt on SegmentCachedFile
- WebDAV: fileSystem.OpenFile tries segment cache first, falling back
  to the original nzbFs.OpenFile path
- SuppressStreamTrackingKey injected into opener context to prevent
  background segment fetches from creating duplicate activity streams

Fixes singleflight return-value ordering (value, error, shared).

https://claude.ai/code/session_01WojqqWwBwnUnYBFLyYxGwY
Updated the filesystem initialization to include segment cache management, enhancing performance for FUSE and WebDAV. The segment cache is now shared between both protocols, allowing for efficient reuse of cached Usenet segments. Additionally, removed the disk cache configuration from the UI components, streamlining the caching strategy for improved user experience and reducing complexity in the configuration settings.
- Changed logo image format from JPG to PNG for better quality.
- Updated various static assets including favicons and touch icons to ensure consistency and improved visuals across platforms.
- Minor adjustments to the homepage header for the new logo display.
@javi11 javi11 changed the title docs: add segment-intelligent cache implementation plan feat: segment cache implementation Feb 20, 2026
@javi11 javi11 merged commit 975c8c0 into main Feb 20, 2026
1 check passed
@javi11 javi11 deleted the claude/segment-cache-optimization-4qRsi branch February 20, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants