wavesyncdb

Crates.iowavesyncdb
lib.rswavesyncdb
version0.2.0
created_at2025-12-23 15:21:58.09582+00
updated_at2025-12-23 15:21:58.09582+00
descriptionWaveSyncDB is a lightweight, distributed database synchronization engine designed to bridge the gap between real-time data streaming and relational storage. It ensures high-consistency data replication across decentralized nodes with a focus on low-latency updates.
homepage
repositoryhttps://github.com/pvg13/WaveSyncDB
max_upload_size
id2001714
size135,008
Pablo (pvg13)

documentation

README

WaveSyncDB

License: GPL v3

WaveSyncDB is a lightweight, distributed database synchronization engine designed for high-consistency data replication. It bridges the gap between real-time data streaming and relational storage, ensuring that your decentralized nodes stay in perfect harmony with low-latency "wave" updates.


Features

  • Real-Time Synchronization: Propagate data changes across multiple nodes instantly.
  • Conflict Resolution: Built-in logic to handle data collisions in multi-master environments.
  • Strong Consistency: Ensures data integrity across distributed systems using efficient sync protocols.
  • Developer Friendly: Designed to be easily integrated into existing workflows with minimal configuration.

Installation

To get started with WaveSyncDB, clone the repository:

git clone [https://github.com/pvg13/WaveSyncDB.git](https://github.com/pvg13/WaveSyncDB.git)
cd WaveSyncDB

Usage

Check out the examples folder for more complex usage

For a quick start:


pub fn main() {

    let database_url = std::env::var("DATABASE_URL").expect("DATABASE_URL must be set");

    // Create a pool connection
    let manager = ConnectionManager::<SqliteConnection>::new(database_url);
    let pool = Pool::builder()
        .max_size(16)
        .build(manager)?;
    
    // Connection used by the user
    let conn = pool.get().unwrap();

    // Set up the channels
    let (tx, rx) = tokio::sync::mpsc::channel(100);

    // Add a custom topic
    let topic = "topic";

    // Set the instrumentation as the WaveSyncInstrument
    conn.set_instrumentation(WaveSyncInstrument::new(tx, topic, DialectType::SQLite));

    // Start the Wavesync engine to run in the background
    let mut wavesync_engine = wavesyncdb::sync::WaveSyncEngine::new(rx, pool.get()?, "wsexample");

    tokio::spawn(async move {
        wavesync_engine.run().await;
    });

    // Use the diesel connection as usual

    ...

    diesel::insert_into(schema::tasks::table)
                        .values(&new_task)
                        .execute(&mut alice)
                        .expect("Error inserting new task");
}

Commit count: 0

cargo fmt