Struct Scheduler

Source
pub struct Scheduler<Creds> { /* private fields */ }
Expand description

A scheduler client to interact with the scheduler service. It has different implementations depending on the implementations

Implementations§

Source§

impl<Creds> Scheduler<Creds>
where Creds: TlsConfigProvider,

Source

pub async fn new(network: Network, creds: Creds) -> Result<Scheduler<Creds>>

Creates a new scheduler client with the provided parameters. A scheduler created this way is considered unauthenticated and limited in its scope.

§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Nobody::new();
let scheduler = Scheduler::new(network, creds).await.unwrap();
Source

pub async fn with( network: Network, creds: Creds, uri: impl Into<String>, ) -> Result<Scheduler<Creds>>

Creates a new scheduler client with the provided parameters and custom URI. A scheduler created this way is considered unauthenticated and limited in its scope.

§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Nobody::new();
let uri = "https://example.com".to_string();
let scheduler = Scheduler::with(network, creds, uri).await.unwrap();
Source§

impl<Creds> Scheduler<Creds>

Source

pub async fn register( &self, signer: &Signer, invite_code: Option<String>, ) -> Result<RegistrationResponse>

Registers a new node with the scheduler service.

§Arguments
  • signer - The signer instance bound to the node.
  • invite_code - Optional invite code to register the node.
§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Nobody::new();
let scheduler = Scheduler::new(network, creds.clone()).await.unwrap();
let secret = vec![0, 0, 0, 0];
let signer = Signer::new(secret, network, creds).unwrap(); // Create or obtain a signer instance
let registration_response = scheduler.register(&signer, None).await.unwrap();
Source

pub async fn recover(&self, signer: &Signer) -> Result<RecoveryResponse>

Recovers a previously registered node with the scheduler service.

§Arguments
  • signer - The signer instance used to sign the recovery challenge.
§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Nobody::new();
let scheduler = Scheduler::new(network, creds.clone()).await.unwrap();
let secret = vec![0, 0, 0, 0];
let signer = Signer::new(secret, network, creds).unwrap(); // Create or obtain a signer instance
let recovery_response = scheduler.recover(&signer).await.unwrap();
Source

pub async fn authenticate<Auth>(&self, creds: Auth) -> Result<Scheduler<Auth>>

Elevates the scheduler client to an authenticated scheduler client that is able to schedule a node for example.

§Arguments
  • creds - Credentials that carry a TlsConfig and a Rune. These are credentials returned during registration or recovery.
§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Nobody::new();
let scheduler_unauthed = Scheduler::new(network, creds.clone()).await.unwrap();
let secret = vec![0, 0, 0, 0];
let signer = Signer::new(secret, network, creds).unwrap(); // Create or obtain a signer instance
let registration_response = scheduler_unauthed.register(&signer, None).await.unwrap();
let creds = Device::from_bytes(registration_response.creds);
let scheduler_authed = scheduler_unauthed.authenticate(creds);
Source§

impl<Creds> Scheduler<Creds>

Source

pub async fn schedule(&self) -> Result<NodeInfoResponse>

Schedules a node at the scheduler service. Once a node is scheduled one can access it through the node client.

§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Device::from_path("my/path/to/credentials.glc");
let scheduler = Scheduler::new(network, creds.clone()).await.unwrap();
let info = scheduler.schedule().await.unwrap();
let node_client: Client  = Node::new(node_id, creds).unwrap().connect(info.grpc_uri).await.unwrap();
Source

pub async fn node<T>(&self) -> Result<T>
where T: GrpcClient,

Schedules a node at the scheduler service and returns a node client.

§Example
let node_id = vec![0, 1, 2, 3];
let network = Network::Regtest;
let creds = Device::from_path("my/path/to/credentials.glc");
let scheduler = Scheduler::new(network, creds.clone()).await.unwrap();
let node_client: Client  = scheduler.node().await.unwrap();
Source

pub async fn get_node_info(&self, wait: bool) -> Result<NodeInfoResponse>

Source

pub async fn export_node(&self) -> Result<ExportNodeResponse>

Source

pub async fn get_invite_codes(&self) -> Result<ListInviteCodesResponse>

Source

pub async fn add_outgoing_webhook( &self, uri: String, ) -> Result<AddOutgoingWebhookResponse>

Source

pub async fn list_outgoing_webhooks( &self, ) -> Result<ListOutgoingWebhooksResponse>

Source

pub async fn delete_webhooks(&self, webhook_ids: Vec<i64>) -> Result<Empty>

Source

pub async fn rotate_outgoing_webhook_secret( &self, webhook_id: i64, ) -> Result<WebhookSecretResponse>

Trait Implementations§

Source§

impl<Creds: Clone> Clone for Scheduler<Creds>

Source§

fn clone(&self) -> Scheduler<Creds>

Returns a copy of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<Creds> !Freeze for Scheduler<Creds>

§

impl<Creds> !RefUnwindSafe for Scheduler<Creds>

§

impl<Creds> Send for Scheduler<Creds>
where Creds: Send,

§

impl<Creds> Sync for Scheduler<Creds>
where Creds: Sync,

§

impl<Creds> Unpin for Scheduler<Creds>
where Creds: Unpin,

§

impl<Creds> !UnwindSafe for Scheduler<Creds>

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> Any for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Source§

fn type_name(&self) -> &'static str

Source§

impl<T> AnySync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Source§

impl<T> AsAny for T
where T: Any,

Source§

fn as_any(&self) -> &(dyn Any + 'static)

Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Source§

fn type_name(&self) -> &'static str

Gets the type name of self
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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> 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> Downcast for T
where T: AsAny + ?Sized,

Source§

fn is<T>(&self) -> bool
where T: AsAny,

Returns true if the boxed type is the same as T. Read more
Source§

fn downcast_ref<T>(&self) -> Option<&T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

fn downcast_mut<T>(&mut self) -> Option<&mut T>
where T: AsAny,

Forward to the method defined on the type Any.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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> 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

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

impl<T> ErasedDestructor for T
where T: 'static,