Thanks to visit codestin.com
Credit goes to github.com

Skip to content

This project focuses on objectifying IoT devices in the cloud and streamline IoT application development across edge-cloud continuum

Notifications You must be signed in to change notification settings

hpcclab/OaaS-IoT

Repository files navigation

OaaS-RS: Object-as-a-Service in Rust

Introduction

A Rust reimplementation of Oparaca β€” an Object-as-a-Service platform with separate control and data planes. Control plane manages class/function deployments via Kubernetes; data plane handles invocations, routing, and stateful object storage.

Quick Start

Prerequisites

Build

# Build all binaries
cargo build -r

# Build container images
docker compose -f docker-compose.build.yml build

# Or use just recipes
just build release

Architecture

Planes

  • Control Plane: Package Manager (PM) + Class Runtime Manager (CRM). PM exposes REST API for package/deployment CRUD; talks to CRM(s) via gRPC. CRM is a Kubernetes controller managing ClassRuntime CRDs and applying function + ODGM resources.

  • Data Plane: Gateway (REST/gRPC ingress), Router (Zenoh messaging), ODGM (stateful object grid), and function runtimes (user code).

graph TB
    subgraph CP["Control Plane"]
        PM["πŸ“¦ PM<br/>Package Manager<br/>REST API"]
        CRM["βš™οΈ CRM<br/>Class Runtime Manager<br/>K8s Controller"]
    end

    subgraph DP["Data Plane"]
        GW["πŸšͺ Gateway<br/>REST/gRPC Ingress"]
        RT["πŸ”€ Router<br/>Zenoh Messaging"]
        ODGM["πŸ—„οΈ ODGM<br/>Object Data Grid"]
        FN["πŸ”§ Function<br/>Runtimes"]
    end

    subgraph K8S["Kubernetes"]
        CRD["ClassRuntime CRD"]
        RES["Deployments<br/>Services"]
    end

    Client["πŸ‘€ Client"] -->|REST| PM
    Client -->|REST/gRPC| GW
    PM -->|gRPC| CRM
    CRM <-->|Server-Side Apply| K8S
    GW --> RT
    RT -->|Zenoh| ODGM
    RT -->|Zenoh| FN
    FN -.->|Discover| ODGM

    classDef cp fill:#e3f2fd,stroke:#1976d2,stroke-width:2px
    classDef dp fill:#e8f5e9,stroke:#388e3c,stroke-width:2px
    classDef k8s fill:#fff3e0,stroke:#f57c00,stroke-width:2px

    class PM,CRM cp
    class GW,RT,ODGM,FN dp
    class CRD,RES k8s
Loading

Key Components

Component Location Role

PM

control-plane/oprc-pm

Package registry, multi-cluster orchestration

CRM

control-plane/oprc-crm

Kubernetes controller, ClassRuntime CRD, NFR enforcement

ODGM

data-plane/oprc-odgm

Object Data Grid with Raft consensus, separate deployment per class

Gateway

data-plane/oprc-gateway

Stateless ingress, REST/gRPC β†’ Zenoh translation

Router

data-plane/oprc-router

Zenoh-based pub/sub and RPC routing

Commons

