fast-pull
fast-pull is a low-level concurrent pull/push streaming engine for moving
byte ranges from any source to any sink.
Official Website (Simplified Chinese)
Features
- โก๏ธ Concurrent pull/push
Built on
fast-stealwith optimized work-stealing across worker tasks, plus a single-threaded sequential path (download_single). - ๐
Puller/Pusherabstractions A download is just aPuller(source) feeding aPusher(sink). Bring your own, or use the built-ins.Pullermust beCloneso work can be stolen and retried;Pusherreports partial failures so the engine can retry them. - ๐พ Multiple write paths (
fileis feature-gated;memis always available)fileโStdFilePusher(rawstd::fs::Filerandom-access writes) andMmapFilePusher(memory-mapped zero-copy writes), plus the ready-madeCacheFilePusherstack.memโMemPusher, an in-memory sink backed by a sharedVec<u8>(always available, no feature gate).
- ๐งฉ Out-of-order & buffered writes
Cache decorators
CacheDirectPusher,CacheMergePusher, andCacheSeqPusherabsorb out-of-order chunks (keyed byrange.start) and flush runs once a watermark is reached;BufWriterPusherbatches contiguous writes likestd::io::BufWriter. - ๐ Progress & cancellation
Streaming
Events (pull/push progress, errors, completion) are delivered onDownloadResult::event_chain, and a session is cancelled byDownloadResult::abortor simply dropping the last handle clone. - ๐งช Testing-friendly
MockPuller+build_mock_datagive you a deterministic in-memory source for tests โ no network or disk required.
Usage
use ;
use Bytes;
use ;
/// A minimal in-memory [`Pusher`] so this example compiles with **no** optional
/// features. In real code, prefer `fast_pull::MemPusher` (always available) or
/// a file pusher (feature `file`).
async
License
Licensed under the same terms as the rest of the fast-down workspace. Thanks to
share121, Cyan
and other fast-down contributors.