Module partial_chunk

Module partial_chunk 

Source
Expand description

Partial chunk support for range requests.

This module provides functionality for serving partial content requests, enabling efficient byte-range retrieval for streaming scenarios.

§Features

  • HTTP-style range request support (bytes=0-1023)
  • Multi-range requests
  • Chunk-aligned range calculations
  • Efficient partial reads without loading full chunks
  • Content-Length and Content-Range header generation

§Example

use chie_core::partial_chunk::{RangeRequest, RangeHandler};

// Parse a range request
let range = RangeRequest::parse("bytes=0-1023")?;

// Create a range handler for content
let handler = RangeHandler::new(1_000_000, 262_144); // 1MB total, 256KB chunks

// Get the chunks needed for this range
let chunks = handler.get_required_chunks(&range)?;

println!("Need chunks: {:?}", chunks);

Structs§

ByteRange
Represents a byte range request
ChunkRange
Information about a chunk that needs to be read for a range
PartialResponse
Response for a partial content request
RangeHandler
Handles range requests for chunked content
RangeRequest
A range request (may contain multiple ranges)

Enums§

RangeError
Errors that can occur during range request processing