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
AppCallRPCs.
Implementations§
Source§impl VeilidAPI
impl VeilidAPI
Sourcepub fn is_shutdown(&self) -> bool
pub fn is_shutdown(&self) -> bool
Check to see if Veilid is already shut down.
Sourcepub fn config(&self) -> VeilidAPIResult<Arc<VeilidConfig>>
pub fn config(&self) -> VeilidAPIResult<Arc<VeilidConfig>>
Access the configuration that Veilid was initialized with.
Sourcepub fn crypto(&self) -> VeilidAPIResult<VeilidComponentGuard<'_, Crypto>>
pub fn crypto(&self) -> VeilidAPIResult<VeilidComponentGuard<'_, Crypto>>
Get the cryptosystem component.
Sourcepub fn table_store(
&self,
) -> VeilidAPIResult<VeilidComponentGuard<'_, TableStore>>
pub fn table_store( &self, ) -> VeilidAPIResult<VeilidComponentGuard<'_, TableStore>>
Get the TableStore component.
Sourcepub fn protected_store(
&self,
) -> VeilidAPIResult<VeilidComponentGuard<'_, ProtectedStore>>
pub fn protected_store( &self, ) -> VeilidAPIResult<VeilidComponentGuard<'_, ProtectedStore>>
Get the ProtectedStore component.
Sourcepub async fn get_state(&self) -> VeilidAPIResult<VeilidState>
pub async fn get_state(&self) -> VeilidAPIResult<VeilidState>
Get a full copy of the current state of Veilid.
Sourcepub async fn attach(&self) -> VeilidAPIResult<()>
pub async fn attach(&self) -> VeilidAPIResult<()>
Connect to the network.
Sourcepub async fn detach(&self) -> VeilidAPIResult<()>
pub async fn detach(&self) -> VeilidAPIResult<()>
Disconnect from the network.
Sourcepub fn routing_context(&self) -> VeilidAPIResult<RoutingContext>
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.
Sourcepub fn get_dht_record_key(
&self,
schema: DHTSchema,
owner_key: PublicKey,
encryption_key: Option<SharedSecret>,
) -> VeilidAPIResult<RecordKey>
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
Sourcepub fn generate_member_id(
&self,
writer_key: &PublicKey,
) -> VeilidAPIResult<MemberId>
pub fn generate_member_id( &self, writer_key: &PublicKey, ) -> VeilidAPIResult<MemberId>
Create a new MemberId for use with in creating DHTSchemas.
Sourcepub async fn transact_dht_records(
&self,
record_keys: Vec<RecordKey>,
options: Option<TransactDHTRecordsOptions>,
) -> VeilidAPIResult<DHTTransaction>
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
Sourcepub async fn new_private_route(&self) -> VeilidAPIResult<RouteBlob>
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.
Sourcepub async fn new_custom_private_route(
&self,
crypto_kinds: &[CryptoKind],
stability: Stability,
sequencing: Sequencing,
) -> VeilidAPIResult<RouteBlob>
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.
Sourcepub fn import_remote_private_route(
&self,
blob: Vec<u8>,
) -> VeilidAPIResult<RouteId>
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.
Sourcepub fn release_private_route(&self, route_id: RouteId) -> VeilidAPIResult<()>
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.
Sourcepub async fn app_call_reply(
&self,
call_id: OperationId,
message: Vec<u8>,
) -> VeilidAPIResult<()>
pub async fn app_call_reply( &self, call_id: OperationId, message: Vec<u8>, ) -> VeilidAPIResult<()>
Respond to an AppCall received over a VeilidUpdate::AppCall.
call_id- specifies which call to reply to, and it comes from a VeilidUpdate::AppCall, specifically the VeilidAppCall::id() value.message- is an answer blob to be returned by the remote node’s RoutingContext::app_call() function, and may be up to 32768 bytes.
Source§impl VeilidAPI
impl VeilidAPI
Sourcepub fn debug_help(&self, _args: String) -> VeilidAPIResult<String>
pub fn debug_help(&self, _args: String) -> VeilidAPIResult<String>
Get the help text for ‘internal debug’ commands.
Sourcepub async fn debug_uptime(&self, _args: String) -> VeilidAPIResult<String>
pub async fn debug_uptime(&self, _args: String) -> VeilidAPIResult<String>
Get node uptime info.
Sourcepub async fn debug_die(&self, args: String) -> VeilidAPIResult<String>
pub async fn debug_die(&self, args: String) -> VeilidAPIResult<String>
Cause veilid-core to panic via various means
Sourcepub async fn debug(&self, args: String) -> VeilidAPIResult<String>
pub async fn debug(&self, args: String) -> VeilidAPIResult<String>
Execute an ‘internal debug command’.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VeilidAPI
impl !RefUnwindSafe for VeilidAPI
impl Send for VeilidAPI
impl Sync for VeilidAPI
impl Unpin for VeilidAPI
impl !UnwindSafe for VeilidAPI
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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