-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Da blob api #487
Da blob api #487
Conversation
) -> impl IntoResponse { | ||
match da::da_mempool_status(&store.da, items).await { | ||
match da::da_mempool_status(&store.da_mempool, items).await { | ||
Ok(status) => (StatusCode::OK, Json(status)).into_response(), | ||
Err(e) => (StatusCode::INTERNAL_SERVER_ERROR, e.to_string()).into_response(), | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as in other PRs not sure why do we return IntoResponse
when we already transform everything into a response inside.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because the type returned in ok arm and err arm are not actually the same, we have to call into_response
to convert to Response
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes I guessed that, but why return IntoResponse
later when we already got a response? Is it to avoid boxing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, we can use Response
as the returned type in our case.
path = "/da/blob", | ||
responses( | ||
(status = 200, description = "Query the mempool status of the da service", body = Vec<Blob>), | ||
(status = 500, description = "Internal server error", body = String), | ||
) | ||
)] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we return all blobs it is better that the path is /da/blobs
. Also the description would be something like Get pending blobs
.
@@ -14,6 +18,12 @@ pub(crate) type DaMempoolService = MempoolService< | |||
CertDiscriminant, | |||
>; | |||
|
|||
pub type DataAvailability = DataAvailabilityService< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to reuse the type in nomos-node
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@al8n, refactor for this will be done later on? Let's open an issue for tracking it please!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, will open a new PR soon for this.
No description provided.