Crate synap_sdk

Crate synap_sdk 

Source
Expand description

§Synap Rust SDK

Official Rust client for Synap - High-Performance In-Memory Key-Value Store & Message Broker

§Features

  • 💾 Key-Value Store: Fast in-memory KV operations with TTL support
  • 📨 Message Queues: RabbitMQ-style queues with ACK/NACK
  • 📡 Event Streams: Kafka-style event streams with offset tracking
  • 🔔 Pub/Sub: Topic-based publish/subscribe with wildcards
  • 🔄 Async/Await: Built on Tokio for high-performance async I/O
  • 🛡️ Type-Safe: Leverages Rust’s type system for correctness

§Quick Start

use synap_sdk::{SynapClient, SynapConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    // Create client
    let config = SynapConfig::new("http://localhost:15500");
    let client = SynapClient::new(config)?;

    // Key-Value operations
    client.kv().set("user:1", "John Doe", None).await?;
    let value: Option<String> = client.kv().get("user:1").await?;
    println!("Value: {:?}", value);

    Ok(())
}

Re-exports§

pub use client::SynapClient;
pub use client::SynapConfig;
pub use error::Result;
pub use error::SynapError;
pub use kv::KVStore;
pub use pubsub::PubSubManager;
pub use queue::QueueManager;
pub use reactive::MessageStream;
pub use reactive::SubscriptionHandle;
pub use stream::StreamManager;

Modules§

client
Synap client implementation
error
Error types for Synap SDK
kv
Key-Value Store operations
pubsub
Pub/Sub operations
queue
Queue operations
reactive
Reactive streaming primitives
rx
RxJS-style reactive programming for Rust
stream
Event Stream operations
types
Common types for Synap SDK