Struct rsdb::PageCache
[−]
[src]
pub struct PageCache<PM, L, P, R> { /* fields omitted */ }
A lock-free pagecache.
Methods
impl<PM, P, R> PageCache<PM, LockFreeLog, P, R> where
PM: Materializer<PartialPage = P, Recovery = R>,
PM: Send + Sync,
P: PartialEq + Clone + Debug + Serialize + DeserializeOwned + Send,
R: PartialEq + Clone + Debug + Serialize + DeserializeOwned,
[src]
PM: Materializer<PartialPage = P, Recovery = R>,
PM: Send + Sync,
P: PartialEq + Clone + Debug + Serialize + DeserializeOwned + Send,
R: PartialEq + Clone + Debug + Serialize + DeserializeOwned,
fn new(pm: PM, config: Config) -> PageCache<PM, LockFreeLog, P, R>
Instantiate a new PageCache
.
fn config(&self) -> &Config
Return the configuration used by the underlying system.
fn recover(&mut self) -> Option<R>
Read updates from the log, apply them to our pagecache.
fn allocate(&self) -> (usize, *const Node<CacheEntry<P>>)
Create a new page, trying to reuse old freed pages if possible
to maximize underlying Radix
pointer density.
fn free(&self, pid: usize)
Free a particular page.
fn get(
&self,
pid: usize
) -> Option<(PM::MaterializedPage, *const Node<CacheEntry<P>>)>
&self,
pid: usize
) -> Option<(PM::MaterializedPage, *const Node<CacheEntry<P>>)>
Try to retrieve a page by its logical ID.
fn replace(
&self,
pid: usize,
old: *const Node<CacheEntry<P>>,
new: Vec<P>
) -> Result<*const Node<CacheEntry<P>>, *const Node<CacheEntry<P>>>
&self,
pid: usize,
old: *const Node<CacheEntry<P>>,
new: Vec<P>
) -> Result<*const Node<CacheEntry<P>>, *const Node<CacheEntry<P>>>
Replace an existing page with a different set of PartialPage
s.
fn prepend(
&self,
pid: usize,
old: *const Node<CacheEntry<P>>,
new: P
) -> Result<*const Node<CacheEntry<P>>, *const Node<CacheEntry<P>>>
&self,
pid: usize,
old: *const Node<CacheEntry<P>>,
new: P
) -> Result<*const Node<CacheEntry<P>>, *const Node<CacheEntry<P>>>
Try to atomically prepend a Materializer::PartialPage
to the page.
Trait Implementations
impl<PM, L, P, R> Send for PageCache<PM, L, P, R> where
PM: Send,
L: Send,
R: Send,
[src]
PM: Send,
L: Send,
R: Send,
impl<PM, L, P, R> Sync for PageCache<PM, L, P, R> where
PM: Sync,
L: Sync,
[src]
PM: Sync,
L: Sync,