Skip to content

Add exact UID-set fetch API#121

Draft
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/fetch-exact-uid-set
Draft

Add exact UID-set fetch API#121
mpscholten wants to merge 1 commit into
qnikst:masterfrom
mpscholten:codex/fetch-exact-uid-set

Conversation

@mpscholten

Copy link
Copy Markdown
Contributor

Summary

  • add fetchByByteStringSet for fetching arbitrary data items from an exact list of UIDs
  • encode sparse UIDs as an IMAP sequence-set such as 101,205,999, rather than widening them to a range
  • return immediately for an empty UID list without sending an invalid UID FETCH command
  • preserve the existing raw ByteString values and response-UID mapping used by fetchByByteStringR

Why

IMAP searches commonly return sparse UIDs. The existing fetchByByteStringR API accepts only a contiguous range, so using the first and last search result can fetch many unrelated messages between them. Calling the single-UID API in a loop avoids over-fetching but adds one network round trip per message.

This helper allows callers to batch metadata reads such as BODYSTRUCTURE for exactly the search results they need.

Validation

  • Nix doCheck build with GHC 9.10.3
  • imap-parsers: 50 cases, 0 errors, 0 failures
  • Haddock generation
  • regression coverage for sparse and empty UID sets

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.

1 participant