pub struct AppState {
pub store: Arc<NotmuchStore>,
pub tokens: Arc<RwLock<TokenStore>>,
pub events: EventBus,
pub read_only: bool,
/* private fields */
}Fields§
§store: Arc<NotmuchStore>§tokens: Arc<RwLock<TokenStore>>§events: EventBus§read_only: boolImplementations§
Source§impl AppState
impl AppState
pub fn new( store: Arc<NotmuchStore>, tokens: TokenStore, read_only: bool, ) -> Self
Sourcepub fn with_token_file(self, path: PathBuf) -> Self
pub fn with_token_file(self, path: PathBuf) -> Self
Names the file the tokens were read from, so a token issued while this server is running is one it will accept.
Sourcepub async fn refresh_tokens(&self)
pub async fn refresh_tokens(&self)
Re-reads the token store when the file has moved under it.
ecr token new is a different process: it writes the file and exits,
and a server holding the copy it read at startup goes on refusing the
token that command just printed. The client reports the server refused
that token about a token that is perfectly valid, and nothing on either
side connects the two — the fix is to restart a server nobody has any
reason to suspect.
The mtime is what bounds the work: an ordinary request pays one stat
and the file is read only when it has actually changed.
A read that fails is kept rather than adopted. TokenStore::save
truncates before it writes, so a request landing in that window sees a
partial file — and taking a parse error for an empty store would turn
authentication off on a running server at the exact moment someone is
issuing a token.
pub async fn requires_auth(&self) -> bool
Sourcepub async fn note_own_write(&self, revision: &Revision)
pub async fn note_own_write(&self, revision: &Revision)
Remembers what a tag write left the database at. notmuch synchronises
maildir flags, so dropping unread renames the file — which the
delivery watcher sees, and would otherwise announce as new mail.