pub struct IdentityJournal { /* private fields */ }Expand description
The journal in a manifests directory.
Implementations§
Source§impl IdentityJournal
impl IdentityJournal
Sourcepub fn lock(&self) -> Result<JournalLock, IdentityError>
pub fn lock(&self) -> Result<JournalLock, IdentityError>
Take the exclusive lock (blocking). On a brand-new install (no lock
file and no journal yet) this also creates the journal with an
init record, so from then on a missing journal is an error.
Sourcepub fn try_lock(&self) -> Result<Option<JournalLock>, IdentityError>
pub fn try_lock(&self) -> Result<Option<JournalLock>, IdentityError>
Take the exclusive lock if free; None when someone holds it.
Take a shared lock for reading. Never creates the lock file (a reader must not make an unused install look initialised).
Sourcepub fn read(
&self,
other_evidence: bool,
) -> Result<Vec<JournalRecord>, IdentityError>
pub fn read( &self, other_evidence: bool, ) -> Result<Vec<JournalRecord>, IdentityError>
Every record, oldest first (the init marker is not returned),
under a shared lock. other_evidence says whether anything else
proves the journal should exist (a certificate file or a
user.projects chain event). See Self::read_locked.
Sourcepub fn read_locked(
&self,
_lock: &JournalLock,
other_evidence: bool,
) -> Result<Vec<JournalRecord>, IdentityError>
pub fn read_locked( &self, _lock: &JournalLock, other_evidence: bool, ) -> Result<Vec<JournalRecord>, IdentityError>
Self::read for a caller already holding the exclusive lock.
Sourcepub fn append(
&self,
lock: &JournalLock,
rec: &JournalRecord,
) -> Result<(), IdentityError>
pub fn append( &self, lock: &JournalLock, rec: &JournalRecord, ) -> Result<(), IdentityError>
Append rec, fsynced. Parses the existing journal first and refuses
(leaving it untouched) if it does not parse or does not end in a
newline.
Sourcepub fn salvage(&self, _lock: &JournalLock) -> Vec<JournalRecord>
pub fn salvage(&self, _lock: &JournalLock) -> Vec<JournalRecord>
Every record of the journal that parses, line by line, ignoring any line that does not (a torn tail must not hide earlier records). Unverified: the caller rebuilds a view, which re-verifies certificates.
Sourcepub fn replace(
&self,
_lock: &JournalLock,
records: &[JournalRecord],
) -> Result<Option<PathBuf>, IdentityError>
pub fn replace( &self, _lock: &JournalLock, records: &[JournalRecord], ) -> Result<Option<PathBuf>, IdentityError>
Repair: move the current journal (if any) aside as
identity.journal.jsonl.corrupt-<unix secs> and write a new one from
records. Returns the path of the moved file.
Trait Implementations§
Source§impl Clone for IdentityJournal
impl Clone for IdentityJournal
Auto Trait Implementations§
impl Freeze for IdentityJournal
impl RefUnwindSafe for IdentityJournal
impl Send for IdentityJournal
impl Sync for IdentityJournal
impl Unpin for IdentityJournal
impl UnsafeUnpin for IdentityJournal
impl UnwindSafe for IdentityJournal
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more