Skip to main content

InlineFallbackBackend

Struct InlineFallbackBackend 

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

Default backend used when no external DA layer (EigenDA / Celestia / Avail) is configured. Stores submitted payloads in an in-memory DashMap keyed by a synthetic locator fallback:<sha256_hex> and round-trips them through fetch. This keeps the receipt-offload path functional pre-mainnet so the rest of the system (commitments, indices, RPC) can be exercised end-to-end without standing up a real DA layer.

Optionally takes a crate::kv::KvStore handle (with_storage) so the fallback DashMap is backed by CF_METADATA under the da_fallback: prefix. Without storage the cache is in-process only and submissions do not survive a restart — fine for tests and unit work, not fine for any persisted receipt that needs to round-trip through fetch after a process restart. Node startup and RocksDbChannelStorage wire in the shared RocksDbStore so consensus-relevant offloaded payloads survive restarts even before EigenDA / Celestia / Avail land.

Operators see inline_fallback in tenzro_getDaBackends and know external availability is not guaranteed (no signed attestations, no cross-node replication). Production deployments swap this out for a real backend behind the matching feature flag.

Implementations§

Source§

impl InlineFallbackBackend

Source

pub fn new() -> Self

Source

pub fn with_storage(self, storage: Arc<dyn KvStore>) -> Self

Wire a durable KvStore so submitted payloads survive process restarts under CF_METADATA / da_fallback:<locator>.

Source

pub fn arc() -> Arc<dyn DaBackend>

Source

pub fn submit_sync(&self, namespace: &[u8], payload: &[u8]) -> DaPointer

Synchronous submit helper for callers in non-async contexts.

Mirrors DaBackend::submit but without the async wrapper — the inline fallback does pure in-memory work, so there is nothing to suspend on. Used by sync persistence paths (channel storage, etc.) that wrap their payloads in a ReceiptEnvelope without taking a &dyn DaBackend dependency.

When backed by a crate::kv::KvStore (via with_storage) the payload is also mirror-written under CF_METADATA / da_fallback:<locator> for cross-restart durability. Storage write failures are downgraded to a tracing::warn — the in-memory cache is still populated, so the same-process round-trip stays functional.

Source

pub fn fetch_sync(&self, pointer: &DaPointer) -> Result<Vec<u8>>

Synchronous fetch helper. See Self::submit_sync.

Looks up the in-memory cache first; on miss, falls back to the configured KvStore (re-populating the cache on hit) so submissions from a previous process incarnation are still resolvable.

Trait Implementations§

Source§

impl DaBackend for InlineFallbackBackend

Source§

fn id(&self) -> DaBackendId

Source§

fn status(&self) -> DaBackendStatus

Source§

fn submit<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, namespace: &'life1 [u8], payload: &'life2 [u8], ) -> Pin<Box<dyn Future<Output = Result<DaPointer>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Source§

fn fetch<'life0, 'life1, 'async_trait>( &'life0 self, pointer: &'life1 DaPointer, ) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

fn verify_availability<'life0, 'life1, 'async_trait>( &'life0 self, pointer: &'life1 DaPointer, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source§

impl Debug for InlineFallbackBackend

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for InlineFallbackBackend

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