Skip to main content

ColdSegment

Struct ColdSegment 

Source
pub struct ColdSegment {
    pub first: u32,
    pub last: u32,
    pub kinds: Kinds,
    pub manifest: Value,
    /* private fields */
}
Expand description

A published cold segment. Files are opened on the first read.

Fields§

§first: u32§last: u32§kinds: Kinds§manifest: Value

Implementations§

Source§

impl ColdSegment

Source

pub fn scan(dir: &Path) -> Result<Vec<Arc<ColdSegment>>, String>

Segments in a directory from their manifests, by ascending first ledger; overlapping segments are an error.

Source

pub fn verify_files(&self) -> Result<(), String>

SHA-512Half of all files, checked against the manifest. Expensive on large segments, so it runs during verification, not on every open.

Source

pub fn is_open(&self) -> bool

Source

pub fn sealed(&self) -> bool

Whether the segment has a seal file.

Source

pub fn write_seal(&self, threads: usize) -> Result<PathBuf, String>

Checks every block in full and writes the seal next to the archive file. If the archive is a link, the seal goes next to its target and gets a link here. Takes effect from the next time the segment is opened.

Source

pub fn in_parts(&self) -> bool

Whether the segment’s blocks are JC06 (cut into parts).

Source

pub fn patches_derived(&self) -> bool

Whether the segment stores only the patches the metadata doesn’t give.

Source

pub fn recode(&self, part: usize) -> Result<Value, String>

Writes the segment again in the current format, with JC06 blocks of at most part exact bytes per part, next to the archive (the target of a link). The ledgers, indexes and change kinds come out the same, which is checked; the archive, seal and manifest are then replaced, each by rename. A reader that has the segment open keeps the old archive; one that opens it between the renames finds a seal that doesn’t match and checks blocks in full. Returns the new manifest.

Source

pub fn drop_index(&self) -> Result<u64, String>

Removes the ASIX2 indexes of a segment written before 0.3: the manifest is replaced first (via a temporary file and rename), then the file, so a crash in between leaves only an unlisted file behind. Returns the bytes freed; 0 if the segment has none.

Source

pub fn close(&self)

Closes the files and frees the block cache; reads in progress finish.

Source

pub fn cached_bytes(&self) -> usize

Bytes of prepared blocks in the cache (codec estimate).

Source

pub fn ledger(&self, seq: u32, with_changes: bool) -> Result<Ledger, String>

Ledger seq: header and transactions, plus changes if with_changes (requires explicit kinds).

Trait Implementations§

Source§

impl Debug for ColdSegment

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> IntoRequest<T> for T

§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
§

impl<L> LayerExt<L> for L

§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in [Layered].
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more