diff --git a/melib/src/backends.rs b/melib/src/backends.rs index 1d48ae2e..88c4dfb9 100644 --- a/melib/src/backends.rs +++ b/melib/src/backends.rs @@ -294,8 +294,8 @@ pub trait MailBackend: ::std::fmt::Debug + Send + Sync { fn is_online_async(&self) -> ResultFuture<()> { Err(MeliError::new("Unimplemented.")) } - fn get(&mut self, mailbox: &Mailbox) -> Result>>>; - fn get_async( + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>>; + fn fetch_async( &mut self, _mailbox: &Mailbox, ) -> Result>> + Send + 'static>>> { diff --git a/melib/src/backends/imap.rs b/melib/src/backends/imap.rs index 4212beaa..7de9bd4d 100644 --- a/melib/src/backends/imap.rs +++ b/melib/src/backends/imap.rs @@ -188,7 +188,7 @@ impl MailBackend for ImapType { true } - fn get_async( + fn fetch_async( &mut self, mailbox: &Mailbox, ) -> Result>> + Send + 'static>>> { @@ -200,10 +200,10 @@ impl MailBackend for ImapType { let mut valid_hash_set: HashSet = HashSet::default(); let mut our_unseen: BTreeSet = Default::default(); Ok(Box::pin(async_stream::try_stream! { - let (cached_hash_set, cached_payload) = get_cached_envs(mailbox_hash, &mut our_unseen, &uid_store)?; + let (cached_hash_set, cached_payload) = fetch_cached_envs(mailbox_hash, &mut our_unseen, &uid_store)?; yield cached_payload; loop { - let res = get_hlpr(&connection, mailbox_hash,&cached_hash_set, &can_create_flags, &mut our_unseen, &mut valid_hash_set, &uid_store, &mut max_uid).await?; + let res = fetch_hlpr(&connection, mailbox_hash, &cached_hash_set, &can_create_flags, &mut our_unseen, &mut valid_hash_set, &uid_store, &mut max_uid).await?; yield res; if max_uid == Some(1) || max_uid == Some(0) { return; @@ -297,7 +297,7 @@ impl MailBackend for ImapType { })) } - fn get(&mut self, _mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, _mailbox: &Mailbox) -> Result>>> { Err(MeliError::new("Unimplemented.")) } @@ -1010,7 +1010,7 @@ impl ImapType { } } -fn get_cached_envs( +fn fetch_cached_envs( mailbox_hash: MailboxHash, our_unseen: &mut BTreeSet, uid_store: &UIDStore, @@ -1029,7 +1029,7 @@ fn get_cached_envs( let cached_envs: (cache::MaxUID, Vec<(UID, Envelope)>); cache::save_envelopes(uid_store.account_hash, mailbox_hash, *v, &[]) .chain_err_summary(|| "Could not save envelopes in cache in get()")?; - cached_envs = cache::get_envelopes(uid_store.account_hash, mailbox_hash, *v) + cached_envs = cache::fetch_envelopes(uid_store.account_hash, mailbox_hash, *v) .chain_err_summary(|| "Could not get envelopes in cache in get()")?; let (_max_uid, envelopes) = debug!(cached_envs); let ret = envelopes.iter().map(|(_, env)| env.hash()).collect(); @@ -1060,7 +1060,7 @@ fn get_cached_envs( Ok((ret, payload)) } -async fn get_hlpr( +async fn fetch_hlpr( connection: &Arc>, mailbox_hash: MailboxHash, cached_hash_set: &HashSet, @@ -1085,7 +1085,7 @@ async fn get_hlpr( return Ok(Vec::new()); } let mut conn = connection.lock().await; - debug!("locked for get {}", mailbox_path); + debug!("locked for fetch {}", mailbox_path); let mut response = String::with_capacity(8 * 1024); let max_uid_left = if let Some(max_uid) = max_uid { *max_uid diff --git a/melib/src/backends/imap/cache.rs b/melib/src/backends/imap/cache.rs index 6efff683..816efa64 100644 --- a/melib/src/backends/imap/cache.rs +++ b/melib/src/backends/imap/cache.rs @@ -55,7 +55,7 @@ mod sqlite3_m { CREATE INDEX IF NOT EXISTS envelope_idx ON envelopes(mailbox_hash, uid, validity); CREATE INDEX IF NOT EXISTS uidvalidity_idx ON uidvalidity(mailbox_hash);"; - pub fn get_envelopes( + pub fn fetch_envelopes( account_hash: AccountHash, mailbox_hash: MailboxHash, uidvalidity: usize, @@ -155,7 +155,7 @@ pub use filesystem_m::*; #[cfg(not(feature = "sqlite3"))] mod filesystem_m { use super::*; - pub fn get_envelopes( + pub fn fetch_envelopes( _account_hash: AccountHash, _mailbox_hash: MailboxHash, _uidvalidity: usize, diff --git a/melib/src/backends/jmap.rs b/melib/src/backends/jmap.rs index c506370e..8bd7166c 100644 --- a/melib/src/backends/jmap.rs +++ b/melib/src/backends/jmap.rs @@ -212,7 +212,7 @@ impl MailBackend for JmapType { self.online.lock().unwrap().1.clone() } - fn get(&mut self, mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>> { let mut w = AsyncBuilder::new(); let mailboxes = self.mailboxes.clone(); let store = self.store.clone(); diff --git a/melib/src/backends/maildir/backend.rs b/melib/src/backends/maildir/backend.rs index afd51908..dd8a2546 100644 --- a/melib/src/backends/maildir/backend.rs +++ b/melib/src/backends/maildir/backend.rs @@ -207,11 +207,11 @@ impl MailBackend for MaildirType { Ok(Box::pin(async { res })) } - fn get(&mut self, mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>> { Ok(self.multicore(4, mailbox)) } - fn get_async( + fn fetch_async( &mut self, mailbox: &Mailbox, ) -> Result>> + Send + 'static>>> diff --git a/melib/src/backends/mbox.rs b/melib/src/backends/mbox.rs index a8f9a298..3aba0fdd 100644 --- a/melib/src/backends/mbox.rs +++ b/melib/src/backends/mbox.rs @@ -718,7 +718,7 @@ impl MailBackend for MboxType { Ok(()) } - fn get(&mut self, mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>> { let mut w = AsyncBuilder::new(); let handle = { let tx = w.tx(); diff --git a/melib/src/backends/notmuch.rs b/melib/src/backends/notmuch.rs index f648664c..c8481a25 100644 --- a/melib/src/backends/notmuch.rs +++ b/melib/src/backends/notmuch.rs @@ -334,7 +334,7 @@ impl MailBackend for NotmuchDb { Ok(()) } - fn get(&mut self, mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>> { let mut w = AsyncBuilder::new(); let mailbox_hash = mailbox.hash(); let database = NotmuchDb::new_connection(self.path.as_path(), self.lib.clone(), false); diff --git a/src/conf/accounts.rs b/src/conf/accounts.rs index d63865ea..e248cbe3 100644 --- a/src/conf/accounts.rs +++ b/src/conf/accounts.rs @@ -161,7 +161,7 @@ pub enum JobRequest { JoinHandle, oneshot::Receiver>>, ), - Get( + Fetch( MailboxHash, JoinHandle, oneshot::Receiver<( @@ -203,7 +203,7 @@ impl core::fmt::Debug for JobRequest { match self { JobRequest::Generic { name, .. } => write!(f, "JobRequest::Generic({})", name), JobRequest::Mailboxes(_, _) => write!(f, "JobRequest::Mailboxes"), - JobRequest::Get(hash, _, _) => write!(f, "JobRequest::Get({})", hash), + JobRequest::Fetch(hash, _, _) => write!(f, "JobRequest::Fetch({})", hash), JobRequest::IsOnline(_, _) => write!(f, "JobRequest::IsOnline"), JobRequest::Refresh(_, _, _) => write!(f, "JobRequest::Refresh"), JobRequest::SetFlags(_, _, _) => write!(f, "JobRequest::SetFlags"), @@ -238,9 +238,9 @@ impl JobRequest { } } - fn is_get(&self, mailbox_hash: MailboxHash) -> bool { + fn is_fetch(&self, mailbox_hash: MailboxHash) -> bool { match self { - JobRequest::Get(h, _, _) if *h == mailbox_hash => true, + JobRequest::Fetch(h, _, _) if *h == mailbox_hash => true, _ => false, } } @@ -531,7 +531,7 @@ impl Account { if entry.conf.mailbox_conf.autoload { entry.status = MailboxStatus::Parsing(0, 0); if self.is_async { - if let Ok(mailbox_job) = self.backend.write().unwrap().get_async(&f) { + if let Ok(mailbox_job) = self.backend.write().unwrap().fetch_async(&f) { let mailbox_job = mailbox_job.into_future(); let (rcvr, handle, job_id) = self.job_executor.spawn_specialized(mailbox_job); @@ -541,7 +541,7 @@ impl Account { ))) .unwrap(); self.active_jobs - .insert(job_id, JobRequest::Get(*h, handle, rcvr)); + .insert(job_id, JobRequest::Fetch(*h, handle, rcvr)); } } else { entry.worker = match Account::new_worker( @@ -576,7 +576,7 @@ impl Account { work_context: &WorkContext, notify_fn: Arc, ) -> Result { - let mut mailbox_handle = backend.write().unwrap().get(&mailbox)?; + let mut mailbox_handle = backend.write().unwrap().fetch(&mailbox)?; let mut builder = AsyncBuilder::new(); let our_tx = builder.tx(); let mailbox_hash = mailbox.hash(); @@ -1012,8 +1012,8 @@ impl Account { } MailboxStatus::None => { if self.is_async { - if !self.active_jobs.values().any(|j| j.is_get(mailbox_hash)) { - match self.backend.write().unwrap().get_async( + if !self.active_jobs.values().any(|j| j.is_fetch(mailbox_hash)) { + match self.backend.write().unwrap().fetch_async( &&self.mailbox_entries[&mailbox_hash].ref_mailbox, ) { Ok(mailbox_job) => { @@ -1027,7 +1027,7 @@ impl Account { .unwrap(); self.active_jobs.insert( job_id, - JobRequest::Get(mailbox_hash, handle, rcvr), + JobRequest::Fetch(mailbox_hash, handle, rcvr), ); } Err(err) => { @@ -1633,7 +1633,7 @@ impl Account { } } } - JobRequest::Get(mailbox_hash, _, mut chan) => { + JobRequest::Fetch(mailbox_hash, _, mut chan) => { self.sender .send(ThreadEvent::UIEvent(UIEvent::StatusEvent( StatusEvent::JobFinished(*job_id), @@ -1667,7 +1667,7 @@ impl Account { ))) .unwrap(); self.active_jobs - .insert(job_id, JobRequest::Get(mailbox_hash, handle, rcvr)); + .insert(job_id, JobRequest::Fetch(mailbox_hash, handle, rcvr)); let payload = payload.unwrap(); if let Err(err) = payload { self.mailbox_entries diff --git a/src/plugins/backend.rs b/src/plugins/backend.rs index c5a7b602..a99346b7 100644 --- a/src/plugins/backend.rs +++ b/src/plugins/backend.rs @@ -98,7 +98,7 @@ impl MailBackend for PluginBackend { } } - fn get(&mut self, mailbox: &Mailbox) -> Result>>> { + fn fetch(&mut self, mailbox: &Mailbox) -> Result>>> { let mut w = AsyncBuilder::new(); let _mailbox_hash = mailbox.hash(); let channel = self.channel.clone();