liboxen 0.53.0

Oxen is a fast data version control system, built with machine learning training data in mind. Designed to handle terabytes of data with ease, using a workflow similar to git. Version both structured and unstructured data of any modality: text, images, video, audio, CSV, Parquet, JSONL, model checkpoints, and more. liboxen is the embeddable core library behind the oxen CLI and server, which power fine tuning and inference pipelines for multimodal LLMs, image models, and video models on Oxen.ai.
use crate::core::progress::sync_progress::{SyncProgress, SyncType};
use std::borrow::Cow;
use std::ops::{Deref, DerefMut};

pub struct PushProgress {
    sync_progress: SyncProgress,
}

impl Default for PushProgress {
    fn default() -> Self {
        Self::new()
    }
}

impl PushProgress {
    pub fn new() -> Self {
        PushProgress {
            sync_progress: SyncProgress::new(SyncType::Push),
        }
    }

    pub fn new_with_totals(total_files: u64, total_bytes: u64) -> Self {
        PushProgress {
            sync_progress: SyncProgress::new_with_totals(SyncType::Push, total_files, total_bytes),
        }
    }

    pub fn set_message(&self, message: impl Into<Cow<'static, str>>) {
        self.sync_progress.set_message(message);
    }

    pub fn update_message(&self) {
        self.sync_progress.update_message();
    }

    pub fn add_files(&self, files: u64) {
        self.sync_progress.add_files(files);
    }

    pub fn add_bytes(&self, bytes: u64) {
        self.sync_progress.add_bytes(bytes);
    }

    /// Extend the underlying progress bar's total length by `delta`. See
    /// [`SyncProgress::inc_total_bytes`] for usage notes.
    pub fn inc_total_bytes(&self, delta: u64) {
        self.sync_progress.inc_total_bytes(delta);
    }

    pub fn get_num_files(&self) -> u64 {
        self.sync_progress.get_num_files()
    }

    pub fn get_num_bytes(&self) -> u64 {
        self.sync_progress.get_num_bytes()
    }

    pub fn finish(&self) {
        self.sync_progress.finish();
    }
}

impl Deref for PushProgress {
    type Target = SyncProgress;

    fn deref(&self) -> &Self::Target {
        &self.sync_progress
    }
}

impl DerefMut for PushProgress {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.sync_progress
    }
}