feat(c-sdk): optional version/size fast-path and concurrent block reads - #564
Merged
somfornot merged 1 commit intoAug 27, 2026
Merged
Conversation
talon_read_async gains a version (const char*) and object_size (const uint64_t*) parameter pair, each independently nullable. NULL means the caller does not have that value. The read skips the StatObject control round trip only when BOTH are non-NULL, using the caller-supplied version and size; if either is NULL the SDK resolves both with a stat and ignores any lone value, since a read cannot skip the stat without both halves. Making object_size a pointer lets a caller that has a version but no valid size say so (NULL) instead of guessing, and disambiguates a real empty object (points to 0 -> zero-byte read, no stat) from "unknown" (NULL). When used, *object_size bounds the read at EOF: smaller than the range is a POSIX short read, larger surfaces as a clear worker error rather than fabricated bytes. The per-block fetches a multi-block read spans now run concurrently on the runtime (JoinSet over disjoint 'static sub-slices of the caller buffer) instead of a serial await loop, so a large read no longer pays one worker RTT per block in series. Header, smoke test, example, and the MinIO e2e are updated to the new signature; the e2e also adds a fast-path case that reuses the version and size from its stat. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two changes to the C SDK read path (
talon_read_async), aimed at removing avoidable overhead when the caller already knows an object's identity.1. Optional caller-supplied version + size (skip
StatObject)talon_read_asyncgains two new, independently-nullable parameters:StatObjectcontrol round trip entirely. The caller owns keeping them current for the object generation being read.StatObjectfirst (the historical behavior); a lone supplied value is ignored, since a read cannot skip the stat without both halves.object_sizeis a pointer specifically so "no valid size" (NULL) is distinct from "a genuinely empty object" (*object_size == 0, an unambiguous zero-byte read). EOF semantics are preserved: a size smaller thanoffset + dst_lenyields a POSIX short read, and a size larger than the object surfaces as a read error rather than fabricated bytes.2. Concurrent block fetches
A read spanning multiple blocks previously fetched them in a serial
awaitloop. It now fans the per-block fetches out concurrently (aJoinSetover disjoint'staticsub-slices of the caller buffer), so a large read no longer pays one worker RTT per block in series.Note
This is a breaking change to the C ABI of
talon_read_async(two new parameters). Existing callers that want the previous behavior passNULL, NULL. The in-repo header, smoke test, example, and MinIO e2e are all updated; the e2e adds a fast-path case that reuses the version + size from its stat.Testing
cargo test -p talon-c: 13 unit tests pass, including new coverage for the fast path skipping the stat, version-without-size falling back to the stat, the empty-object (size == 0) fast path, and concurrent multi-block reassembly.cargo clippy -p talon-c --all-targetsclean;cargo fmtclean.-std=c11 -Wall -Wextra -Werror.🤖 Generated with Claude Code