conf: Rename cache_type to search_backend

memfd
Manos Pitsidianakis 4 years ago
parent 017a45d5cd
commit 5ef62a39b8
No known key found for this signature in database
GPG Key ID: 73627C2F690DF710

@ -143,7 +143,7 @@ uses the SEARCH command,
uses libnotmuch and uses libnotmuch and
.Em Maildir/mbox .Em Maildir/mbox
performs a slow linear search. performs a slow linear search.
It is advised to use a cache on It is advised to use a search backend on
.Em Maildir/mbox .Em Maildir/mbox
accounts. accounts.
.Nm Ns .Nm Ns
@ -159,7 +159,7 @@ and
.Em Date . .Em Date .
The message body (in plain text human readable form) and the flags can also be queried. The message body (in plain text human readable form) and the flags can also be queried.
To enable sqlite3 indexing for an account set To enable sqlite3 indexing for an account set
.Em cache_type .Em search_backend
to to
.Em sqlite3 .Em sqlite3
in the configuration file and to create the sqlite3 index issue command in the configuration file and to create the sqlite3 index issue command
@ -190,7 +190,7 @@ Quotes should always be escaped.
.Sy Important Notice about IMAP/JMAP .Sy Important Notice about IMAP/JMAP
.sp .sp
To prevent downloading all your messages from your IMAP/JMAP server, don't set To prevent downloading all your messages from your IMAP/JMAP server, don't set
.Em cache_type .Em search_backend
to to
.Em sqlite3 Ns .Em sqlite3 Ns
\&. \&.

@ -164,9 +164,9 @@ If true, do not monitor account for changes (you can use shortcut listing.refres
.Pq Em optional .Pq Em optional
command to execute when manually refreshing (shortcut listing.refresh) command to execute when manually refreshing (shortcut listing.refresh)
.Pq Em None .Pq Em None
.It Ic cache_type Ar String .It Ic search_backend Ar String
.Pq Em optional .Pq Em optional
Choose which cache backend to use. Choose which search backend to use.
Available options are 'none' and 'sqlite3' Available options are 'none' and 'sqlite3'
.Pq Em "sqlite3" .Pq Em "sqlite3"
.It Ic vcard_folder Ar String .It Ic vcard_folder Ar String

@ -460,17 +460,17 @@ impl Component for AccountStatus {
); );
write_string_to_grid( write_string_to_grid(
&if a.settings.account().format() == "imap" &if a.settings.account().format() == "imap"
&& *a.settings.conf.cache_type() == CacheType::None && *a.settings.conf.search_backend() == SearchBackend::None
{ {
"server-side search".to_string() "server-side search".to_string()
} else if a.settings.account().format() == "notmuch" } else if a.settings.account().format() == "notmuch"
&& *a.settings.conf.cache_type() == CacheType::None && *a.settings.conf.search_backend() == SearchBackend::None
{ {
"notmuch database".to_string() "notmuch database".to_string()
} else { } else {
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ {
if *a.settings.conf.cache_type() == CacheType::Sqlite3 { if *a.settings.conf.search_backend() == SearchBackend::Sqlite3 {
if let Ok(path) = crate::sqlite3::db_path() { if let Ok(path) = crate::sqlite3::db_path() {
format!("sqlite3 database {}", path.display()) format!("sqlite3 database {}", path.display())
} else { } else {

@ -164,7 +164,7 @@ pub struct FileAccount {
#[serde(default)] #[serde(default)]
mailboxes: HashMap<String, FileMailboxConf>, mailboxes: HashMap<String, FileMailboxConf>,
#[serde(default)] #[serde(default)]
cache_type: CacheType, search_backend: SearchBackend,
#[serde(default = "false_val")] #[serde(default = "false_val")]
pub manual_refresh: bool, pub manual_refresh: bool,
#[serde(default = "none")] #[serde(default = "none")]
@ -220,8 +220,8 @@ impl FileAccount {
&self.root_mailbox &self.root_mailbox
} }
pub fn cache_type(&self) -> &CacheType { pub fn search_backend(&self) -> &SearchBackend {
&self.cache_type &self.search_backend
} }
} }
@ -417,7 +417,7 @@ impl FileSettings {
extra, extra,
manual_refresh, manual_refresh,
refresh_command: _, refresh_command: _,
cache_type: _, search_backend: _,
conf_override: _, conf_override: _,
} = acc.clone(); } = acc.clone();
@ -630,26 +630,26 @@ impl Serialize for IndexStyle {
} }
#[derive(Debug, Clone, PartialEq)] #[derive(Debug, Clone, PartialEq)]
pub enum CacheType { pub enum SearchBackend {
None, None,
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
Sqlite3, Sqlite3,
} }
impl Default for CacheType { impl Default for SearchBackend {
fn default() -> Self { fn default() -> Self {
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
{ {
CacheType::Sqlite3 SearchBackend::Sqlite3
} }
#[cfg(not(feature = "sqlite3"))] #[cfg(not(feature = "sqlite3"))]
{ {
CacheType::None SearchBackend::None
} }
} }
} }
impl<'de> Deserialize<'de> for CacheType { impl<'de> Deserialize<'de> for SearchBackend {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error> fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where where
D: Deserializer<'de>, D: Deserializer<'de>,
@ -657,22 +657,22 @@ impl<'de> Deserialize<'de> for CacheType {
let s = <String>::deserialize(deserializer)?; let s = <String>::deserialize(deserializer)?;
match s.as_str() { match s.as_str() {
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
"sqlite3" => Ok(CacheType::Sqlite3), "sqlite3" => Ok(SearchBackend::Sqlite3),
"nothing" | "none" | "" => Ok(CacheType::None), "nothing" | "none" | "" => Ok(SearchBackend::None),
_ => Err(de::Error::custom("invalid `index_cache` value")), _ => Err(de::Error::custom("invalid `search_backend` value")),
} }
} }
} }
impl Serialize for CacheType { impl Serialize for SearchBackend {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error> fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
where where
S: Serializer, S: Serializer,
{ {
match self { match self {
#[cfg(feature = "sqlite3")] #[cfg(feature = "sqlite3")]
CacheType::Sqlite3 => serializer.serialize_str("sqlite3"), SearchBackend::Sqlite3 => serializer.serialize_str("sqlite3"),
CacheType::None => serializer.serialize_str("none"), SearchBackend::None => serializer.serialize_str("none"),
} }
} }
} }

@ -353,7 +353,7 @@ impl Account {
}; };
if settings.account().format() == "imap" { if settings.account().format() == "imap" {
settings.conf.cache_type = crate::conf::CacheType::None; settings.conf.search_backend = crate::conf::SearchBackend::None;
} }
let mut active_jobs = HashMap::default(); let mut active_jobs = HashMap::default();

Loading…
Cancel
Save