Skip to main content

MmapSequenceStore

Struct MmapSequenceStore 

Source
pub struct MmapSequenceStore { /* private fields */ }
Expand description

A sequence store backed by memory-mapped FASTA files.

Only the digest index and metadata are held in RAM. Sequence bytes are read from the memory-mapped file on each request, with the OS managing page caching.

Requires a .refget.json digest cache for each FASTA file. Use refget-tools cache to generate them.

Implementations§

Source§

impl MmapSequenceStore

Source

pub fn new() -> Self

Create an empty store.

Source

pub fn mark_circular(&mut self, circular_names: &[String])

Mark sequences with matching names as circular.

Source

pub fn add_fasta<P: AsRef<Path>>( &mut self, path: P, ) -> StoreResult<Vec<FastaSequenceSummary>>

Add a FASTA file to the store via memory mapping.

Requires a fresh .refget.json digest cache. Returns an error if the cache is missing or stale.

Trait Implementations§

Source§

impl Default for MmapSequenceStore

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl SequenceStore for MmapSequenceStore

Source§

fn get_sequence( &self, digest: &str, start: Option<u64>, end: Option<u64>, ) -> StoreResult<Option<Vec<u8>>>

Retrieve sequence bases by digest (MD5 or sha512t24u). Supports optional start/end for subsequence retrieval (0-based, half-open).
Source§

fn get_metadata(&self, digest: &str) -> StoreResult<Option<SequenceMetadata>>

Retrieve metadata for a sequence by digest.
Source§

fn get_length(&self, digest: &str) -> StoreResult<Option<u64>>

Retrieve the length of a sequence by digest.

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
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

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.