From 5088cf96d9d8f5a363003f2a10de43dbc20aaa6e Mon Sep 17 00:00:00 2001 From: francis2tm Date: Wed, 4 Dec 2024 12:40:54 +0000 Subject: [PATCH] chore: added docs to all create router functions --- atoma-daemon/src/handlers/almost_filled_stacks.rs | 5 +++++ atoma-daemon/src/handlers/attestation_disputes.rs | 7 +++++++ atoma-daemon/src/handlers/nodes.rs | 6 ++++++ atoma-daemon/src/handlers/stacks.rs | 6 ++++++ atoma-daemon/src/handlers/subscriptions.rs | 6 ++++++ atoma-daemon/src/handlers/tasks.rs | 5 +++++ 6 files changed, 35 insertions(+) diff --git a/atoma-daemon/src/handlers/almost_filled_stacks.rs b/atoma-daemon/src/handlers/almost_filled_stacks.rs index f956c6fb..3bd290ce 100644 --- a/atoma-daemon/src/handlers/almost_filled_stacks.rs +++ b/atoma-daemon/src/handlers/almost_filled_stacks.rs @@ -19,6 +19,11 @@ pub const ALMOST_FILLED_STACKS_PATH: &str = "/almost_filled_stacks"; )] pub(crate) struct AlmostFilledStacksOpenApi; +/// Router for handling almost filled stacks endpoints +/// +/// Creates routes for: +/// - GET /almost_filled_stacks - Get stacks above threshold for all nodes +/// - GET /almost_filled_stacks/:id - Get stacks above threshold for specific node pub fn almost_filled_stacks_router() -> Router { Router::new() .route( diff --git a/atoma-daemon/src/handlers/attestation_disputes.rs b/atoma-daemon/src/handlers/attestation_disputes.rs index cfe7e775..89f98239 100644 --- a/atoma-daemon/src/handlers/attestation_disputes.rs +++ b/atoma-daemon/src/handlers/attestation_disputes.rs @@ -24,6 +24,13 @@ pub const ATTESTATION_DISPUTES_PATH: &str = "/attestation_disputes"; )] pub(crate) struct AttestationDisputesOpenApi; +/// Router for handling attestation disputes endpoints +/// +/// Creates routes for: +/// - GET /attestation_disputes/against - Get all attestation disputes against the registered nodes +/// - GET /attestation_disputes/against/:id - Get attestation disputes against a specific node +/// - GET /attestation_disputes/own - Get all attestation disputes initiated by the registered nodes +/// - GET /attestation_disputes/own/:id - Get attestation disputes initiated by a specific node pub fn attestation_disputes_router() -> Router { Router::new() .route( diff --git a/atoma-daemon/src/handlers/nodes.rs b/atoma-daemon/src/handlers/nodes.rs index 69123b46..b0ef32c1 100644 --- a/atoma-daemon/src/handlers/nodes.rs +++ b/atoma-daemon/src/handlers/nodes.rs @@ -51,6 +51,12 @@ pub const NODES_PATH: &str = "/nodes"; )] pub(crate) struct NodesOpenApi; +/// Router for handling node-related endpoints +/// +/// This function sets up the routing for various node-related operations, +/// including registration, model subscription, task subscription, and more. +/// Each route corresponds to a specific operation that nodes can perform +/// within the system. pub fn nodes_router() -> Router { Router::new() .route(&format!("{NODES_PATH}/register"), post(nodes_register)) diff --git a/atoma-daemon/src/handlers/stacks.rs b/atoma-daemon/src/handlers/stacks.rs index 63edffe7..2bdd1864 100644 --- a/atoma-daemon/src/handlers/stacks.rs +++ b/atoma-daemon/src/handlers/stacks.rs @@ -19,6 +19,12 @@ pub const STACKS_PATH: &str = "/stacks"; )] pub(crate) struct StacksOpenApi; +/// Router for handling stack-related endpoints +/// +/// This function sets up the routing for various stack-related operations, +/// including listing all stacks, retrieving specific stacks by ID, listing claimed stacks, +/// and retrieving specific claimed stacks by ID. Each route corresponds to a specific +/// operation that can be performed on stacks within the system. pub fn stacks_router() -> Router { Router::new() .route(STACKS_PATH, get(stacks_list)) diff --git a/atoma-daemon/src/handlers/subscriptions.rs b/atoma-daemon/src/handlers/subscriptions.rs index aa3d5b22..19064d67 100644 --- a/atoma-daemon/src/handlers/subscriptions.rs +++ b/atoma-daemon/src/handlers/subscriptions.rs @@ -19,6 +19,12 @@ pub const SUBSCRIPTIONS_PATH: &str = "/subscriptions"; )] pub(crate) struct SubscriptionsOpenApi; +/// Router for handling subscription-related endpoints +/// +/// This function sets up the routing for various subscription-related operations, +/// including listing all subscriptions and retrieving specific subscriptions by ID. +/// Each route corresponds to a specific operation that can be performed on subscriptions +/// within the system. pub fn subscriptions_router() -> Router { Router::new() .route(SUBSCRIPTIONS_PATH, get(subscriptions_list)) diff --git a/atoma-daemon/src/handlers/tasks.rs b/atoma-daemon/src/handlers/tasks.rs index 1b32bf2a..03659ad3 100644 --- a/atoma-daemon/src/handlers/tasks.rs +++ b/atoma-daemon/src/handlers/tasks.rs @@ -11,6 +11,11 @@ pub const TASKS_PATH: &str = "/tasks"; #[openapi(paths(tasks_list), components(schemas(Task)))] pub(crate) struct TasksOpenApi; +/// Router for handling task-related endpoints +/// +/// This function sets up the routing for various task-related operations, +/// including listing all tasks. Each route corresponds to a specific +/// operation that can be performed on tasks within the system. pub fn tasks_router() -> Router { Router::new().route(TASKS_PATH, get(tasks_list)) }