affine_importer 0.1.2

AFFiNE import planning and batching core.
Documentation
mod batch;
mod planner;
mod provider;
mod session;
mod source;
mod vfs;

pub use batch::{
  FolderHierarchyDelta, ImportBatch, ImportProgress, ImportWarning, ImportedAsset, ImportedDocMeta,
  ImportedDocSnapshot, ImportedIcon, ImportedIconData, ImportedTag,
};
pub use planner::{ImportBatchLimits, ImportOptions};
pub use provider::{ImportCursor, ImportProvider, ImportRegistry, ImportSource};
pub use session::{ImportSession, ImportSessionOptions, ImportSessionState};
#[cfg(test)]
pub use source::ZipBytesSource;
pub use source::{ArchiveEntryMeta, ArchiveSource, DirectoryPathSource, ZipPathSource};

#[derive(Debug, thiserror::Error)]
pub enum ImportError {
  #[error("import was cancelled")]
  Cancelled,
  #[error("unsupported import format: {0}")]
  UnsupportedFormat(String),
  #[error("invalid source: {0}")]
  InvalidSource(String),
  #[error("zip error: {0}")]
  Zip(#[from] zip::result::ZipError),
  #[error("io error: {0}")]
  Io(#[from] std::io::Error),
  #[error("document build failed: {0}")]
  Document(#[from] affine_doc_loader::ParseError),
}

pub type ImportResult<T> = Result<T, ImportError>;