Struct CurrentSegment

Source
pub struct CurrentSegment<F> { /* private fields */ }

Implementations§

Source§

impl<F> CurrentSegment<F>

Source

pub fn create( segment_file: F, path: PathBuf, start_frame_no: NonZeroU64, db_size: u32, tail: Arc<SegmentList<SealedSegment<F>>>, salt: u32, log_id: Uuid, ) -> Result<Self>
where F: FileExt,

Create a new segment from the given path and metadata. The file pointed to by path must not exist.

Source

pub fn log_id(&self) -> Uuid

Source

pub fn is_empty(&self) -> bool

Source

pub fn with_header<R>(&self, f: impl FnOnce(&SegmentHeader) -> R) -> R

Source

pub fn last_committed(&self) -> u64

Source

pub fn next_frame_no(&self) -> NonZeroU64

Source

pub fn count_committed(&self) -> usize

Source

pub fn db_size(&self) -> u32

Source

pub fn current_checksum(&self) -> u32

Source

pub async fn inject_frames( &self, frames: Vec<Box<Frame>>, commit_data: Option<(u32, u64)>, tx: &mut TxGuardOwned<F>, ) -> Result<Vec<Box<Frame>>>
where F: FileExt,

insert a bunch of frames in the Wal. The frames needn’t be ordered, therefore, on commit the last frame no needs to be passed alongside the new size_after.

Source

pub fn insert_pages<'a>( &self, pages: impl Iterator<Item = (u32, &'a [u8])>, size_after: Option<u32>, tx: &mut TxGuardShared<'_, F>, ) -> Result<Option<u64>>
where F: FileExt,

Source

pub fn find_frame(&self, page_no: u32, tx: &Transaction<F>) -> Option<u32>

return the offset of the frame for page_no, with frame_no no larger that max_frame_no, if it exists

Source

pub fn read_page_offset(&self, offset: u32, buf: &mut [u8]) -> Result<()>
where F: FileExt,

reads the page conainted in frame at offset into buf

Source

pub fn frame_header_at(&self, offset: u32) -> Result<FrameHeader>
where F: FileExt,

Source

pub fn seal(&self, now: DateTime<Utc>) -> Result<Option<SealedSegment<F>>>
where F: FileExt,

It is expected that sealing is performed under a write lock

Source

pub fn last_committed_frame_no(&self) -> u64

Source

pub fn inc_reader_count(&self)

Source

pub fn dec_reader_count(&self) -> bool

return true if the reader count is 0

Source

pub fn read_locks(&self) -> &AtomicU64

Source

pub fn is_sealed(&self) -> bool

Source

pub fn tail(&self) -> &Arc<SegmentList<SealedSegment<F>>>

Trait Implementations§

Source§

impl<F> Drop for CurrentSegment<F>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more

Auto Trait Implementations§

§

impl<F> !Freeze for CurrentSegment<F>

§

impl<F> !RefUnwindSafe for CurrentSegment<F>

§

impl<F> Send for CurrentSegment<F>
where F: Sync + Send,

§

impl<F> Sync for CurrentSegment<F>
where F: Sync + Send,

§

impl<F> Unpin for CurrentSegment<F>

§

impl<F> !UnwindSafe for CurrentSegment<F>

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> Instrument for T

Source§

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

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

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Unshared, Shared> IntoShared<Shared> for Unshared
where Shared: FromUnshared<Unshared>,

Source§

fn into_shared(self) -> Shared

Creates a shared type from an unshared type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self>

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

impl<T> ErasedDestructor for T
where T: 'static,