Skip to main content

SpawnedCluster

Struct SpawnedCluster 

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

A running regtest cluster containing Bitcoin Core and LND containers.

Implementations§

Source§

impl SpawnedCluster

Source

pub async fn spawn(config: SpawnLndConfig) -> Result<Self, SpawnError>

Spawn a cluster using a validated config and a default Docker connection.

Source

pub async fn spawn_with_docker( docker: DockerClient, config: SpawnLndConfig, ) -> Result<Self, SpawnError>

Spawn a cluster using a caller-provided Docker client.

Source

pub fn cluster_id(&self) -> &str

Return the generated cluster id used in Docker labels.

Source

pub fn config(&self) -> &SpawnLndConfig

Return the config used to spawn this cluster.

Source

pub fn network(&self) -> &ManagedNetwork

Return the managed Docker network used by this cluster.

Source

pub fn bitcoinds(&self) -> &[BitcoinCore]

Return all spawned Bitcoin Core chain groups.

Source

pub fn node(&self, alias: &str) -> Option<&SpawnedNode>

Look up a spawned LND node by alias.

Source

pub fn nodes(&self) -> impl Iterator<Item = &SpawnedNode>

Iterate spawned LND nodes in configured order.

Source

pub fn node_aliases(&self) -> impl Iterator<Item = &str>

Iterate node aliases in configured order.

Source

pub fn node_configs(&self) -> Vec<LndNodeConfig>

Build connection configs for all LND nodes.

Source

pub async fn connect_nodes(&self) -> Result<LndNodeClients, SpawnError>

Connect to all LND nodes with lnd_grpc_rust.

Source

pub async fn connect_peer( &self, from_alias: &str, to_alias: &str, ) -> Result<PeerConnection, SpawnError>

Connect one LND node to another over the Docker bridge network.

Source

pub async fn connect_all_peers(&self) -> Result<Vec<PeerConnection>, SpawnError>

Connect every LND node to every other LND node.

Source

pub async fn fund_node(&self, alias: &str) -> Result<FundingReport, SpawnError>

Fund one LND node with DEFAULT_FUNDING_AMOUNT_BTC.

Source

pub async fn fund_node_with_amount( &self, alias: &str, amount_btc: f64, ) -> Result<FundingReport, SpawnError>

Fund one LND node with a caller-provided BTC amount.

Source

pub async fn fund_nodes<I, S>( &self, aliases: I, ) -> Result<Vec<FundingReport>, SpawnError>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Batch-fund multiple LND nodes with DEFAULT_FUNDING_AMOUNT_BTC each.

Source

pub async fn fund_nodes_with_amount<I, S>( &self, aliases: I, amount_btc: f64, ) -> Result<Vec<FundingReport>, SpawnError>
where I: IntoIterator<Item = S>, S: AsRef<str>,

Batch-fund multiple LND nodes with the same caller-provided BTC amount.

Source

pub async fn open_channel( &self, from_alias: &str, to_alias: &str, ) -> Result<ChannelReport, SpawnError>

Open a public channel with DEFAULT_CHANNEL_CAPACITY_SAT.

Source

pub async fn open_channel_with_amount( &self, from_alias: &str, to_alias: &str, local_funding_amount_sat: i64, ) -> Result<ChannelReport, SpawnError>

Open a public channel with a caller-provided satoshi capacity.

Source

pub async fn stop_lnd(&self, alias: &str) -> Result<(), SpawnError>

Stop an LND container without removing it.

Source

pub async fn start_lnd(&mut self, alias: &str) -> Result<(), SpawnError>

Start an existing LND container and wait until it is synced to chain.

Source

pub async fn restart_lnd(&mut self, alias: &str) -> Result<(), SpawnError>

Restart an LND container and wait until it is synced to chain.

Source

pub async fn stop_bitcoind(&self, group_index: usize) -> Result<(), SpawnError>

Stop a Bitcoin Core chain group container without removing it.

Source

pub async fn start_bitcoind( &mut self, group_index: usize, ) -> Result<(), SpawnError>

Start an existing Bitcoin Core chain group and wait for dependent nodes.

Source

pub async fn restart_bitcoind( &mut self, group_index: usize, ) -> Result<(), SpawnError>

Restart a Bitcoin Core chain group and wait for dependent nodes.

Source

pub async fn shutdown(&mut self) -> Result<CleanupReport, SpawnError>

Stop and remove all containers in this cluster unless keep_containers is set.

Trait Implementations§

Source§

impl Debug for SpawnedCluster

Source§

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

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

impl Drop for SpawnedCluster

Source§

fn drop(&mut self)

Executes the destructor for this 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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
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<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

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