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: ValueImplementations§
Source§impl ColdSegment
impl ColdSegment
Sourcepub fn scan(dir: &Path) -> Result<Vec<Arc<ColdSegment>>, String>
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.
Sourcepub fn verify_files(&self) -> Result<(), String>
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.
pub fn is_open(&self) -> bool
Sourcepub fn write_seal(&self, threads: usize) -> Result<PathBuf, String>
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.
Sourcepub fn patches_derived(&self) -> bool
pub fn patches_derived(&self) -> bool
Whether the segment stores only the patches the metadata doesn’t give.
Sourcepub fn recode(&self, part: usize) -> Result<Value, String>
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.
Sourcepub fn drop_index(&self) -> Result<u64, String>
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.
Sourcepub fn cached_bytes(&self) -> usize
pub fn cached_bytes(&self) -> usize
Bytes of prepared blocks in the cache (codec estimate).
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for ColdSegment
impl RefUnwindSafe for ColdSegment
impl Send for ColdSegment
impl Sync for ColdSegment
impl Unpin for ColdSegment
impl UnsafeUnpin for ColdSegment
impl UnwindSafe for ColdSegment
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].