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§
Sourcefn extract_metadata(&self, path: &str, data: &[u8]) -> Option<ExtensionRow>
fn extract_metadata(&self, path: &str, data: &[u8]) -> Option<ExtensionRow>
Per-file extraction. Return None to skip.
Provided Methods§
Sourcefn meta(&self) -> HandlerMeta
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).
Sourcefn run_command(&self, cmd: &str, _args: &[String]) -> Result<()>
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.
Sourcefn schema_fields(&self) -> Vec<Field>
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.
Sourcefn matches_path(&self, _path: &str) -> bool
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.
Sourcefn supports_batch(&self) -> bool
fn supports_batch(&self) -> bool
Whether this plugin benefits from batched processing.
Sourcefn batch_threshold(&self) -> usize
fn batch_threshold(&self) -> usize
Byte threshold to trigger batch flush (default 200MB).
Sourcefn extract_batch(&self, items: &[BatchItem<'_>]) -> Vec<Option<ExtensionRow>>
fn extract_batch(&self, items: &[BatchItem<'_>]) -> Vec<Option<ExtensionRow>>
Batch extraction — process many files at once (zero-copy borrows).
Returns one Option
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".