Skip to main content

Crate oxigeo_rs3gw

Crate oxigeo_rs3gw 

Source
Expand description

rs3gw storage backend integration for OxiGeo

This crate provides high-performance cloud storage access for OxiGeo by integrating with rs3gw, a Pure Rust S3-compatible storage gateway.

§Features

  • Multi-backend Support: Local, S3, MinIO, GCS, Azure
  • High Performance: Zero-copy operations, heuristic read-ahead caching, deduplication
  • Cloud-Optimized: Optimized for COG (Cloud-Optimized GeoTIFF) and Zarr access
  • Pure Rust: No C/C++ dependencies (COOLJAPAN Policy compliant)
  • Security: Optional encryption-at-rest with AES-256-GCM

§Architecture

┌─────────────────────────────────────┐
│     OxiGeo Drivers                 │
│  (GeoTIFF, Zarr, NetCDF, etc.)      │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│   oxigeo-rs3gw (This Crate)        │
│  ┌──────────┐      ┌──────────┐    │
│  │DataSource│      │ZarrStore │    │
│  └──────────┘      └──────────┘    │
└──────────────┬──────────────────────┘
               │
               ▼
┌─────────────────────────────────────┐
│           rs3gw                     │
│  ┌─────────────────────────────┐   │
│  │   StorageBackend Trait      │   │
│  └─────────────────────────────┘   │
│     │     │      │      │      │    │
│  Local  S3  MinIO  GCS  Azure  │    │
└─────────────────────────────────────┘

§Usage Examples

§Reading a COG from S3

use oxigeo_rs3gw::{OxigeoBackend, Rs3gwDataSource};
use oxigeo_core::io::DataSource;

// Configure S3 backend
let backend = OxigeoBackend::S3 {
    region: "us-west-2".to_string(),
    bucket: "my-cog-bucket".to_string(),
    endpoint: None,
    access_key: None, // Uses AWS SDK default credentials
    secret_key: None,
};

// Create storage and data source
let storage = backend.create_storage().await?;
let source = Rs3gwDataSource::new(
    storage,
    "my-cog-bucket".to_string(),
    "images/landsat.cog.tif".to_string()
).await?;

// Read data
let size = source.size()?;
println!("Image size: {} bytes", size);

§Using with MinIO


let backend = MinioBackendBuilder::new(
    "http://localhost:9000",
    "geospatial-data",
    "minioadmin",
    "minioadmin"
).build();

let storage = backend.create_storage().await?;
let source = Rs3gwDataSource::new(
    storage,
    "geospatial-data".to_string(),
    "zarr/temperature.zarr".to_string()
).await?;

§Zarr Store Integration

use oxigeo_rs3gw::{OxigeoBackend, Rs3gwStore};

let backend = OxigeoBackend::Local {
    root: "/data/zarr".into(),
};

let storage = backend.create_storage().await?;
let store = Rs3gwStore::new(
    storage,
    "local".to_string(),
    "array.zarr".to_string()
);

// Use with Zarr array operations
// let array = ZarrArray::open(store).await?;

§Advanced Features

§COG-Optimized Caching

use oxigeo_rs3gw::features::{CogCacheConfig, CogAccessPattern};

// Configure cache for sequential tile access
let cache_config = CogAccessPattern::Sequential.recommended_config();
println!("Cache size: {} MB", cache_config.max_size_mb);
println!("Prefetch radius: {} tiles", cache_config.prefetch_radius);

§Zarr Deduplication

use oxigeo_rs3gw::features::{ZarrDedupConfig, ZarrDedupPresets};

// Use preset for 256KB Zarr chunks
let dedup_config = ZarrDedupPresets::medium_chunks();

// Estimate potential savings
let savings = oxigeo_rs3gw::features::dedup::estimate_savings(10000, 3000);
println!("Estimated savings: {:.1}%", savings * 100.0);

§Encryption

use oxigeo_rs3gw::features::{EncryptionConfig, generate_key};

// Generate a secure encryption key
let key = generate_key()?;

// Configure encryption
let encryption = EncryptionConfig::new()
    .with_key(key)
    .with_metadata_encryption(true);

encryption.validate().map_err(|e| e.to_string())?;

Re-exports§

pub use config::OxigeoBackend;
pub use config::parse_url;
pub use datasource::Rs3gwDataSource;
pub use error::Result;
pub use error::Rs3gwError;
pub use store::Rs3gwStore;

Modules§

config
Backend configuration for rs3gw integration
datasource
DataSource implementation for rs3gw
error
Error types for rs3gw integration
features
Advanced features for rs3gw integration
store
Zarr Store implementation for rs3gw

Constants§

RS3GW_VERSION
The version of rs3gw this crate is compatible with
VERSION
The version of this crate