From 4816a4de5ff1c9cf9fe4ec7ab408ec7bac545db7 Mon Sep 17 00:00:00 2001 From: cloudhead Date: Fri, 1 Dec 2023 13:56:04 +0100 Subject: [PATCH] radicle: Rename many more methods using new naming --- radicle-httpd/src/api.rs | 6 +++--- radicle-httpd/src/api/v1/delegates.rs | 10 +++++----- radicle-httpd/src/api/v1/node.rs | 10 +++++----- radicle-httpd/src/api/v1/projects.rs | 12 ++++++------ radicle-httpd/src/test.rs | 2 +- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/radicle-httpd/src/api.rs b/radicle-httpd/src/api.rs index 15c5a2cd6..ef8586f55 100644 --- a/radicle-httpd/src/api.rs +++ b/radicle-httpd/src/api.rs @@ -64,7 +64,7 @@ impl Context { let issues = issue::Issues::open(&repo)?.counts()?; let patches = patch::Patches::open(&repo)?.counts()?; let db = &self.profile.database()?; - let trackings = db.count(&id).unwrap_or_default(); + let seeding = db.count(&id).unwrap_or_default(); Ok(project::Info { payload, @@ -74,7 +74,7 @@ impl Context { issues, patches, id, - trackings, + seeding, }) } @@ -213,7 +213,7 @@ mod project { pub patches: cob::patch::PatchCounts, pub issues: cob::issue::IssueCounts, pub id: Id, - pub trackings: usize, + pub seeding: usize, } } diff --git a/radicle-httpd/src/api/v1/delegates.rs b/radicle-httpd/src/api/v1/delegates.rs index 8555e015b..260907c92 100644 --- a/radicle-httpd/src/api/v1/delegates.rs +++ b/radicle-httpd/src/api/v1/delegates.rs @@ -78,7 +78,7 @@ async fn delegates_projects_handler( }; let delegates = id.doc.delegates; - let trackings = db.count(&id.rid).unwrap_or_default(); + let seeding = db.count(&id.rid).unwrap_or_default(); Some(Info { payload, @@ -88,7 +88,7 @@ async fn delegates_projects_handler( issues, patches, id: id.rid, - trackings, + seeding, }) }) .skip(page * per_page) @@ -146,7 +146,7 @@ mod routes { "closed": 0, }, "id": "rad:zLuTzcmoWMcdK37xqArS8eckp9vK", - "trackings": 0, + "seeding": 0, }, { "name": "hello-world", @@ -168,7 +168,7 @@ mod routes { "closed": 0, }, "id": RID, - "trackings": 0, + "seeding": 0, }, ]) ); @@ -207,7 +207,7 @@ mod routes { "closed": 0, }, "id": RID, - "trackings": 0, + "seeding": 0, } ]) ); diff --git a/radicle-httpd/src/api/v1/node.rs b/radicle-httpd/src/api/v1/node.rs index c9f5c1ecb..2c004ca0f 100644 --- a/radicle-httpd/src/api/v1/node.rs +++ b/radicle-httpd/src/api/v1/node.rs @@ -51,13 +51,13 @@ async fn node_handler(State(ctx): State) -> impl IntoResponse { Ok::<_, Error>(Json(response)) } -/// Return local tracking repos information. +/// Return local repo policies information. /// `GET /node/policies/repos` async fn node_policies_repos_handler(State(ctx): State) -> impl IntoResponse { - let tracking = ctx.profile.tracking()?; + let policies = ctx.profile.policies()?; let mut repos = Vec::new(); - for policy::Repo { id, scope, policy } in tracking.repo_policies()? { + for policy::Repo { id, scope, policy } in policies.seed_policies()? { repos.push(json!({ "id": id, "scope": scope, @@ -68,7 +68,7 @@ async fn node_policies_repos_handler(State(ctx): State) -> impl IntoRes Ok::<_, Error>(Json(repos)) } -/// Track a new repo. +/// Seed a new repo. /// `PUT /node/policies/repos/:rid` async fn node_policies_seed_handler( State(ctx): State, @@ -90,7 +90,7 @@ async fn node_policies_seed_handler( Ok::<_, Error>((StatusCode::OK, Json(json!({ "success": true })))) } -/// Untrack a repo. +/// Unseed a repo. /// `DELETE /node/policies/repos/:rid` async fn node_policies_unseed_handler( State(ctx): State, diff --git a/radicle-httpd/src/api/v1/projects.rs b/radicle-httpd/src/api/v1/projects.rs index b1d564608..1ccfd629c 100644 --- a/radicle-httpd/src/api/v1/projects.rs +++ b/radicle-httpd/src/api/v1/projects.rs @@ -119,7 +119,7 @@ async fn project_root_handler( return None; }; let delegates = id.doc.delegates; - let trackings = db.count(&id.rid).unwrap_or_default(); + let seeding = db.count(&id.rid).unwrap_or_default(); Some(Info { payload, @@ -129,7 +129,7 @@ async fn project_root_handler( issues, patches, id: id.rid, - trackings, + seeding, }) }) .skip(page * per_page) @@ -994,7 +994,7 @@ mod routes { "closed": 0, }, "id": "rad:zLuTzcmoWMcdK37xqArS8eckp9vK", - "trackings": 0, + "seeding": 0, }, { "name": "hello-world", @@ -1016,7 +1016,7 @@ mod routes { "closed": 0, }, "id": RID, - "trackings": 0, + "seeding": 0, }, ]) ); @@ -1051,7 +1051,7 @@ mod routes { "closed": 0, }, "id": RID, - "trackings": 0, + "seeding": 0, } ]) ); @@ -1086,7 +1086,7 @@ mod routes { "closed": 0, }, "id": RID, - "trackings": 0, + "seeding": 0, }) ); } diff --git a/radicle-httpd/src/test.rs b/radicle-httpd/src/test.rs index 22c8a8379..0145bddea 100644 --- a/radicle-httpd/src/test.rs +++ b/radicle-httpd/src/test.rs @@ -96,7 +96,7 @@ fn seed_with_signer(dir: &Path, profile: radicle::Profile, signer: &G crate::logger::init().ok(); - profile.tracking_mut().unwrap(); + profile.policies_mut().unwrap(); profile.database_mut().unwrap(); // Create the database. let workdir = dir.join("hello-world-private");