Skip to main content

BulkWriter

Struct BulkWriter 

Source
pub struct BulkWriter<'c> { /* private fields */ }
Expand description

A batch of track writes held in one transaction. Each method delegates to the shared per-row writer helper (upsert_track_in / replace_tags_in / set_binary_tags_in / set_structural_blocks_in / upsert_art_in / set_track_art_in) that also backs the Db<ReadWrite> writers, but runs it on a single caller-held transaction so a whole batch commits with one fsync.

Implementations§

Source§

impl BulkWriter<'_>

Source

pub fn upsert_track(&mut self, t: &NewTrack) -> Result<i64>

Source

pub fn tracks_by_fingerprint(&self, fp: &str) -> Result<Vec<Track>>

Source

pub fn set_track_checksums( &self, id: i64, fingerprint: Option<&str>, content_hash: Option<&str>, ) -> Result<()>

Source

pub fn retarget_track( &self, id: i64, new_backing_path: &str, backing_size: u64, backing_mtime_ns: i64, backing_ctime_ns: i64, audio_offset: u64, audio_length: u64, fingerprint: Option<&str>, content_hash: Option<&str>, ) -> Result<()>

Source

pub fn get_track_by_path(&self, path: &str) -> Result<Option<Track>>

Source

pub fn replace_tags(&mut self, track_id: i64, tags: &[Tag]) -> Result<()>

Source

pub fn set_binary_tags( &mut self, track_id: i64, tags: &[BinaryTag], ) -> Result<()>

Source

pub fn set_structural_blocks( &mut self, track_id: i64, blocks: &[StructuralBlock], ) -> Result<()>

Source

pub fn upsert_art(&mut self, a: &NewArt) -> Result<i64>

Source

pub fn set_track_art(&mut self, track_id: i64, items: &[TrackArt]) -> Result<()>

Source

pub fn commit(self) -> Result<()>

Auto Trait Implementations§

§

impl<'c> !RefUnwindSafe for BulkWriter<'c>

§

impl<'c> !Send for BulkWriter<'c>

§

impl<'c> !Sync for BulkWriter<'c>

§

impl<'c> !UnwindSafe for BulkWriter<'c>

§

impl<'c> Freeze for BulkWriter<'c>

§

impl<'c> Unpin for BulkWriter<'c>

§

impl<'c> UnsafeUnpin for BulkWriter<'c>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.