bakbon 0.1.2

BakBon is an infrastructure microkernel library in Rust that provides generic building blocks (Router, Registry, Balancer, Queue, Gateway, Cache, Middleware, Service/Processor) for message‑driven distributed systems.
Documentation
  • Coverage
  • 33.96%
    18 out of 53 items documented6 out of 6 items with examples
  • Size
  • Source code size: 103.62 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 13.7 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 16s 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.