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
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<VeilidConfig>
pub fn config(&self) -> VeilidAPIResult<VeilidConfig>
Access the configuration that Veilid was initialized with
sourcepub fn crypto(&self) -> VeilidAPIResult<Crypto>
pub fn crypto(&self) -> VeilidAPIResult<Crypto>
Get the cryptosystem manager
sourcepub fn table_store(&self) -> VeilidAPIResult<TableStore>
pub fn table_store(&self) -> VeilidAPIResult<TableStore>
Get the TableStore manager
sourcepub fn protected_store(&self) -> VeilidAPIResult<ProtectedStore>
pub fn protected_store(&self) -> VeilidAPIResult<ProtectedStore>
Get the ProtectedStore manager
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 parse_as_target<S: ToString>(&self, s: S) -> VeilidAPIResult<Target>
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
)
sourcepub async fn new_private_route(&self) -> VeilidAPIResult<(RouteId, Vec<u8>)>
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.
sourcepub async fn new_custom_private_route(
&self,
crypto_kinds: &[CryptoKind],
stability: Stability,
sequencing: Sequencing
) -> VeilidAPIResult<(RouteId, Vec<u8>)>
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.
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 async fn debug_help(&self, _args: String) -> VeilidAPIResult<String>
pub async fn debug_help(&self, _args: String) -> VeilidAPIResult<String>
Get the help text for ‘internal debug’ commands
sourcepub async fn debug(&self, args: String) -> VeilidAPIResult<String>
pub async fn debug(&self, args: String) -> VeilidAPIResult<String>
Execute an ‘internal debug command’