pub struct CurrentSegment<F> { /* private fields */ }
Implementations§
Source§impl<F> CurrentSegment<F>
impl<F> CurrentSegment<F>
Sourcepub 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,
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.
pub fn log_id(&self) -> Uuid
pub fn is_empty(&self) -> bool
pub fn with_header<R>(&self, f: impl FnOnce(&SegmentHeader) -> R) -> R
pub fn last_committed(&self) -> u64
pub fn next_frame_no(&self) -> NonZeroU64
pub fn count_committed(&self) -> usize
pub fn db_size(&self) -> u32
pub fn current_checksum(&self) -> u32
Sourcepub 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,
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.
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,
Sourcepub fn find_frame(&self, page_no: u32, tx: &Transaction<F>) -> Option<u32>
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
Sourcepub fn read_page_offset(&self, offset: u32, buf: &mut [u8]) -> Result<()>where
F: FileExt,
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
pub fn frame_header_at(&self, offset: u32) -> Result<FrameHeader>where
F: FileExt,
Sourcepub fn seal(&self, now: DateTime<Utc>) -> Result<Option<SealedSegment<F>>>where
F: FileExt,
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
pub fn last_committed_frame_no(&self) -> u64
pub fn inc_reader_count(&self)
Sourcepub fn dec_reader_count(&self) -> bool
pub fn dec_reader_count(&self) -> bool
return true if the reader count is 0
pub fn read_locks(&self) -> &AtomicU64
pub fn is_sealed(&self) -> bool
pub fn tail(&self) -> &Arc<SegmentList<SealedSegment<F>>>
Trait Implementations§
Auto Trait Implementations§
impl<F> !Freeze for CurrentSegment<F>
impl<F> !RefUnwindSafe for CurrentSegment<F>
impl<F> Send for CurrentSegment<F>
impl<F> Sync for CurrentSegment<F>
impl<F> Unpin for CurrentSegment<F>
impl<F> !UnwindSafe for CurrentSegment<F>
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreCreates a shared type from an unshared type.