pub struct Pager { /* private fields */ }Expand description
Native host adapter for the shared pager.
Implementations§
Source§impl Pager
impl Pager
Sourcepub fn open<P: AsRef<Path>>(
path: P,
config: PagerConfig,
) -> Result<Self, PagerError>
pub fn open<P: AsRef<Path>>( path: P, config: PagerConfig, ) -> Result<Self, PagerError>
Open or create a database file
Sourcepub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, PagerError>
pub fn open_default<P: AsRef<Path>>(path: P) -> Result<Self, PagerError>
Open with default configuration
Sourcepub fn read_page_decrypted(&self, page_id: u32) -> Result<Page, PagerError>
pub fn read_page_decrypted(&self, page_id: u32) -> Result<Page, PagerError>
Read a page through the configured encryptor if any. Page 0 is always returned plaintext (it carries the encryption marker
- header). Callers that want raw cipher bytes can use
read_page_no_checksumdirectly.
Sourcepub fn write_page_encrypted(
&self,
page_id: u32,
page: Page,
) -> Result<(), PagerError>
pub fn write_page_encrypted( &self, page_id: u32, page: Page, ) -> Result<(), PagerError>
Write a page through the configured encryptor if any. Page 0 bypasses encryption and goes through the normal checksummed path. Encrypted pages skip the checksum update because AES-GCM’s authentication tag is the integrity guarantee.
Sourcepub fn set_wal_writer(&self, wal: Arc<Mutex<WalWriter>>)
pub fn set_wal_writer(&self, wal: Arc<Mutex<WalWriter>>)
Attach a WAL writer to enforce WAL-first flush ordering.
After this call, [Pager::flush] computes the maximum
header.lsn over all dirty pages and calls
WalWriter::flush_until(max_lsn) before any page is written
to the data file. This is the postgres rule: a page on disk
implies its WAL record is already durable on disk.
Existing call sites that construct a Pager without a WAL keep their previous behaviour (no LSN check) — wiring is strictly opt-in.
Sourcepub fn clear_wal_writer(&self)
pub fn clear_wal_writer(&self)
Detach the WAL writer (test / shutdown path).
Sourcepub fn has_wal_writer(&self) -> bool
pub fn has_wal_writer(&self) -> bool
Has a WAL writer been attached?
Sourcepub fn prefetch_hint(&self, page_id: u32)
pub fn prefetch_hint(&self, page_id: u32)
Issue a best-effort OS read-ahead hint under the page-I/O lock.
Methods from Deref<Target = SharedPager<NativePagerFile, NativeWalBarrier>>§
Trait Implementations§
Source§impl PageStore for Pager
impl PageStore for Pager
fn read_page(&self, id: u32) -> Result<Page, PagerError>
fn write_page(&self, id: u32, page: Page) -> Result<(), PagerError>
fn allocate_page(&self, kind: PageType) -> Result<Page, PagerError>
fn free_page(&self, id: u32) -> Result<(), PagerError>
fn page_count(&self) -> Result<u32, PagerError>
fn prefetch_hint(&self, id: u32)
Auto Trait Implementations§
impl !Freeze for Pager
impl RefUnwindSafe for Pager
impl Send for Pager
impl Sync for Pager
impl Unpin for Pager
impl UnsafeUnpin for Pager
impl UnwindSafe for Pager
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
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> ⓘ
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> ⓘ
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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request