mirror of
https://git.asonix.dog/asonix/pict-rs
synced 2024-12-22 19:31:35 +00:00
Instrument upload store methods
This commit is contained in:
parent
51d8621015
commit
21e3e63ac3
1 changed files with 4 additions and 0 deletions
|
@ -281,11 +281,13 @@ impl CachedRepo for SledRepo {
|
||||||
|
|
||||||
#[async_trait::async_trait(?Send)]
|
#[async_trait::async_trait(?Send)]
|
||||||
impl UploadRepo for SledRepo {
|
impl UploadRepo for SledRepo {
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
async fn create(&self, upload_id: UploadId) -> Result<(), Error> {
|
async fn create(&self, upload_id: UploadId) -> Result<(), Error> {
|
||||||
b!(self.uploads, uploads.insert(upload_id.as_bytes(), b"1"));
|
b!(self.uploads, uploads.insert(upload_id.as_bytes(), b"1"));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
async fn wait(&self, upload_id: UploadId) -> Result<UploadResult, Error> {
|
async fn wait(&self, upload_id: UploadId) -> Result<UploadResult, Error> {
|
||||||
let mut subscriber = self.uploads.watch_prefix(upload_id.as_bytes());
|
let mut subscriber = self.uploads.watch_prefix(upload_id.as_bytes());
|
||||||
|
|
||||||
|
@ -318,11 +320,13 @@ impl UploadRepo for SledRepo {
|
||||||
Err(UploadError::Canceled.into())
|
Err(UploadError::Canceled.into())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self))]
|
||||||
async fn claim(&self, upload_id: UploadId) -> Result<(), Error> {
|
async fn claim(&self, upload_id: UploadId) -> Result<(), Error> {
|
||||||
b!(self.uploads, uploads.remove(upload_id.as_bytes()));
|
b!(self.uploads, uploads.remove(upload_id.as_bytes()));
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[tracing::instrument(skip(self, result))]
|
||||||
async fn complete(&self, upload_id: UploadId, result: UploadResult) -> Result<(), Error> {
|
async fn complete(&self, upload_id: UploadId, result: UploadResult) -> Result<(), Error> {
|
||||||
let result: InnerUploadResult = result.into();
|
let result: InnerUploadResult = result.into();
|
||||||
let result = serde_json::to_vec(&result)?;
|
let result = serde_json::to_vec(&result)?;
|
||||||
|
|
Loading…
Reference in a new issue