Skip to main content

ArchiveTypePlugin

Trait ArchiveTypePlugin 

Source
pub trait ArchiveTypePlugin: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn type_id(&self) -> i8;
    fn extract_metadata(&self, path: &str, data: &[u8]) -> Option<ExtensionRow>;

    // Provided methods
    fn meta(&self) -> HandlerMeta { ... }
    fn run_command(&self, cmd: &str, _args: &[String]) -> Result<()> { ... }
    fn schema_fields(&self) -> Vec<Field> { ... }
    fn matches_path(&self, _path: &str) -> bool { ... }
    fn supports_batch(&self) -> bool { ... }
    fn batch_threshold(&self) -> usize { ... }
    fn extract_batch(
        &self,
        items: &[BatchItem<'_>],
    ) -> Vec<Option<ExtensionRow>> { ... }
}
Expand description

Trait implemented by each archive type plugin.

A handler targets exactly one packaging ecosystem (crates.io, Maven Central, PyPI, …). Every handler shares the same base commands defined here; the per-ecosystem specialisation lives in the implementation plus the optional subcommands advertised through HandlerMeta::commands.

Required Methods§

Source

fn name(&self) -> &str

Human-readable name

Source

fn type_id(&self) -> i8

DenseUnion type_id this plugin writes to

Source

fn extract_metadata(&self, path: &str, data: &[u8]) -> Option<ExtensionRow>

Per-file extraction. Return None to skip.

Provided Methods§

Source

fn meta(&self) -> HandlerMeta

Discovery metadata — name, aliases, type_id, claimed extensions and the per-handler subcommand “API”. Used by the registry to list and select handlers at runtime. The default derives a minimal record from Self::name / Self::type_id; native handlers override it with a richer record (aliases, ecosystem, extensions, commands).

Source

fn run_command(&self, cmd: &str, _args: &[String]) -> Result<()>

Dispatch a handler-specific subcommand (one of HandlerMeta::commands). Default: the handler exposes no extra subcommands.

Source

fn schema_fields(&self) -> Vec<Field>

The Arrow columns this module contributes to the index. The writer composes the on-disk schema as base columns + pkg_type + these fields. Each Field’s name must match the key the plugin uses in ExtensionRow::fields. Default: no columns.

Source

fn matches_path(&self, _path: &str) -> bool

Return true if this plugin wants to handle this file (checked before reading data). Default false means the plugin is never called for that path.

Source

fn supports_batch(&self) -> bool

Whether this plugin benefits from batched processing.

Source

fn batch_threshold(&self) -> usize

Byte threshold to trigger batch flush (default 200MB).

Source

fn extract_batch(&self, items: &[BatchItem<'_>]) -> Vec<Option<ExtensionRow>>

Batch extraction — process many files at once (zero-copy borrows). Returns one Option per input item, in same order.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§