Skip to main content

Crate tightbeam

Crate tightbeam 

Source
Expand description
    ╔════════════════════════════════════════════════════════════════╗
    ║                        T I G H T B E A M                       ║
    ║             Efficient Exchange-Compute Interconnect            ║
    ╚════════════════════════════════════════════════════════════════╝

                             ┌─────────────┐
                             │   CLUSTER   │
                             │  Controller │
                             └──────┬──────┘
                                    │
                    ┌───────────────┼───────────────┐
                    │               │               │
              ┌─────▼─────┐    ┌────▼────┐    ┌─────▼─────┐
              │   HIVE    │    │  DRONE  │    │   HIVE    │
              │ Orchestr. │    │ Morpher │    │ Orchestr. │
              └─────┬─────┘    └────┬────┘    └────┬──────┘
                    │               │              │
         ┌──────────┼──────────┐    │    ┌─────────┼──────────┐
         │          │          │    │    │         │          │
    ┌────▼───┐  ┌───▼────┐ ┌───▼────▼────▼───┐ ┌───▼────┐ ┌───▼────┐
    │Servlet │  │Servlet │ │     Active      │ │Servlet │ │Servlet │
    │  :8001 │  │  :8002 │ │     Servlet     │ │  :8003 │ │  :8004 │
    └────┬───┘  └────┬───┘ └────────┬────────┘ └───┬────┘ └───┬────┘
         │           │              │              │          │
   ┌─────┴─────┬─────┴─────┬─────┬──┴──┬─────┬─────┴─────┬────┴┬─────┐
   │     │     │     │     │     │     │     │     │     │     │     │
 ┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐┌─▼──┐
 │Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr││Wrkr│
 └────┘└────┘└────┘└────┘└────┘└────┘└────┘└────┘└────┘└────┘└────┘└────┘
┌──┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌─┐┌──┐
│Wr││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││W││Wr│
└──┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└─┘└──┘

╔════════════════════════════════════════════════════════════════════════╗
║   Protocol-Agnostic • Zero-Copy • Zero-Panic • ASN.1 DER • RustCrypto  ║
╚════════════════════════════════════════════════════════════════════════╝

        ┌──────────────────────────────────────────────────────┐
        │  🔐 Security Model: Sign-Then-Encrypt                │
        │  ├─ Hash:    Integrity verification on plaintext     │
        │  ├─ Sign:    Non-repudiation & authentication        │
        │  └─ Encrypt: Confidentiality of transmitted data     │
        └──────────────────────────────────────────────────────┘

        ┌──────────────────────────────────────────────────────┐
        │  📦 Protocol Versions                                │
        │  ├─ V0: Core metadata (id, order, message)           │
        │  ├─ V1: + integrity, confidentiality, signature      │
        │  ├─ V2: + priority, TTL, previous_frame chaining     │
        │  └─ V3: + matrix control                             │
        └──────────────────────────────────────────────────────┘

        ┌──────────────────────────────────────────────────────┐
        │  🕸️  Efficient Exchange-Compute Interconnect (EECI)  |
        │  ├─ Hives:    Multi-servlet orchestrators            │
        │  ├─ Drones:   Single-servlet morphers                │
        │  ├─ Servlets: Self-contained message processors      │
        │  └─ Cluster:  Centralized control & routing          │
        └──────────────────────────────────────────────────────┘

        ┌──────────────────────────────────────────────────────┐
        │  ⚡ Features                                          │
        │  ├─ Protocol-agnostic transport layer                │
        │  ├─ Dynamic port allocation (OS-managed)             │
        │  ├─ Policy-driven message gates                      │
        │  ├─ Lifecycle management (start/stop/join)           │
        │  └─ Service discovery & health monitoring            │
        └──────────────────────────────────────────────────────┘

   ┌────────────────────────────────────────────────────────────────┐
   │  Quick Start Example                                           │
   ├────────────────────────────────────────────────────────────────┤
   │  use tightbeam::{Message, Beamable, compose};                  │
   │  use tightbeam::der::Sequence;                                 │
   │                                                                │
   │  #[derive(Beamable, Clone, Debug, Sequence)]                   │
   │  struct MyMessage { value: u64 }                               │
   │                                                                │
   │  let frame = compose! {                                        │
   │      V0: id: "msg-001", order: 1, message: MyMessage { .. }    │
   │  }?;                                                           │
   │                                                                │
   │  let decode: MyMessage = tightbeam::decode(&frame.message)?;   │
   └────────────────────────────────────────────────────────────────┘

§TightBeam Protocol

A lightweight, versioned messaging protocol with cryptographic primitives built on ASN.1 DER encoding.

Re-exports§

