Rust

source

Module

Where resources come from.

Contents

use utopia_migration::source::Emitter;
Rust
pub struct Emitter<'a>

Hands a source's exported batches to the run's sink: resources of types that were not requested are marked skipped, and the rest (except rows and documents, which the destination counts) are cached after the sink took the batch.

use utopia_migration::source::Sink;
Rust
pub trait Sink: Send

Receives batches of exported resources (the destination's import).

Implemented byImport
use utopia_migration::Source;
Rust
pub trait Source: crate::target::AsAny + Send

A service resources are exported from.

A source exports in groups (crate::transfer::group): each group it supports in Source::export_group, emitting batches through the Emitter. Errors of a group are usually collected (Target::add_error) rather than returned, so the transfer goes on.

use utopia_migration::source::export_resources;
Rust
pub async fn export_resources<S: Source + ?Sized>(source: &mut S, resources: &[String], out: &mut Emitter<'_>) -> Result<()>
use utopia_migration::source::requested;
Rust
pub fn requested(types: &[&str], resources: &[String]) -> bool

Whether any of types is requested in resources (with legacy names).

use utopia_migration::source::run;
Rust
pub async fn run<S: Source + ?Sized>(source: &mut S, resources: &[String], sink: &mut dyn Sink, root_resource_id: &str, root_resource_type: &str) -> Result<()>

The default [Source::run]: sets the root resource for the run (and restores the previous one after), and exports through an Emitter.

Rust
pub type ResourceIds = IndexMap<String, Value>

Resource ids of a report, by root resource type.