pub struct JsonlReceiptLog { /* private fields */ }Expand description
JSON-Lines, append-only ReceiptLog backed by a single rotating file
under data_dir.
One File handle is held open for the process lifetime behind a Mutex
so concurrent delivery streams cannot interleave partial lines. The handle
is opened in append mode (O_APPEND), so even across the (already
serialized) writes each write_all lands at the current end of file.
Rotation (issue #802) swaps that handle under the same lock; see the
module-level rotation note.
Implementations§
Source§impl JsonlReceiptLog
impl JsonlReceiptLog
Sourcepub fn open(data_dir: &Path, policy: RotationPolicy) -> Result<Self>
pub fn open(data_dir: &Path, policy: RotationPolicy) -> Result<Self>
Open (or create) the receipt log under data_dir with rotation policy.
The file is opened in append mode and, on Unix, created with mode
0o600; an existing file’s mode is tightened to 0o600 as
defense-in-depth (idempotent — skipped when already correct, so a
read-only mount with the right mode does not brick startup). The
in-memory rotation counter is seeded from the existing file length so a
log that is already near the cap rotates on the next append rather than
only after a full cap’s worth of fresh writes.
Unlike crate::channel_store::PersistentPoolStateStore::open, a
failure here is not required to abort node bring-up: the receipt log
is an audit artifact, not the #527 replay guard. The runtime decides the
fatality (it currently logs and continues without the audit log).
§Errors
Returns a std::io::Error if the file cannot be opened/created, its
mode cannot be tightened, or its current length cannot be read.
Trait Implementations§
Source§impl Debug for JsonlReceiptLog
impl Debug for JsonlReceiptLog
Source§impl ReceiptLog for JsonlReceiptLog
impl ReceiptLog for JsonlReceiptLog
Auto Trait Implementations§
impl !Freeze for JsonlReceiptLog
impl RefUnwindSafe for JsonlReceiptLog
impl Send for JsonlReceiptLog
impl Sync for JsonlReceiptLog
impl Unpin for JsonlReceiptLog
impl UnsafeUnpin for JsonlReceiptLog
impl UnwindSafe for JsonlReceiptLog
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> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
Source§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request