Skip to main content

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?;
    tracing::info!("Value: {:?}", value);

    Ok(())
}

Re-exports§

pub use bitmap::BitmapManager;
pub use bitmap::BitmapOperation;
pub use bitmap::BitmapStats;
pub use client::SynapClient;
pub use client::SynapConfig;
pub use error::Result;
pub use error::SynapError;
pub use geospatial::Coordinate;
pub use geospatial::DistanceUnit;
pub use geospatial::GeoradiusResult;
pub use geospatial::GeospatialManager;
pub use geospatial::GeospatialStats;
pub use geospatial::Location;
pub use hash::HashManager;
pub use hyperloglog::HyperLogLogManager;
pub use kv::KVStore;
pub use list::ListManager;
pub use pubsub::PubSubManager;
pub use queue::QueueManager;
pub use reactive::MessageStream;
pub use reactive::SubscriptionHandle;
pub use scripting::ScriptEvalOptions;
pub use scripting::ScriptEvalResponse;
pub use scripting::ScriptExistsResponse;
pub use scripting::ScriptFlushResponse;
pub use scripting::ScriptKillResponse;
pub use scripting::ScriptManager;
pub use set::SetManager;
pub use sorted_set::ScoredMember;
pub use sorted_set::SortedSetManager;
pub use sorted_set::SortedSetStats;
pub use stream::StreamManager;
pub use transactions::TransactionCommandClient;
pub use transactions::TransactionExecResult;
pub use transactions::TransactionManager;
pub use transactions::TransactionOptions;
pub use transactions::TransactionResponse;
pub use transport::TransportMode;
pub use types::HyperLogLogStats;

Modules§

bitmap
Bitmap operations (SETBIT/GETBIT/BITCOUNT/BITPOS/BITOP)
client
Synap client implementation
error
Error types for Synap SDK
geospatial
Geospatial operations (GEOADD/GEODIST/GEORADIUS/GEOPOS/GEOHASH)
hash
Hash data structure operations
hyperloglog
HyperLogLog operations (PFADD/PFCOUNT/PFMERGE)
kv
Key-Value Store operations
list
List data structure operations
pubsub
Pub/Sub operations
queue
Queue operations
reactive
Reactive streaming primitives
rx
RxJS-style reactive programming for Rust
scripting
Lua scripting support
set
Set data structure operations
sorted_set
Sorted Set data structure operations
stream
Event Stream operations
transactions
Redis-compatible transaction support (MULTI/EXEC/WATCH/DISCARD)
transport
Binary TCP transports for the Synap SDK.
types
Common types for Synap SDK