Skip to content

Commit

Permalink
chore: added docs to all create router functions
Browse files Browse the repository at this point in the history
  • Loading branch information
francis2tm committed Dec 4, 2024
1 parent d0c67ef commit 5088cf9
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 0 deletions.
5 changes: 5 additions & 0 deletions atoma-daemon/src/handlers/almost_filled_stacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new()
.route(
Expand Down
7 changes: 7 additions & 0 deletions atoma-daemon/src/handlers/attestation_disputes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new()
.route(
Expand Down
6 changes: 6 additions & 0 deletions atoma-daemon/src/handlers/nodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new()
.route(&format!("{NODES_PATH}/register"), post(nodes_register))
Expand Down
6 changes: 6 additions & 0 deletions atoma-daemon/src/handlers/stacks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new()
.route(STACKS_PATH, get(stacks_list))
Expand Down
6 changes: 6 additions & 0 deletions atoma-daemon/src/handlers/subscriptions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new()
.route(SUBSCRIPTIONS_PATH, get(subscriptions_list))
Expand Down
5 changes: 5 additions & 0 deletions atoma-daemon/src/handlers/tasks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<DaemonState> {
Router::new().route(TASKS_PATH, get(tasks_list))
}
Expand Down

0 comments on commit 5088cf9

Please sign in to comment.