Skip to main content

Crate volt_client_grpc

Crate volt_client_grpc 

Source
Expand description

§Volt Client gRPC

A Rust client library for connecting to TDX Volt servers via gRPC.

This library provides functionality for:

  • Authenticating with Volt servers
  • Managing connections with automatic reconnection
  • Making unary and streaming gRPC calls
  • Resource management operations
  • File operations
  • Database operations
  • Wire/pub-sub operations

§Example

use volt_client_grpc::{VoltClient, VoltConfig, InitialiseOptions, config::ConfigSource};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create configuration from a Volt DID
    let config = ConfigSource::from_did("did:tdx:example-volt")?;
     
    // Create and initialize client
    let mut client = VoltClient::new()?;
    client.initialise(config, InitialiseOptions::default()).await?;
     
    // Connect to the Volt
    client.connect(None).await?;
     
    // Make API calls...
     
    // Disconnect when done
    client.disconnect();
     
    Ok(())
}

Re-exports§

pub use config::InitialiseOptions;
pub use config::VoltClientConfig;
pub use config::VoltConfig;
pub use credential::VoltCredential;
pub use error::Result;
pub use error::VoltError;
pub use sync_helpers::any_to_json;
pub use sync_helpers::ensure_sync_database;
pub use sync_helpers::map_to_json;
pub use sync_helpers::map_to_json_string;
pub use sync_helpers::out_to_json;
pub use sync_helpers::SyncManager;
pub use sync_helpers::SyncManagerEvent;
pub use sync_provider::ProviderState;
pub use sync_provider::SyncEvent;
pub use sync_provider::SyncProvider;
pub use volt_client::ConfigSource;
pub use volt_client::SyncDocumentStream;
pub use volt_client::VoltClient;
pub use volt_connection::VoltConnection;
pub use constants::*;

Modules§

config
Configuration types for the Volt client.
constants
Constants used throughout the Volt client library.
credential
Volt credential management.
crypto
Cryptographic utilities for the Volt client.
error
Error types for the Volt client library.
grpc_call
gRPC call wrapper for handling Volt API calls.
grpc_utils
gRPC utility functions for creating clients and servers.
proto
Protobuf definitions and utilities.
relay
Relay protocol implementation for Volt client.
sync_helpers
Sync Helper Utilities
sync_provider
Sync Provider for collaborative document editing with Y.js/yrs CRDT
utils
Utility functions for the Volt client.
volt_client
Volt gRPC client.
volt_connection
Volt connection management.

Structs§

ArrayRef
A collection used to store data in an indexed sequence structure. This type is internally implemented as a double linked list, which may squash values inserted directly one after another into single list node upon transaction commit.
Doc
A Yrs document type. Documents are the most important units of collaborative resources management. All shared collections live within a scope of their corresponding documents. All updates are generated on per-document basis (rather than individual shared type). All operations on shared collections happen via Transaction, which lifetime is also bound to a document.
MapRef
Collection used to store key-value entries in an unordered manner. Keys are always represented as UTF-8 strings. Values can be any value type supported by Yrs: JSON-like primitives as well as shared data types.
Options
Configuration options of Doc instance.
TextRef
A shared data type used for collaborative text editing. It enables multiple users to add and remove chunks of text in efficient manner. This type is internally represented as a mutable double-linked list of text chunks - an optimization occurs during [Transaction::commit], which allows to squash multiple consecutively inserted characters together as a single chunk of text even between transaction boundaries in order to preserve more efficient memory model.
Transaction
A very lightweight read-only transaction. These transactions are guaranteed to not modify the contents of an underlying Doc and can be used to read it or for serialization purposes. For this reason it’s allowed to have a multiple active read-only transactions, but it’s not allowed to have any active read-write transactions at the same time.
TransactionMut
Read-write transaction. It can be used to modify an underlying state of the corresponding Doc. Read-write transactions require an exclusive access to document store - only one such transaction can be present per Doc at the same time (read-only Transactions are not allowed to coexists at the same time as well).

Traits§

Array
DeepObservable
Trait implemented by all Y-types, allowing for observing events which are emitted by nested types.
Map
Observable
ReadTxn
Trait defining read capabilities present in a transaction. Implemented by both lightweight read-only and read-write transactions.
Text
Transact
Trait implemented by Doc and shared types, used for carrying over the responsibilities of creating new transactions, used as a unit of work in Yrs.

Functions§

generate_id
Generate a unique ID (UUID v4)

Type Aliases§

YrsUuid