Skip to main content

orleans_rust_client/
lib.rs

1//! Rust client bindings for Microsoft Orleans services via an official .NET
2//! gRPC bridge.
3//!
4//! This crate provides an ergonomic, async Rust API for calling Orleans grains
5//! **without** reimplementing Orleans' internal gateway protocol or
6//! serialization runtime. A small .NET bridge (see the `dotnet/` directory in
7//! the repository) hosts the official Orleans [`IClusterClient`] and exposes a
8//! generic gRPC surface that this crate talks to.
9//!
10//! ```no_run
11//! use orleans_rust_client::{GrainKey, OrleansClient};
12//!
13//! # async fn run() -> Result<(), orleans_rust_client::OrleansError> {
14//! let client = OrleansClient::connect("http://127.0.0.1:50051").await?;
15//!
16//! let counter = client.grain(
17//!     "Counter.Abstractions.ICounterGrain",
18//!     "counter",
19//!     GrainKey::String("demo".into()),
20//! );
21//!
22//! let value: i64 = counter.invoke_json("Get", &()).await?;
23//! println!("value = {value}");
24//! # Ok(())
25//! # }
26//! ```
27//!
28//! [`IClusterClient`]: https://learn.microsoft.com/dotnet/orleans/
29
30#![forbid(unsafe_code)]
31#![warn(missing_docs)]
32
33mod client;
34mod config;
35mod error;
36mod generated;
37mod grain;
38mod key;
39mod request_context;
40mod retry;
41
42pub use client::{OrleansClient, OrleansClientBuilder, RawResponse};
43pub use config::{ClientConfig, DEFAULT_TIMEOUT, TlsConfig};
44pub use error::{OrleansError, codes};
45pub use grain::GrainRef;
46pub use key::GrainKey;
47pub use request_context::RequestContext;
48pub use retry::RetryPolicy;
49
50/// Generated protobuf message types for the bridge protocol
51/// (`orleans.bridge.v1`).
52pub mod pb {
53    pub use crate::generated::pb::*;
54}