#[non_exhaustive]pub struct EncodeContext<'a> {
pub source_id: i64,
pub source_uuid: Option<&'a str>,
pub stream: &'a str,
}archive only.Expand description
Which stream an encode is for, and whose: what an encoder is told beside
the rows. See SegmentEncoder::encode.
A stream name is unique only within its source, and one writer can hold
several sources with the same stream names (two hosts recording cpu),
so an encoder that keeps per-stream state, such as labels a long table
states once, keys it by source as well as by stream.
Key state that outlives one archive by source_uuid, which a plain copy
carries unchanged; source_id is unique only within one file, and a
copy renumbers it. source_uuid is None for a source from before the
column, and a copy mints one for the destination that the encoder is not
told. So does a copy kept under a fresh uuid
(rewrite::copy_sources_into_as_copies); later seals of its live rows
pass the minted one.
A copy passes the source archive’s id and uuid, because the rows it encodes (the live tail it carries across) are that source’s, and an encoder’s state about them was built under that key. A ranged copy can leave out earlier segments that a state-carrying encoder’s output depended on, such as the segment that stated a long table’s labels; the copy cannot tell, so such an encoder must not assume that what it emitted for a source before is in the destination.
#[non_exhaustive]: fields are added without a breaking release. Read
the fields; build one with new, which a caller only needs
when it drives an encoder itself, in a test.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.source_id: i64The source’s row id in the archive the rows are in. Unique only within that file: a copy renumbers it, so it names the source for the life of one handle on one file, not across files.
source_uuid: Option<&'a str>The source’s uuid (FORMAT.md §3.1), which a plain copy carries
unchanged, or None for a source from before the uuid column. A
copy of such a source, and a copy kept under a fresh uuid
(rewrite::copy_sources_into_as_copies), mint a uuid for the
destination that the encoder is not told.
stream: &'a strThe stream whose rows these are.
Implementations§
Trait Implementations§
Source§impl<'a> Clone for EncodeContext<'a>
impl<'a> Clone for EncodeContext<'a>
impl<'a> Copy for EncodeContext<'a>
Source§impl<'a> Debug for EncodeContext<'a>
impl<'a> Debug for EncodeContext<'a>
impl<'a> Eq for EncodeContext<'a>
Source§impl<'a> PartialEq for EncodeContext<'a>
impl<'a> PartialEq for EncodeContext<'a>
impl<'a> StructuralPartialEq for EncodeContext<'a>
Auto Trait Implementations§
impl<'a> Forget for EncodeContext<'a>
impl<'a> Freeze for EncodeContext<'a>
impl<'a> Move for EncodeContext<'a>
impl<'a> RefUnwindSafe for EncodeContext<'a>
impl<'a> Send for EncodeContext<'a>
impl<'a> Sync for EncodeContext<'a>
impl<'a> Unpin for EncodeContext<'a>
impl<'a> UnsafeUnpin for EncodeContext<'a>
impl<'a> UnwindSafe for EncodeContext<'a>
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.