pub mod driver;
pub mod folder;
pub mod gc;
pub mod image;
pub mod ingest;
pub mod kind;
pub mod library;
pub mod link;
pub mod local;
pub mod migrations;
pub mod preset;
pub mod record;
#[cfg(feature = "s3")]
pub mod s3;
pub mod sanitize;
pub mod variant;
pub mod verify;
pub use driver::{BlobMeta, ByteStream, Disposition, StorageDriver, StorageError};
pub use folder::{Folder, FolderError};
pub use ingest::{blob_path, ingest, stream_of, IngestError, Ingested};
pub use kind::Kind;
pub use link::{Link, Owner};
pub use local::LocalDisk;
pub use preset::{Format, Mode, Preset};
pub use record::{MediaRecord, NewMedia, NewMediaExtra, RecordError};
#[cfg(feature = "s3")]
pub use s3::{S3Config, S3Disk};
pub use variant::{Variant, VariantError, Variants};
use std::sync::Arc;
use laterite_core::{MigrationSet, Module, ModuleId, Text};
#[non_exhaustive]
pub struct DiskReg {
pub name: String,
pub driver: Arc<dyn StorageDriver>,
pub label: Text,
pub private: bool,
}
impl DiskReg {
pub fn new(name: impl Into<String>, driver: Arc<dyn StorageDriver>) -> Self {
let name = name.into();
Self {
label: Text::dynamic(name.clone()),
name,
driver,
private: false,
}
}
pub fn private(mut self) -> Self {
self.private = true;
self
}
pub fn label(mut self, label: impl Into<Text>) -> Self {
self.label = label.into();
self
}
}
pub fn module() -> Box<dyn Module> {
Box::new(MediaModule)
}
pub struct MediaModule;
impl Module for MediaModule {
fn id(&self) -> ModuleId {
ModuleId::new(migrations::MODULE_ID)
}
fn migrations(&self) -> MigrationSet {
migrations::migrations()
}
}