Skip to main content

ArchiveWriter

Struct ArchiveWriter 

Source
pub struct ArchiveWriter { /* private fields */ }
Expand description

Writer for creating an STT archive.

Two modes:

  • createeager: each tile is compressed and written as it arrives, so peak memory is bounded (good for streaming huge builds).
  • create_optimizedbuffered: tiles are held until finalize, where a shared zstd dictionary is trained, byte-identical blobs are deduplicated, and blobs are written in Hilbert order. Smaller archives at the cost of holding payloads in memory.

Implementations§

Source§

impl ArchiveWriter

Source

pub fn create<P: AsRef<Path>>(path: P, compression: Compression) -> Result<Self>

Create an archive in eager (streaming) mode. Tile blobs use compression.

Source

pub fn create_optimized<P: AsRef<Path>>(path: P) -> Result<Self>

Create an archive in buffered “optimized” mode: a shared zstd dictionary is trained over the tile corpus, byte-identical blobs are deduplicated, and blobs are laid down in 2D-spatial-Hilbert order for range-read locality. Requires zstd. See create_optimized_with_ordering to pick a different (e.g. space-time) blob order.

Source

pub fn create_optimized_with_ordering<P: AsRef<Path>>( path: P, ordering: BlobOrdering, ) -> Result<Self>

Buffered “optimized” mode with an explicit blob byte-ordering. The directory index stays (zoom, hilbert, time_start) regardless; only the physical blob layout changes, so readers are unaffected. The default (BlobOrdering::Hilbert3) minimises range requests across the widest range of datasets (see examples/simulate_layout.rs).

Source

pub fn create_reordered<P: AsRef<Path>>( path: P, ordering: BlobOrdering, ) -> Result<Self>

Buffered mode that reorders blobs but ships NO shared dictionary, so the result stays decodable by readers without a dictionary-capable zstd (today’s TS reader). Per-blob zstd + byte-identical dedup still apply. This is the reader-safe way to get the range-request win from blob ordering without the dict that the TS reader can’t yet decode.

Source

pub fn add_tile( &mut self, id: &TileId, time_start: i64, time_end: i64, feature_count: u32, payload: &[u8], ) -> Result<()>

Add a tile. payload is the uncompressed tile payload (the layer frame produced by crate::arrow_tile::encode_tile).

Source

pub fn add_tile_with_bucket( &mut self, id: &TileId, time_start: i64, time_end: i64, feature_count: u32, temporal_bucket_ms: Option<u64>, payload: &[u8], ) -> Result<()>

Add a tile, tagging the directory entry with the temporal bucket size it represents (used when emitting temporal-LOD aggregate tiles).

Source

pub fn add_tile_full( &mut self, id: &TileId, time_start: i64, time_end: i64, cover_t_min: Option<i64>, feature_count: u32, temporal_bucket_ms: Option<u64>, payload: &[u8], ) -> Result<()>

Add a tile carrying the full directory metadata, including the tight lower covering bound cover_t_min (the earliest feature start time actually present — see TileEntry::cover_t_min). None leaves the entry without a covering bound (clients fall back to time_start).

Source

pub fn tile_count(&self) -> usize

Number of tiles staged so far (buffered or written).

Source

pub fn finalize(self, metadata: &Metadata) -> Result<()>

Finalise: write the dictionary (if any), directory, metadata, and header.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<G1, G2> Within<G2> for G1
where G2: Contains<G1>,

Source§

fn is_within(&self, b: &G2) -> bool