Skip to main content

Crate runar_node

Crate runar_node 

Source
Expand description

§Runar Node

A high-performance, distributed service mesh framework for building privacy-preserving applications.

§Overview

The Runar Node provides a complete runtime environment for services to communicate, discover each other, and handle requests in a distributed, encrypted manner. It’s designed to be lightweight, performant, and easy to integrate into existing applications.

§Key Features

  • Service Registry: Automatic service discovery and registration
  • Request/Response: Type-safe service-to-service communication
  • Event Publishing: Publish/subscribe pattern for loose coupling
  • Network Transport: QUIC-based networking with automatic peer discovery
  • Load Balancing: Built-in load balancing for distributed services
  • Encryption: End-to-end encryption with selective field access
  • Lifecycle Management: Automatic service lifecycle management

§Quick Start

use runar_node::{Node, NodeConfig};
use runar_node::AbstractService;

// Example of how to create and start a node (conceptual)
async fn example_usage() -> anyhow::Result<()> {
    // Note: This example shows the concept but would need proper
    // key manager state to actually create a Node instance.
     
    // Create a node configuration
    // let config = NodeConfig::new("my-node", "my-network");
    //
    // Create and start the node
    // let mut node = Node::new(config).await?;
    // node.start().await?;
    //
    // Your services can now communicate!
     
    Ok(())
}

§Architecture

The Runar Node is built around several core concepts:

  • Node: The main runtime that manages services and networking
  • Services: Business logic components that handle requests and publish events
  • Topics: Hierarchical addressing system for routing messages
  • Network: Peer-to-peer communication layer with automatic discovery
  • Registry: Service discovery and metadata management

§Modules

  • config - Configuration management for nodes and services
  • network - Network transport, discovery, and peer management
  • node - Core node implementation and lifecycle management
  • routing - Topic-based routing and path resolution
  • services - Service abstraction and registry management

§Examples

See the examples/ directory for complete working examples of:

  • Basic service implementation
  • Request/response patterns
  • Event publishing and subscription
  • Network configuration
  • Service lifecycle management

§License

This project is licensed under the MIT License - see the LICENSE file for details.

Re-exports§

pub use node::Node;
pub use node::NodeConfig;
pub use services::abstract_service::AbstractService;
pub use services::abstract_service::ServiceState;
pub use services::service_registry::ServiceRegistry;
pub use services::ActionHandler;
pub use services::EventContext;
pub use services::LifecycleContext;
pub use services::NodeDelegate;
pub use services::PublishOptions;
pub use services::RegistryDelegate;
pub use services::RequestContext;
pub use services::ServiceRequest;
pub use routing::TopicPath;
pub use network::DiscoveryOptions;
pub use network::NetworkMessage;
pub use network::NetworkMessageType;
pub use network::NetworkTransport;
pub use network::NodeDiscovery;
pub use network::NodeInfo;
pub use network::TransportOptions;

Modules§

config
network
node
routing
services

Structs§

ActionMetadata
ServiceMetadata

Constants§

NAME
VERSION