Fix store delegation for public_url

This commit is contained in:
asonix 2023-07-14 15:23:07 -05:00
parent 786f583d98
commit 4d78ce7689
3 changed files with 14 additions and 3 deletions

1
.gitignore vendored
View file

@ -4,6 +4,7 @@
/client-examples/javascript/node_modules
/docker/object-storage/storage
/docker/object-storage/pict-rs-garage.toml
/docker/object-storage/*.log
/result
/.ash_history
/.direnv

View file

@ -94,9 +94,7 @@ pub(crate) trait Store: Clone + Debug {
content_type: mime::Mime,
) -> Result<Self::Identifier, StoreError>;
fn public_url(&self, _: &Self::Identifier) -> Option<url::Url> {
None
}
fn public_url(&self, _: &Self::Identifier) -> Option<url::Url>;
async fn to_stream(
&self,
@ -160,6 +158,10 @@ where
T::save_bytes(self, bytes, content_type).await
}
fn public_url(&self, identifier: &Self::Identifier) -> Option<url::Url> {
T::public_url(self, identifier)
}
async fn to_stream(
&self,
identifier: &Self::Identifier,
@ -231,6 +233,10 @@ where
T::save_bytes(self, bytes, content_type).await
}
fn public_url(&self, identifier: &Self::Identifier) -> Option<url::Url> {
T::public_url(self, identifier)
}
async fn to_stream(
&self,
identifier: &Self::Identifier,

View file

@ -109,6 +109,10 @@ impl Store for FileStore {
Ok(self.file_id_from_path(path)?)
}
fn public_url(&self, _identifier: &Self::Identifier) -> Option<url::Url> {
None
}
#[tracing::instrument]
async fn to_stream(
&self,