Skip to main content

Crate libviprs

Crate libviprs 

Source
Expand description

§libviprs — High-performance tile pyramid generation

libviprs converts large raster images and PDF documents into multi-resolution tile pyramids suitable for Deep Zoom viewers, slippy-map UIs, and GIS applications.

§Core workflow

  1. Load an image with decode_file / decode_bytes, or extract from PDF with extract_page_image / [render_page_pdfium].
  2. Plan the pyramid with PyramidPlanner — choose tile size, overlap, and layout (Layout::DeepZoom or Layout::Xyz).
  3. Run the pipeline with EngineBuilder::new(source, plan, sink), chaining setters (e.g. .with_engine(...), .with_observer(...), .with_concurrency(...)) and finishing with .run(). The source is anything implementing IntoEngineSource — a &Raster or any StripSource — and the sink is typically an FsSink (filesystem) or MemorySink (in-memory).
  4. Select an engine with EngineKind: Auto (default; picks based on source kind and memory budget), Monolithic (in-memory), Streaming (sequential strip), or MapReduce (parallel strip).
  5. Observe progress by passing an EngineObserver to .with_observer(...); lifecycle, level, tile, and batch updates arrive as EngineEvent variants (see the observe module).
  6. Configure blank tile handling with BlankTileStrategy to either emit full tiles or write 1-byte placeholders for uniform-color regions.

§Feature flags

  • pdfium — enables [render_page_pdfium], [render_page_pdfium_budgeted], and [PdfiumStripSource] for full vector PDF rendering via the pdfium library.
  • pdfium-static — implies pdfium and statically links libpdfium.
  • s3 — gates the [sink_object_store] module ([ObjectStoreSink]) against a user-injected [ObjectStore] backend.
  • tracing — emits structured spans and events via the tracing crate.
  • packfile — gates [PackfileSink] for writing tiles into tar or zip archives.

§Examples

See the libviprs-tests repository for comprehensive integration tests, and libviprs-cli for a command-line tool demonstrating every public API.

Re-exports§

pub use checksum::ChecksumMode;
pub use checksum::VerifyError;
pub use checksum::VerifyReport;
pub use dedupe::DedupeDecision;
pub use dedupe::DedupeIndex;
pub use dedupe::DedupeStrategy;
pub use dedupe::LinkResult;
pub use engine::BlankTileStrategy;
pub use engine::EngineConfig;
pub use engine::EngineError;
pub use engine::EngineResult;
pub use engine::StageDurations;
pub use engine::is_blank_tile;
pub use engine_builder::EngineBuilder;
pub use engine_builder::EngineKind;
pub use engine_builder::EngineSource;
pub use engine_builder::IntoEngineSource;
pub use geo::GeoBounds;
pub use geo::GeoCoord;
pub use geo::GeoTransform;
pub use geo::PixelCoord;
pub use manifest::ChecksumAlgo;
pub use manifest::Checksums;
pub use manifest::GenerationSettings;
pub use manifest::LevelMetadata;
pub use manifest::Manifest;
pub use manifest::ManifestBuilder;
pub use manifest::ManifestError;
pub use manifest::ManifestV1;
pub use manifest::SourceMetadata;
pub use manifest::SparsePolicy;
pub use observe::CollectingObserver;
pub use observe::EngineEvent;
pub use observe::EngineObserver;
pub use observe::MemoryTracker;
pub use pdf::PdfError;
pub use pdf::PdfInfo;
pub use pdf::PdfPageInfo;
pub use pdf::extract_page_image;
pub use pdf::pdf_info;
pub use pixel::PixelFormat;
pub use planner::Layout;
pub use planner::LevelPlan;
pub use planner::PlannerError;
pub use planner::PyramidPlan;
pub use planner::PyramidPlanner;
pub use planner::TileCoord;
pub use planner::TileRect;
pub use raster::Raster;
pub use raster::RasterError;
pub use raster::RegionView;
pub use resume::JobCheckpoint;
pub use resume::JobMetadata;
pub use resume::ResumeError;
pub use resume::ResumeMode;
pub use resume::ResumePolicy;
pub use retry::FailurePolicy;
pub use retry::RetryPolicy;
pub use retry::RetryingSink;
pub use sink::BLANK_TILE_MARKER;
pub use sink::CollectedTile;
pub use sink::FsSink;
pub use sink::MemorySink;
pub use sink::SinkError;
pub use sink::Tile;
pub use sink::TileFormat;
pub use sink::TileSink;
pub use source::SourceError;
pub use source::decode_bytes;
pub use source::decode_file;
pub use source::generate_test_raster;
pub use streaming::BudgetPolicy;
pub use streaming::RasterStripSource;
pub use streaming::StreamingConfig;
pub use streaming::StripSource;
pub use streaming::compute_strip_height;
pub use streaming::estimate_streaming_memory;
pub use streaming_mapreduce::MapReduceConfig;

Modules§

checksum
Per-tile checksum emission and verification for libviprs Phase 3.
dedupe
Content-addressed deduplication for tile output (Phase 3 hardening).
engine
engine_builder
Unified fluent entry point for pyramid generation.
extensions
Typed extension map for pipeline-level context that does not fit one of the first-class builder slots (TileSink, EngineObserver, StripSource).
geo
Geo-coordinate mapping for tile pyramids.
manifest
Versioned manifest for pyramid generation (Phase 3).
observe
pdf
pixel
planner
raster
resize
resume
Resumable pyramid generation — building blocks (Phase 3).
retry
Retry wrapper and failure policy for tile sinks.
sink
source
stream_verify
Strip-based verify implementation.
streaming
Strip-based streaming pyramid engine.
streaming_mapreduce
MapReduce streaming pyramid engine.
verify
Verify-mode entry points.