Skip to main content

RedbStorage

Struct RedbStorage 

Source
pub struct RedbStorage { /* private fields */ }
Expand description

redb-backed persistent storage adapter for BEAM.

Stores the graph in a single redb database file. Each Put commits inline (ACID) inside spawn_blocking so the fsync does not block the async runtime. Reads are concurrent. Flush is an immediate ack (puts already fsync on commit).

§Example

use beam::adapters::RedbStorage;
use beam::Config;

let storage = RedbStorage::new_with_config(Config::default(), "my-db.redb", None);

Implementations§

Source§

impl RedbStorage

Source

pub fn new() -> Self

Creates a new redb storage at the default path beam.redb.

§Panics

Panics if the database cannot be created or opened.

Source

pub fn new_with_config<P: AsRef<Path>>( config: Config, path: P, _max_size: Option<u64>, ) -> Self

Creates a new redb storage with explicit config and path.

§Arguments
  • config - Node configuration
  • path - File path for the redb database
  • _max_size - Optional maximum database size (currently unused)
§Panics

Panics if the database cannot be created or opened at the given path.

Trait Implementations§

Source§

impl Actor for RedbStorage

Source§

fn try_clone_storage(&self) -> Option<Box<dyn Actor>>

Returns a boxed clone for the storage read/write actor split.

Both the read and write actor share the same Arc<Database>, so reads see committed writes immediately via redb’s MVCC snapshots.

Source§

fn pre_start<'life0, 'life1, 'async_trait>( &'life0 mut self, _ctx: &'life1 ActorContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called once before the actor starts processing messages. Read more
Source§

fn stopping<'life0, 'life1, 'async_trait>( &'life0 mut self, _ctx: &'life1 ActorContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Called once after the actor’s message loop exits. Read more
Source§

fn handle<'life0, 'life1, 'async_trait>( &'life0 mut self, message: Arc<Message>, ctx: &'life1 ActorContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Handle an incoming message. Read more
Source§

fn handle_batch<'life0, 'life1, 'life2, 'async_trait>( &'life0 mut self, batch: &'life1 mut Vec<Arc<Message>>, context: &'life2 ActorContext, ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Handle a batch of messages drained from the mailbox. Read more
Source§

fn subscribe_to_everything(&self) -> bool

Whether this actor wants to receive all messages (not just addressed to it). Used by the Multicast adapter. Read more
Source§

impl Clone for RedbStorage

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for RedbStorage

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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