Module edge

Module edge 

Source
Expand description

§Edge Computing for Authorization

Lightweight authorization engine designed for edge deployment. Enables low-latency authorization checks at the edge by maintaining a synchronized subset of authorization data.

§Features

  • Lightweight Engine: In-memory engine optimized for edge workers
  • Tuple Synchronization: Automatic sync from central database
  • CRDT Conflict Resolution: Handles concurrent updates across edge nodes
  • Selective Sync: Only sync relevant namespaces/tenants

§Example

use oxify_authz::edge::{EdgeEngine, EdgeConfig, SyncConfig};

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let config = EdgeConfig {
        central_db_url: "postgres://central-db/authz".to_string(),
        sync_interval_secs: 30,
        sync_config: SyncConfig::Namespaces(vec!["document".to_string()]),
    };

    let engine = EdgeEngine::new(config).await?;
    engine.start_sync().await?;

    // Perform fast authorization checks at the edge
    let allowed = engine.check("document", "123", "viewer", "user:alice").await?;

    Ok(())
}

Structs§

CrdtResolver
CRDT-based conflict resolver using Last-Write-Wins (LWW) strategy
CrdtTuple
A tuple with CRDT metadata for conflict resolution
EdgeConfig
Configuration for edge engine
EdgeEngine
Lightweight authorization engine for edge deployment
EdgeStats
Statistics for edge engine

Enums§

SyncConfig
Defines what data to sync from central database