WIP

dblsaiko
Apr 2, 2024, 8:09 PM
6WIH3U43354JLREJ2CU7RSFPXJ4ZOWKY6T2KCZRH5FBD6S3MZ5BAC

Dependencies

  • [2] OYN2YVPA Create `pijul_remote` crate
  • [3] SXEYMYF7 Fixing the bad changes in history (unfortunately, by rebooting).
  • [4] ISCWVXO6 Progress bar for push
  • [5] UDHP4ZVB Fixing SSH asynchronicity issues
  • [*] L4JXJHWX pijul/*: reorganize imports and remove extern crate
  • [*] 4RV7T4SR Migrate from `pijul::config` to `pijul-config`
  • [*] 5QTMRUXN Fixing a race condition between progress bars
  • [*] 2D7P2VKJ Change completions (where the whole progress bar story started)
  • [*] G7HJHNFD Migrate from `pijul_interaction::progress` to `pijul_interaction`

Change contents

  • file addition: pipe.rs (----------)
    [2.41]
    use std::collections::BTreeMap;
    use std::future::Future;
    use std::path::{Path, PathBuf};
    use std::pin::Pin;
    use std::sync::Mutex;
    use std::task::{Context, Poll, Waker};
    use futures_util::future::BoxFuture;
    use futures_util::FutureExt;
    use pijul_interaction::ProgressBar;
    use tokio::sync::mpsc;
    use crate::{RemoteRepo, CS};
    pub struct FetchChangesState<'a> {
    shared: Mutex<Shared<'a>>,
    }
    struct Shared<'a> {
    task: BoxFuture<'a, Result<bool, anyhow::Error>>,
    changes: BTreeMap<CS, ChangeState>,
    }
    struct ChangeState {
    wakers: Vec<Waker>,
    }
    impl<'a> FetchChangesState<'a> {
    pub fn new<T>(
    remote: &'a mut RemoteRepo,
    progress_bar: ProgressBar,
    dest_dir: T,
    full: bool,
    ) -> Self
    where
    T: AsRef<Path> + Send + 'a,
    {
    let (in_tx, mut in_rx) = mpsc::unbounded_channel();
    let (mut out_tx, out_rx) = mpsc::channel(100);
    let task = async move {
    remote
    .download_changes(
    progress_bar,
    &mut in_rx,
    &mut out_tx,
    dest_dir.as_ref(),
    full,
    )
    .await
    }
    .boxed();
    FetchChangesState {
    shared: Mutex::new(Shared {
    task,
    changes: Default::default(),
    }),
    }
    }
    pub fn fetch(&mut self, cs: CS) -> FetchJob {
    todo!()
    }
    }
    pub struct FetchJob<'a> {
    shared: &'a Mutex<Shared<'a>>,
    }
    impl<'a> Future for FetchJob<'a> {
    type Output = bool;
    fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
    let mut shared = self.shared.lock().unwrap();
    shared.task.poll_unpin(cx);
    todo!()
    }
    }
  • edit in pijul-remote/src/lib.rs at line 4
    [7.438]
    [3.10335]
    use std::pin::Pin;
  • edit in pijul-remote/src/lib.rs at line 6
    [3.10355]
    [7.438]
    use std::task::Poll;
  • edit in pijul-remote/src/lib.rs at line 10
    [8.245]
    [9.363]
    use futures::{Sink, Stream};
  • edit in pijul-remote/src/lib.rs at line 35
    [10.344]
    [11.37]
    mod pipe;
  • replacement in pijul-remote/src/lib.rs at line 1166
    [3.66586][3.66586:66587]()
    [3.66586]
    [3.66587]