Skip to content

Commit

Permalink
allow having multiple UUIDs
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkw committed Oct 15, 2024
1 parent 4a170d7 commit 673259f
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions ereporter/api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,29 +20,36 @@ pub trait EreporterApi {
/// Get a list of ereports, paginated by sequence number.
#[endpoint {
method = GET,
path = "/ereports"
path = "/ereports/{reporter_id}"
}]
async fn ereports_list(
request_context: RequestContext<Self::Context>,
path: dropshot::Path<ListPathParams>,
query: Query<PaginationParams<EmptyScanParams, Generation>>,
) -> Result<HttpResponseOk<ResultsPage<Entry>>, HttpError>;

/// Informs the reporter that it may freely discard ereports with sequence
/// numbers less than or equal to `seq`.
/// Informs the reporter with the given UUID that it may freely discard
/// ereports with sequence numbers less than or equal to `seq`.
#[endpoint {
method = DELETE,
path = "/ereports/{seq}"
path = "/ereports/{reporter_id}/{seq}"
}]
async fn ereports_truncate(
request_context: RequestContext<Self::Context>,
path: dropshot::Path<SeqPathParam>,
path: dropshot::Path<TruncatePathParams>,
) -> Result<HttpResponseDeleted, HttpError>;
}

/// Path parameter to select a sequence number for
/// [`EreporterApi::ereports_truncate`].
/// Path parameters to the [`EreporterAPi::ereports_list`] endpoint.
#[derive(Clone, Copy, Debug, Deserialize, JsonSchema, Serialize)]
pub struct SeqPathParam {
pub struct ListPathParams {
pub reporter_id: Uuid,
}

/// Path parameters to the [`EreporterApi::ereports_truncate`] endpoint.
#[derive(Clone, Copy, Debug, Deserialize, JsonSchema, Serialize)]
pub struct TruncatePathParams {
pub reporter_id: Uuid,
pub seq: Generation,
}

Expand Down

0 comments on commit 673259f

Please sign in to comment.