commons/*

Shared libs: models, gRPC protos, Zenoh config, storage abstractions

String Object IDs & String Entry Keys (Preview β†’ GA)

String-based object identifiers and string entry keys provide human-readable addressing and richer per-entry semantics alongside existing numeric IDs.

Key points:

  • Enablement: GA and always on. No env flags required. Configure max length via ODGM_MAX_STRING_ID_LEN (default 160).

  • Normalization: Server lowercases all provided object_id_str; allowed charset: [a-z0-9._:-]; max length configurable via ODGM_MAX_STRING_ID_LEN (default 160).

  • Semantics:

    • Numeric Set = upsert (create or replace)

    • String Set = create-only (duplicate returns AlreadyExists)

    • Merge preserves existing entries and adds/updates provided ones

  • Entries:

    • Numeric entry keys remain u32 β†’ ValData

    • String entry keys stored in parallel map (entries_str) with identical value type

  • Events / Triggers: String keys participate in create / update / delete trigger fanout just like numeric keys.

  • Capabilities: Query via oprc-cli capabilities for runtime-advertised support.

  • CLI Usage Examples:

    • Create string-id object: oprc-cli object setstr --cls-id users 0 --object-id-str user-42 -s name=alice -s role=admin

    • Get single string field: oprc-cli object getstr --cls-id users 0 --object-id-str user-42 --key-str name

    • Numeric coexistence: Both numeric and string objects may exist in same collection and partition.

  • Rollback: Disable flags; existing string objects remain addressable internally but new creates will return UNIMPLEMENTED.

Metrics:

  • odgm_object_set_total{variant} and odgm_get_total{variant} differentiate numeric vs string

  • odgm_entry_mutations_total{key_variant} increments by key type (numeric|string)

  • Gateway attempts / rejections counters: gateway_string_id_attempt_total, gateway_string_id_rejected_total

Planned:

  • Adoption tracking and default flip to string IDs once usage threshold reached.

Communication

  • External: REST (PM, Gateway) and gRPC (PM ↔ CRM, Gateway)

  • Internal: Zenoh pub/sub + oprc-zrpc (data plane)

  • Kubernetes: kube-rs with server-side apply (CRM)

Typical Flow

  1. Deploy: Client β†’ PM (REST) β†’ CRM (gRPC) β†’ upsert ClassRuntime CRD β†’ reconcile β†’ apply function + ODGM resources

  2. Invoke: Client β†’ Gateway (REST/gRPC) β†’ Router (Zenoh) β†’ Function runtime or ODGM

  3. Status: Client β†’ PM β†’ CRM β†’ read ClassRuntime conditions

  4. Delete: Client β†’ PM β†’ CRM β†’ mark CRD for deletion β†’ cleanup resources

Development

Test

# All tests
cargo test --workspace

# Control plane tests
just -f control-plane/justfile all-it

# Specific service
cargo test -p oprc-crm
cargo test -p oprc-pm
cargo test -p oprc-odgm

Deploy to Kubernetes

# Deploy all components
./k8s/charts/deploy.sh deploy

# Or with just
just deploy

# Undeploy
just undeploy

Configuration

Services use env-first config via envconfig. Common patterns:

  • Logging: RUST_LOG=debug,openraft=info,zenoh=info

  • Zenoh: OPRC_ZENOH_PEERS, OPRC_ZENOH_PORT, OPRC_ZENOH_MODE

  • CRM: HTTP_PORT, GRPC_PORT, OPRC_CRM_FEATURES_*

  • PM: SERVER_PORT, CRM_DEFAULT_URL, CRM_CLUSTERS_JSON

  • ODGM: ODGM_HTTP_PORT, ODGM_NODE_ID, ODGM_COLLECTION

See component READMEs for details.

Project Structure

commons/              # Shared libraries
β”œβ”€β”€ oprc-grpc/       # Protobuf definitions & clients
β”œβ”€β”€ oprc-models/     # Domain models
β”œβ”€β”€ oprc-zenoh/      # Zenoh config helpers
β”œβ”€β”€ oprc-dp-storage/ # Data plane storage (memory, redb, fjall, rocksdb)
└── oprc-cp-storage/ # Control plane storage (memory, etcd)

control-plane/
β”œβ”€β”€ oprc-pm/         # Package Manager (REST API)
└── oprc-crm/        # Class Runtime Manager (K8s controller)

data-plane/
β”œβ”€β”€ oprc-gateway/    # REST/gRPC ingress
β”œβ”€β”€ oprc-router/     # Zenoh routing
β”œβ”€β”€ oprc-odgm/       # Object Data Grid Manager
└── oprc-dev/        # Development utilities

tools/
└── oprc-cli/        # CLI tool for OaaS operations

About

This project focuses on objectifying IoT devices in the cloud and streamline IoT application development across edge-cloud continuum

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors 4

  •  
  •  
  •  
  •  

Languages