Skip to main content

VeilidAPI

Struct VeilidAPI 

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

The primary developer entrypoint into veilid-core functionality.

From VeilidAPI one can access various components:

  • VeilidConfig - The Veilid configuration specified at startup time.
  • Crypto - The available set of cryptosystems provided by Veilid.
  • TableStore - The Veilid table-based encrypted persistent key-value store.
  • ProtectedStore - The Veilid abstract of the device’s low-level ‘protected secret storage’.
  • VeilidState - The current state of the Veilid node this API accesses.
  • RoutingContext - Communication methods between Veilid nodes and private routes.
  • Attach and detach from the network.
  • Create and import private routes.
  • Reply to AppCall RPCs.

Implementations§

Source§

impl VeilidAPI

Source

pub async fn shutdown(self)

Shut down Veilid and terminate the API.

Source

pub fn is_shutdown(&self) -> bool

Check to see if Veilid is already shut down.

Source

pub fn config(&self) -> VeilidAPIResult<Arc<VeilidConfig>>

Access the configuration that Veilid was initialized with.

Source

pub fn crypto(&self) -> VeilidAPIResult<VeilidComponentGuard<'_, Crypto>>

Get the cryptosystem component.

Source

pub fn table_store( &self, ) -> VeilidAPIResult<VeilidComponentGuard<'_, TableStore>>

Get the TableStore component.

Source

pub fn protected_store( &self, ) -> VeilidAPIResult<VeilidComponentGuard<'_, ProtectedStore>>

Get the ProtectedStore component.

Source

pub async fn get_state(&self) -> VeilidAPIResult<VeilidState>

Get a full copy of the current state of Veilid.

Source

pub async fn attach(&self) -> VeilidAPIResult<()>

Connect to the network.

Source

pub async fn detach(&self) -> VeilidAPIResult<()>

Disconnect from the network.

Source

pub fn routing_context(&self) -> VeilidAPIResult<RoutingContext>

Get a new RoutingContext object to use to send messages over the Veilid network with default safety, sequencing, and stability parameters.

Source

pub fn get_dht_record_key( &self, schema: DHTSchema, owner_key: PublicKey, encryption_key: Option<SharedSecret>, ) -> VeilidAPIResult<RecordKey>

Deterministicly builds the record key for a given schema and owner public key. The crypto kind of the record key will be that of the owner public key

Source

pub fn generate_member_id( &self, writer_key: &PublicKey, ) -> VeilidAPIResult<MemberId>

Create a new MemberId for use with in creating DHTSchemas.

Source

pub async fn transact_dht_records( &self, record_keys: Vec<RecordKey>, options: Option<TransactDHTRecordsOptions>, ) -> VeilidAPIResult<DHTTransaction>

Start a transaction on a set of DHT records Record keys must have been opened via a routing context already when passed to this function The maximum number of records per transaction is currently 32. Options can be specified that supply a default signing keypair for records that are not opened for writing

Source

pub async fn new_private_route(&self) -> VeilidAPIResult<RouteBlob>

Allocate a new private route set with default cryptography and network options. Default settings are for Stability::Reliable and Sequencing::PreferOrdered. Returns a route id and a publishable ‘blob’ with the route encrypted with each crypto kind. Those nodes importing the blob will have their choice of which crypto kind to use.

Returns a route id and ‘blob’ that can be published over some means (DHT or otherwise) to be imported by another Veilid node.

Source

pub async fn new_custom_private_route( &self, crypto_kinds: &[CryptoKind], stability: Stability, sequencing: Sequencing, ) -> VeilidAPIResult<RouteBlob>

Allocate a new private route and specify a specific cryptosystem, stability and sequencing preference. Faster connections may be possible with Stability::LowLatency, and Sequencing::NoPreference at the expense of some loss of messages. Returns a route id and a publishable ‘blob’ with the route encrypted with each crypto kind. Those nodes importing the blob will have their choice of which crypto kind to use.

Returns a route id and ‘blob’ that can be published over some means (DHT or otherwise) to be imported by another Veilid node.

Source

pub fn import_remote_private_route( &self, blob: Vec<u8>, ) -> VeilidAPIResult<RouteId>

Import a private route blob as a remote private route.

Returns a route id that can be used to send private messages to the node creating this route.

Source

pub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()>

Release either a locally allocated or remotely imported private route.

This will deactivate the route and free its resources and it can no longer be sent to or received from.

Source

pub async fn app_call_reply( &self, call_id: OperationId, message: Vec<u8>, ) -> VeilidAPIResult<()>

Respond to an AppCall received over a VeilidUpdate::AppCall.

Source§

impl VeilidAPI

Source

pub fn debug_help(&self, _args: String) -> VeilidAPIResult<String>

Get the help text for ‘internal debug’ commands.

Source

pub async fn debug_uptime(&self, _args: String) -> VeilidAPIResult<String>

Get node uptime info.

Source

pub async fn debug_die(&self, args: String) -> VeilidAPIResult<String>

Cause veilid-core to panic via various means

Source

pub async fn debug(&self, args: String) -> VeilidAPIResult<String>

Execute an ‘internal debug command’.

Trait Implementations§

Source§

impl Clone for VeilidAPI

Source§

fn clone(&self) -> VeilidAPI

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

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

Performs copy-assignment from source. Read more
Source§

impl Debug for VeilidAPI

Source§

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

Formats the value using the given formatter. 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> 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> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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