DomainBuilder

Struct DomainBuilder 

Source
pub struct DomainBuilder<S> { /* private fields */ }
Expand description

Builder to configure and create new domains

Obtain an instance via Domain::builder or Domain::from_config, then configure the domain with, for example:

Finally, call build to create the Domain.

Implementations§

Source§

impl<S> DomainBuilder<S>

Source

pub fn with_rocksdb(self, db_options: DbOptions) -> DomainBuilder<DbOptions>

Use RocksDb with the given configuration as storage

Source§

impl DomainBuilder<DbOptions>

Source

pub async fn build(self) -> Result<Domain<Storage>, Error>

Build the domain to get its handles.

Source§

impl<S> DomainBuilder<S>

Source

pub fn with_proving_client(self, proving: Box<dyn Proving>) -> Self

Use the given proving client to generate proofs.

This can be a custom implementation of Proving or a provided one, for example SP1 (the sp1 feature needs to be active for that):

use delta_domain_sdk::{proving, Domain};

builder.with_proving_client(
    Box::new(proving::sp1::Client::global_laws_cpu()
        .with_local_laws_cpu(local_laws_elf))
);
Source

pub fn with_storage<S2>(self, storage: S2) -> DomainBuilder<Database<S2>>
where S2: KeyValueStorageWithColumnFamilies<ColumnFamilyIdentifier = ColumnFamilies, Error = StorageError> + Send + Sync + 'static,

Use a custom KeyValueStorageWithColumnFamilies implementation

§Note

The SDK assumes that iteration order for [ColumnFamilies::PendingVerifiables] (i.e. the column family) is in lexicographical order of the keys/indices.

Source

pub fn with_database<S2>( self, database: Database<S2>, ) -> DomainBuilder<Database<S2>>
where S2: KeyValueStorageWithColumnFamilies<ColumnFamilyIdentifier = ColumnFamilies, Error = StorageError> + Send + Sync + 'static,

Use a custom KeyValueStorageWithColumnFamilies implementation wrapped in a Database.

§Note

The SDK assumes that iteration order for [ColumnFamilies::PendingVerifiables] (i.e. the column family) is in lexicographical order of the keys/indices.

Source

pub fn with_rpc(self, url: impl TryInto<Uri, Error = InvalidUri> + Send) -> Self

Use an RPC to connect to the base layer network.

§Parameters
  • url - of the base layer RPC
Source

pub fn with_mock_rpc(self, mock_vaults: HashMap<Address, Vault>) -> Self

Override any previously configured RPC (even rpc_url from config file) and use a mock RPC as base layer network that can return the given mock_vaults when requested.

Note that only sharded vaults are supported.

Source§

impl<S> DomainBuilder<Database<S>>
where S: KeyValueStorageWithColumnFamilies<ColumnFamilyIdentifier = ColumnFamilies, Error = StorageError> + Send + Sync + 'static,

Source

pub async fn build(self) -> Result<Domain<S>, Error>

Build the domain to get its handles.

Trait Implementations§

Source§

impl<S: Debug> Debug for DomainBuilder<S>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<S> !Freeze for DomainBuilder<S>

§

impl<S> !RefUnwindSafe for DomainBuilder<S>

§

impl<S> Send for DomainBuilder<S>
where S: Send,

§

impl<S> Sync for DomainBuilder<S>
where S: Sync,

§

impl<S> Unpin for DomainBuilder<S>
where S: Unpin,

§

impl<S> !UnwindSafe for DomainBuilder<S>

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more