Crates.io | radicle-job |
lib.rs | radicle-job |
version | 0.3.0 |
created_at | 2025-06-12 09:31:59.682379+00 |
updated_at | 2025-08-15 10:35:30.012914+00 |
description | Radicle Job Collaborative Object |
homepage | https://radicle.xyz |
repository | https://app.radicle.xyz/nodes/iris.radicle.xyz/rad:z2UcCU1LgMshWvXj6hXSDDrwB8q8M |
max_upload_size | |
id | 1709630 |
size | 119,078 |
radicle-job
A crate for all† your automated job needs on the Radicle Network.
†: well maybe almost all.
radicle-job
provides a collaborative framework for managing automated tasks
across the Radicle peer-to-peer network. Multiple nodes can pick up and execute
jobs (like CI/CD pipelines) for any given Git commit, with results synchronized
across the network using Radicle's Collaborative Objects (COBs).
Started
, Finished(Succeeded)
,
Finished(Failed)
)Add this to your Cargo.toml
:
[dependencies]
radicle-job = "0.1"
radicle >= "0.15" # Required for core Radicle functionality
This crate is designed to work seamlessly with the
radicle
ecosystem.
use radicle_job::{Jobs, Reason};
use radicle::git::Oid;
use url::Url;
use uuid::Uuid;
// Open the jobs store for a repository
let mut jobs = Jobs::open(&repo)?;
// Create a new job for a specific commit
let commit_oid = /* your commit OID */;
let mut job = jobs.create(commit_oid, &signer)?;
// Node starts a run
let run_id = Uuid::new_v4();
let log_url = Url::parse("https://ci.example.com/logs/run-123")?;
job.run(run_id, log_url, &signer)?;
// Node reports completion
job.finish(run_id, Reason::Succeeded, &signer)?;
// Get all runs that are currently in progress
let started_runs = job.started();
// Get successful runs from all nodes
let successful_runs = job.succeeded();
// Get the latest run from a specific node
if let Some((uuid, run)) = job.latest_of(&node_id) {
println!("Latest run: {} - Status: {:?}", uuid, run.status());
println!("Logs available at: {}", run.log());
}
// Partition runs by status
let all_nodes_status = job.partition();
for (node_id, (started, succeeded, failed)) in all_nodes_status {
println!("Node {}: {} started, {} succeeded, {} failed",
node_id, started.len(), succeeded.len(), failed.len());
}
The primary use case is distributed CI execution:
Jobs<R>
: The main store for managing jobs in a repositoryJob
: A read-only view of a job and its runs across all nodesJobMut
: A mutable job handle for adding runs and updating statusRun
: Represents a single execution attempt with status and log URLRuns
: A collection of runs with insertion-order iterationJobs::create()
: Create a new job for a commitJobs::get()
/ Jobs::get_mut()
: Retrieve existing jobsJobMut::run()
: Start a new runJobMut::finish()
: Mark a run as completedJob::latest()
: Get the most recent runJobs in radicle-job
are inherently collaborative:
This design enables resilient, distributed job execution where no single point of failure can prevent job completion.
This project is licensed under the MIT License or Apache License 2.0 at your option.
radicle
- Core Radicle protocol
implementationradicle-ci-broker
- Radicle
library for brokering CI events