fuel-streams-core 0.0.23

Core components for working with streams of Fuel blockchain data
docs.rs failed to build fuel-streams-core-0.0.23
Please check the build logs for more information.
See Builds for ideas on how to fix a failed build, or Metadata for how to configure docs.rs builds.
If you believe this is docs.rs' fault, open an issue.
Visit the last successful build: fuel-streams-core-0.0.13

📝 About The Project

Fuel Streams Core is a library for building data streaming applications on the Fuel blockchain. It provides tools for efficient handling of real-time blockchain data, using NATS for scalable streaming and offering support for Fuel-specific data types.

[!NOTE] This crate is specifically modeled for the Fuel Data Systems project, and is not intended for general use outside of the project.

🛠️ Installing

Add this dependency to your Cargo.toml:

[dependencies]
fuel-streams-core = "*"

🚀 Usage

Here's a simple example to get you started with Fuel Streams Core:

use fuel_streams_core::prelude::*;
use fuel_streams_store::db::*;
use fuel_message_broker::*;
use futures::StreamExt;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
    // Connect to NATS server
    let db = Db::new(DbConnectionOpts::default()).await?;
    let broker = NatsMessageBroker::setup("nats://localhost:4222", None).await?;

    // Create or get existing stream for blocks
    let stream = Stream::<Block>::get_or_init(&broker, &db.arc()).await;

    // Subscribe to the stream
    let subject = BlocksSubject::new(); // blocks.*.*
    let mut subscription = stream.subscribe(subject, DeliverPolicy::New).await;

    // Process incoming blocks
    while let Some(block) = subscription.next().await {
        dbg!(block?);
    }

    Ok(())
}

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

For more information on contributing, please see the CONTRIBUTING.md file in the root of the repository.

📜 License

This repo is licensed under the Apache-2.0 license. See LICENSE for more information.