ternary-lease 0.1.0

Distributed lease management for GPU resources with ternary states. {+1=held, 0=expired, -1=revoked}. Renewal, revocation, deadlock detection.
Documentation
  • Coverage
  • 4.35%
    1 out of 23 items documented0 out of 14 items with examples
  • Size
  • Source code size: 8.85 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 413.44 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 2s Average build duration of successful builds.
  • all releases: 2s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • SuperInstance/ternary-lease
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • SuperInstance

ternary-lease

Distributed lease management for GPU resources with ternary states. {+1=held, 0=expired, -1=revoked}. Renewal, revocation, deadlock detection.

Why This Matters

ternary-lease

Distributed lease management for GPU resources with ternary states.

The Five-Layer Stack

This crate is part of the Oxide Stack — a distributed GPU runtime built on five layers:

┌─────────────────┐
│  cudaclaw        │  Persistent GPU kernels, warp consensus, SmartCRDT
├─────────────────┤
│  cuda-oxide      │  Flux → MIR → Pliron → NVVM → PTX compiler
├─────────────────┤
│  flux-core       │  Bytecode VM + A2A agent protocol
├─────────────────┤
│  pincher         │  "Vector DB as runtime, LLM as compiler"
├─────────────────┤
│  open-parallel   │  Async runtime (tokio fork)
└─────────────────┘

The key insight: ternary values {-1, 0, +1} map directly to GPU compute. They pack 16× denser than FP32, enable XNOR+popcount matmul, and conservation laws become compile-time checks.

Design

Every value in this crate follows ternary algebra (Z₃):

Value Meaning GPU Analog
+1 Positive / Active / Healthy Warp vote yes
0 Neutral / Pending / Balanced Warp vote abstain
-1 Negative / Failed / Overloaded Warp vote no

This isn't arbitrary — ternary is the natural encoding for:

  1. BitNet b1.58 (Microsoft) — ternary LLMs at 60% less power
  2. GPU warp voting — hardware ballot returns ternary consensus
  3. Conservation laws — {-1, 0, +1} preserves quantity

Key Types

pub enum LeaseState
pub struct Lease
pub struct LeaseManager
pub fn new
pub fn acquire
pub fn renew
pub fn revoke
pub fn state
pub fn tick
pub fn find_deadlocks
pub fn held_by
pub fn active_count

Usage

[dependencies]
ternary-lease = "0.1.0"
use ternary_lease::*;
// See src/lib.rs tests for complete working examples

Testing

git clone https://github.com/SuperInstance/ternary-lease.git
cd ternary-lease
cargo test    # 8 tests

Stats

Metric Value
Tests 8
Lines of Rust 171
Public API 14 items

License

Apache-2.0