pub use utils::decode;
pub use utils::encode;
pub use crate::error::TightBeamError;
pub use rayon;
pub use zeroize;
pub use cms;
pub use der;
pub use paste;
pub use pkcs12;
pub use spki;
pub use x509_cert as x509;
pub use time;
pub use asn1::*;
pub use crate::core::*;

Modules§

asn1
builder
colony
Colony framework for distributed servlet orchestration
compress
constants
core
crypto
error
flags
Flags utilize the Matrix to create Flat World.
helpers
instrumentation
Instrumentation subsystem (feature = “instrument”).
macros
matrix
mpsc
A multi-producer, single-consumer queue for sending values between asynchronous tasks.
oids
ASN.1 Object Identifiers (OIDs) for TightBeam
policy
prelude
Prelude module for convenient imports
random
router
runtime
Async runtime abstraction layer
standards
testing
Testing module orchestrator
trace
Trace collection and logging subsystem
transport
Transport layer for TightBeam protocol
utils
Utility modules and functions

Macros§

__tightbeam_server_protocol_bind_handle
__tightbeam_server_protocol_bind_policies_handle
__tightbeam_server_protocol_channels_handle
__tightbeam_server_protocol_channels_policies_handle
__tightbeam_server_protocol_handle
__tightbeam_server_protocol_policies_assertions_handle
__tightbeam_server_protocol_policies_handle
__tightbeam_servlet_common_methods
Common methods shared by all servlets (addr, stop, join)
absent
at_least
at_most
between
cert
This macro provides a convenient way to construct X.509 certificates with various profiles and configurations.
client
Client macro - creates a configured transport for multiple emit calls
cluster
Macro for creating clusters with pre-configured settings
compose
compress
csr
Create an X.509 Certificate Signing Request using the builder pattern
deadline
Helper macro for deadline timing constraint Usage: deadline!(duration: 100ms, slack: 5ms) (parentheses) deadline! { duration: 100ms, slack: 5ms } (curly braces) deadline!(duration: 100ms) (without slack) Events come from the key in grouped syntax.
decompress
define_oid_wrapper
Macro to define OID wrapper types with AssociatedOid implementation.
emit
Emit macro - one-shot message send
equals
Helper macro to wrap values for equality assertions in specs
exactly
falsy
Helper macro for boolean false assertions in specs Checks that the value is falsy (zero, false, empty)
flags
flagset
guard
Helper macro for timing guard expressions in tb_process_spec!
hex
Converts a sequence of hexadecimal string literals to a byte array at compile time.
hive
Macro for creating hives that orchestrate dynamically registered servlets.
impl_error_display
Macro to implement Display and Error for error enums when derive feature is disabled.
impl_from
Macro to implement From trait for both reference and owned types
impl_tcp_common
Macro to generate common transport implementation for both sync and async.
impl_try_from
Macro to implement TryFrom trait for extracting optional fields
jitter
Helper macro for jitter timing constraint Usage: jitter!(5ms) (default MinMaxJitter calculator) jitter!(5ms, calculator) (custom calculator) Event comes from the key in grouped syntax.
job
mutex
notarize
Macro to sign a document and insert the signature
pem
policy
present
ratio
Helper macro for ratio limits (numerator / denominator)
relay
Relay - A simple MPSC relay for any Beamable type
routes
rwlock
server
servlet
Servlet macro for creating containerized tightbeam applications
sign
Create a SignatureInfo by signing data
tb_assert_spec
tb_compose_spec
Define a CSP Process Composition with declarative syntax.
tb_gen_process_types
Generate States enum and Event wrapper for a CSP process.
tb_process_spec
Define a CSP Process with declarative syntax.
tb_scenario
tb_scenario! macro - MVP implementation
test_builder
Generic builder test macro
test_drone
Async test macro for hives
test_job
test_servlet
Async test macro with worker setup
test_worker
Async test macro with worker setup
truthy
Helper macro for boolean true assertions in specs Checks that the value is truthy (non-zero, true, non-empty)
urn_spec
Define a URN specification with validation and NSS structure
wcet
Helper macro for WCET (Worst-Case Execution Time) timing constraint Usage: wcet!(10ms) (simple case, backward compatible) wcet!(10ms, percentile: P99) (with percentile) wcet!(10ms, analyzer: my_analyzer) (with analyzer) wcet!(10ms, percentile: P99, analyzer: my_analyzer) (with both, order-independent) wcet!(10ms, analyzer: my_analyzer, percentile: P99) (same as above) Event comes from the key in grouped syntax.
worker

Type Aliases§

ZeroizingArray
ZeroizingBytes
Secure bytes type

Derive Macros§

Beamable
Derive macro for implementing Message
Errorizable
Derive macro for implementing error traits with automatic Display and From implementations
Flaggable
Derive macro for implementing flag enum traits