Skip to main content

Segment

Trait Segment 

Source
pub trait Segment:
    Send
    + Sync
    + 'static {
    // Required methods
    fn compact(
        &self,
        out_file: &impl FileExt,
        id: Uuid,
    ) -> impl Future<Output = Result<Vec<u8>>> + Send;
    fn start_frame_no(&self) -> u64;
    fn last_committed(&self) -> u64;
    fn index(&self) -> &Map<Arc<[u8]>>;
    fn read_page(
        &self,
        page_no: u32,
        max_frame_no: u64,
        buf: &mut [u8],
    ) -> Result<bool>;
    fn is_checkpointable(&self) -> bool;
    fn size_after(&self) -> u32;
    async fn read_frame_offset_async<B>(
        &self,
        offset: u32,
        buf: B,
    ) -> (B, Result<()>)
       where B: IoBufMut + Send + 'static;
    fn timestamp(&self) -> DateTime<Utc>;
    fn destroy<IO: Io>(&self, io: &IO) -> impl Future<Output = ()>;
}

Required Methods§

Source

fn compact( &self, out_file: &impl FileExt, id: Uuid, ) -> impl Future<Output = Result<Vec<u8>>> + Send

Source

fn start_frame_no(&self) -> u64

Source

fn last_committed(&self) -> u64

Source

fn index(&self) -> &Map<Arc<[u8]>>

Source

fn read_page( &self, page_no: u32, max_frame_no: u64, buf: &mut [u8], ) -> Result<bool>

Source

fn is_checkpointable(&self) -> bool

returns the number of readers currently holding a reference to this log. The read count must monotonically decrease.

Source

fn size_after(&self) -> u32

The size of the database after applying this segment.

Source

async fn read_frame_offset_async<B>( &self, offset: u32, buf: B, ) -> (B, Result<()>)
where B: IoBufMut + Send + 'static,

Source

fn timestamp(&self) -> DateTime<Utc>

Source

fn destroy<IO: Io>(&self, io: &IO) -> impl Future<Output = ()>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T: Segment> Segment for Arc<T>

Source§

fn compact( &self, out_file: &impl FileExt, id: Uuid, ) -> impl Future<Output = Result<Vec<u8>>> + Send

Source§

fn start_frame_no(&self) -> u64

Source§

fn last_committed(&self) -> u64

Source§

fn index(&self) -> &Map<Arc<[u8]>>

Source§

fn read_page( &self, page_no: u32, max_frame_no: u64, buf: &mut [u8], ) -> Result<bool>

Source§

fn is_checkpointable(&self) -> bool

Source§

fn size_after(&self) -> u32

Source§

async fn read_frame_offset_async<B>( &self, offset: u32, buf: B, ) -> (B, Result<()>)
where B: IoBufMut + Send + 'static,

Source§

fn destroy<IO: Io>(&self, io: &IO) -> impl Future<Output = ()>

Source§

fn timestamp(&self) -> DateTime<Utc>

Implementors§

Source§

impl<F> Segment for SealedSegment<F>
where F: FileExt,