bakbon 0.1.0

High-performance infrastructure microkernel for building protocol-agnostic distributed systems in Rust.
Documentation
  • Coverage
  • 33.96%
    18 out of 53 items documented6 out of 6 items with examples
  • Size
  • Source code size: 103.37 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 13.8 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 16s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Xnil0/backlab
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Xnil0

Table of Contents

Overview

BakBon is an lightweight infrastructure microkernel library in Rust created to help configure, compose and build any type of message-driven distributed system whether it is microservices, blockchain insfrastructure IoT networks, by providing generic building blocks such as routers, gateways, balancers, queues, caching systems.

Features

  • Protocol-Agnostic: works with TCP, UDP, HTTP(s), gRPC, MQTT, Serial, InProc or custom protocols.
  • Composable: mix and match different components (Router, Queue, Gateway, Balancer, Cache, etc).
  • Type-Safe: strong typing with runtime flexibility.
  • Production-Ready: Comprehensive tests, clean architecture.

Installation

cargo add bakbon

File System

📂 bakbon
    │
    ├── 📂 src
    │       │
    │       ├── 📂 balancer
    │       │       │
    │       │       ├── 📄 mod.rs
    │       │       └── 📄 strategy.rs
    │       │
    │       ├── 📂 cache.rs
    │       │       │
    │       │       ├── 📄 builder.rs
    │       │       ├── 📄 eviction.rs
    │       │       └── 📄 mod.rs
    │       │
    │       ├── 📂 core
    │       │       │
    │       │       ├── 📄 address.rs
    │       │       ├── 📄 error.rs
    │       │       ├── 📄 mod.rs
    │       │       └── 📄 protocol.rs
    │       │
    │       ├── 📂 infra
    │       │       │
    │       │       ├── 📄 gateway.rs
    │       │       ├── 📄 middleware.rs
    │       │       ├── 📄 mod.rs
    │       │       ├── 📄 processor.rs
    │       │       ├── 📄 service.rs
    │       │       └── 📄 storage.rs
    │       │
    │       ├── 📂 message
    │       │       │
    │       │       ├── 📄 envelope.rs
    │       │       ├── 📄 mod.rs
    │       │       └── 📄 route.rs
    │       │
    │       ├── 📂 queue
    │       │       │
    │       │       ├── 📂 attributes
    │       │       │       │
    │       │       │       ├── 📄 delivery.rs
    │       │       │       ├── 📄 durability.rs
    │       │       │       ├── 📄 mod.rs
    │       │       │       ├── 📄 ordering.rs
    │       │       │       └── 📄 provider.rs
    │       │       │
    │       │       ├── 📄 builder.rs
    │       │       └── 📄 mod.rs
    │       │
    │       ├── 📂 registry
    │       │       │
    │       │       ├── 📄 builder.rs
    │       │       └── 📄 mod.rs
    │       │
    │       ├── 📂 router
    │       │       │ 
    │       │       ├── 📄 builder.rs
    │       │       └── 📄 mod.rs
    │       │
    │       └── 📄 lib.rs
    │
    ├── 📂 tests
    │       │
    │       ├── 📂 common
    │       │       │
    │       │       ├── 📂 services
    │       │       │       │
    │       │       │       ├── 📄 echo.rs
    │       │       │       └── 📄 mod.rs
    │       │       │
    │       │       ├── 📄 gateway.rs
    │       │       └── 📄 mod.rs
    │       │
    │       ├── 📄 integration_gateway.rs
    │       ├── 📄 integration_queue.rs
    │       └── 📄 integration_router.rs
    │
    ├── ⚙️ Cargo.toml
    ├── 🔑 LICENSE
    └── 📖 README.md

    14 directories, 40 files

Modules

BakBon provides:

  • Balancer: Balancer.
  • Cache: Cache.
  • Core: Address, Protocol, Error, Result.
  • Infra: Gateway, Middleware, Processor, Service and Storage traits.
  • Message: Envelope, Route, Reply, Headers, Payload.
  • Queue: Queue.
  • Registry: Registry.
  • Router: Router.

Usage

use bakbon::*;

let url = "http://services.com/echo";

// Create an address from url
let address: Result<Address> = Address::parse(url);
assert!(address.is_ok());

// Create a service with the address
let service = EchoService::new(address.unwrap());

// Register the service while building a registry
let registry = Registry::builder()
    .register(service)
    .build();

// Build a router
let mut router = Router::builder()
    .registry(registry)
    .build();

// Create a message.
let message = Envelope::new(client_addr, srv_addr, payload);

// Route the message to the appropriate service
let reply: Result<Reply> = router.route(message);
assert!(reply.is_ok());

Attribution

If you use this project in your application, service, or research, please include the following credit:

Based on Bakbon by Xn!l0 (https://github.com/Xnil0/backlab), licensed under the MIT License.