summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-11-20 19:21:55 +0200
committerLars Wirzenius <liw@liw.fi>2023-11-20 19:21:55 +0200
commitf260a1b8645f15f098cc6aa3a51db24274567ff4 (patch)
tree7750ff89de441fa456d6c5324ca1a6faf608137f
parentccc24583da0af07a626d889a0e63976a9405285e (diff)
downloadci-broker-prototype-f260a1b8645f15f098cc6aa3a51db24274567ff4.tar.gz
stash
-rw-r--r--Cargo.lock23
-rw-r--r--src/main.rs38
2 files changed, 52 insertions, 9 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ac212bf..dcbdc9a 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -420,9 +420,9 @@ dependencies = [
[[package]]
name = "cypheraddr"
-version = "0.2.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41a05c461a9b86ba80542a5204924fd3cae3f47be011e00b1bbef9d71d95b3bb"
+checksum = "e64c60d980ec55006d2a1229923a5fa73046de824455569cccb6cb2e4a64ae31"
dependencies = [
"amplify",
"base32",
@@ -442,9 +442,9 @@ dependencies = [
[[package]]
name = "cyphernet"
-version = "0.3.0"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c78f33bc1f1423741a6939ce6da2b6af2e7be4ff43e8878cf4bac1284028e93"
+checksum = "2f8be7cc6e24cfea2c126bddaaddfd3c3054865b4cd52882eae9dfea6ee8aac1"
dependencies = [
"cypheraddr",
"cyphergraphy",
@@ -1623,8 +1623,8 @@ dependencies = [
"libc",
"once_cell",
"termion 2.0.3",
+ "unicode-display-width",
"unicode-segmentation",
- "unicode-width",
"zeroize",
]
@@ -2054,9 +2054,9 @@ dependencies = [
[[package]]
name = "socks5-client"
-version = "0.2.0"
+version = "0.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "4091196d57cf9436ebecbec4c572b2be61373a7aaa632a3e93a5cb8555ec1b79"
+checksum = "c0c27f4545b26cb6e14990e7477c38a8b493b2e8738166fa2a1f5f174ef3fa5f"
dependencies = [
"amplify",
"cypheraddr",
@@ -2397,6 +2397,15 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460"
[[package]]
+name = "unicode-display-width"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "9a43273b656140aa2bb8e65351fe87c255f0eca706b2538a9bd4a590a3490bf3"
+dependencies = [
+ "unicode-segmentation",
+]
+
+[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/src/main.rs b/src/main.rs
index fa083cf..3b9eab2 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -7,11 +7,12 @@ use std::{thread::spawn, time};
use axum::{extract::Path, http::StatusCode, response::IntoResponse, routing::get, Router};
use log::{debug, info};
-use radicle::node::Handle;
-// use radicle::storage::RefUpdate;
+use radicle::node::{Event, Handle};
+use radicle::storage::RefUpdate;
use radicle::Profile;
// const START: &str = "http://localhost:8000/runs";
+const RID: &str = "rad:z3cRFMy4yiiUFHJxco865TijwUaDk";
#[tokio::main]
async fn main() -> anyhow::Result<()> {
@@ -58,6 +59,39 @@ fn subscribe_to_node_events(profile: Profile) -> anyhow::Result<()> {
let event = event?;
debug!("{:#?}", event);
+ if let Event::RefsFetched {
+ remote: _,
+ rid,
+ updated,
+ } = event
+ {
+ debug!("repository {} updated refs", rid);
+ let rid = format!("{}", rid);
+ debug!("rid: {:?}", rid);
+ debug!("RID: {:?}", RID);
+ if rid == RID {
+ info!("repository is interesting; ref changes:");
+ for u in updated {
+ match u {
+ RefUpdate::Created { name, oid } => {
+ info!("- new ref: {}", name);
+ info!(" {}", oid);
+ }
+ RefUpdate::Updated { name, old, new } => {
+ info!("- updated: {}", name);
+ info!(" {} -> {}", old, new);
+ }
+ RefUpdate::Deleted { name, oid: _ } => {
+ info!("- deleted: {}", name)
+ }
+ RefUpdate::Skipped { name, oid: _ } => {
+ info!("- up to date: {}", name)
+ }
+ }
+ }
+ }
+ }
+
// #[allow(clippy::single_match)]
// match event {
// Event::RefsFetched {