Struct veilid_core::VeilidAPI

source ·
pub struct VeilidAPI { /* private fields */ }
Expand description

The primary developer entrypoint into veilid-core functionality

From VeilidAPI one can access:

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

Access the configuration that Veilid was initialized with

source

pub fn crypto(&self) -> VeilidAPIResult<Crypto>

Get the cryptosystem manager

source

pub fn table_store(&self) -> VeilidAPIResult<TableStore>

Get the TableStore manager

source

pub fn protected_store(&self) -> VeilidAPIResult<ProtectedStore>

Get the ProtectedStore manager

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 parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target>

Parse a string into a target object that can be used in a RoutingContext

Strings are in base64url format and can either be a remote route id or a node id. Strings may have a CryptoKind FourCC prefix separated by a colon, such as: VLD0:XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE but if the prefix is left off XmnGyJrjMJBRC5ayJZRPXWTBspdX36-pbLb98H3UMeE will be parsed with the ‘best’ cryptosystem available (at the time of this writing this is VLD0)

source

pub async fn new_private_route(&self) -> VeilidAPIResult<(RouteId, Vec<u8>)>

Allocate a new private route set with default cryptography and network options Default settings are for Stability::Reliable and Sequencing::EnsureOrdered 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<(RouteId, Vec<u8>)>

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 async fn debug_help(&self, _args: String) -> VeilidAPIResult<String>

Get the help text for ‘internal debug’ commands

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

source§

const ALIGN: usize = _

The alignment of pointer.
§

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

§

type Output = T

Should always be Self
source§

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

§

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

§

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

§

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