diff --git a/object_store/src/aws/client.rs b/object_store/src/aws/client.rs index 00d6ee446f2f..6b34b181ab9d 100644 --- a/object_store/src/aws/client.rs +++ b/object_store/src/aws/client.rs @@ -20,7 +20,6 @@ use crate::aws::credential::{AwsCredential, CredentialExt}; use crate::aws::{AwsCredentialProvider, S3CopyIfNotExists, STORE, STRICT_PATH_ENCODE_SET}; use crate::client::get::GetClient; use crate::client::header::get_etag; -use crate::client::header::HeaderConfig; use crate::client::list::ListClient; use crate::client::list_response::ListResponse; use crate::client::retry::RetryExt; @@ -550,12 +549,6 @@ impl S3Client { impl GetClient for S3Client { const STORE: &'static str = STORE; - const HEADER_CONFIG: HeaderConfig = HeaderConfig { - etag_required: false, - last_modified_required: false, - version_header: Some("x-amz-version-id"), - }; - /// Make an S3 GET request async fn get_request(&self, path: &Path, options: GetOptions) -> Result { let credential = self.get_credential().await?; @@ -565,11 +558,7 @@ impl GetClient for S3Client { false => Method::GET, }; - let mut builder = self.client.request(method, url); - - if let Some(v) = &options.version { - builder = builder.query(&[("versionId", v)]) - } + let builder = self.client.request(method, url); let response = builder .with_get_options(options) diff --git a/object_store/src/azure/client.rs b/object_store/src/azure/client.rs index cd3df8c7b857..b5ef02191cd7 100644 --- a/object_store/src/azure/client.rs +++ b/object_store/src/azure/client.rs @@ -19,7 +19,6 @@ use super::credential::AzureCredential; use crate::azure::credential::*; use crate::azure::{AzureCredentialProvider, STORE}; use crate::client::get::GetClient; -use crate::client::header::HeaderConfig; use crate::client::list::ListClient; use crate::client::retry::RetryExt; use crate::client::GetOptionsExt; @@ -255,12 +254,6 @@ impl AzureClient { impl GetClient for AzureClient { const STORE: &'static str = STORE; - const HEADER_CONFIG: HeaderConfig = HeaderConfig { - etag_required: true, - last_modified_required: true, - version_header: Some("x-ms-version-id"), - }; - /// Make an Azure GET request /// /// @@ -272,16 +265,12 @@ impl GetClient for AzureClient { false => Method::GET, }; - let mut builder = self + let builder = self .client .request(method, url) .header(CONTENT_LENGTH, HeaderValue::from_static("0")) .body(Bytes::new()); - if let Some(v) = &options.version { - builder = builder.query(&[("versionid", v)]) - } - let response = builder .with_get_options(options) .with_azure_authorization(&credential, &self.config.account) @@ -438,7 +427,6 @@ impl TryFrom for ObjectMeta { last_modified: value.properties.last_modified, size: value.properties.content_length as usize, e_tag: value.properties.e_tag, - version: None, // For consistency with S3 and GCP which don't include this }) } } diff --git a/object_store/src/client/get.rs b/object_store/src/client/get.rs index 5f9cac9b424b..ed1762ff8fe9 100644 --- a/object_store/src/client/get.rs +++ b/object_store/src/client/get.rs @@ -29,7 +29,10 @@ pub trait GetClient: Send + Sync + 'static { const STORE: &'static str; /// Configure the [`HeaderConfig`] for this client - const HEADER_CONFIG: HeaderConfig; + const HEADER_CONFIG: HeaderConfig = HeaderConfig { + etag_required: true, + last_modified_required: true, + }; async fn get_request(&self, path: &Path, options: GetOptions) -> Result; } diff --git a/object_store/src/client/header.rs b/object_store/src/client/header.rs index e67496833b99..17f83a2ba8c8 100644 --- a/object_store/src/client/header.rs +++ b/object_store/src/client/header.rs @@ -35,9 +35,6 @@ pub struct HeaderConfig { /// /// Defaults to `true` pub last_modified_required: bool, - - /// The version header name if any - pub version_header: Option<&'static str>, } #[derive(Debug, Snafu)] @@ -101,20 +98,14 @@ pub fn header_meta( .context(MissingContentLengthSnafu)?; let content_length = content_length.to_str().context(BadHeaderSnafu)?; - let size = content_length + let content_length = content_length .parse() .context(InvalidContentLengthSnafu { content_length })?; - let version = match cfg.version_header.and_then(|h| headers.get(h)) { - Some(v) => Some(v.to_str().context(BadHeaderSnafu)?.to_string()), - None => None, - }; - Ok(ObjectMeta { location: location.clone(), last_modified, - version, - size, + size: content_length, e_tag, }) } diff --git a/object_store/src/client/list_response.rs b/object_store/src/client/list_response.rs index 7a170c584156..6a3889e3be5b 100644 --- a/object_store/src/client/list_response.rs +++ b/object_store/src/client/list_response.rs @@ -80,7 +80,6 @@ impl TryFrom for ObjectMeta { last_modified: value.last_modified, size: value.size, e_tag: value.e_tag, - version: None, }) } } diff --git a/object_store/src/gcp/client.rs b/object_store/src/gcp/client.rs index 558a6f8d2a84..4165d784fd7f 100644 --- a/object_store/src/gcp/client.rs +++ b/object_store/src/gcp/client.rs @@ -16,7 +16,7 @@ // under the License. use crate::client::get::GetClient; -use crate::client::header::{get_etag, HeaderConfig}; +use crate::client::header::get_etag; use crate::client::list::ListClient; use crate::client::list_response::ListResponse; use crate::client::retry::RetryExt; @@ -333,11 +333,6 @@ impl GoogleCloudStorageClient { #[async_trait] impl GetClient for GoogleCloudStorageClient { const STORE: &'static str = STORE; - const HEADER_CONFIG: HeaderConfig = HeaderConfig { - etag_required: true, - last_modified_required: true, - version_header: Some("x-goog-generation"), - }; /// Perform a get request async fn get_request(&self, path: &Path, options: GetOptions) -> Result { diff --git a/object_store/src/http/client.rs b/object_store/src/http/client.rs index a7dbdfcbe844..f7593be5a043 100644 --- a/object_store/src/http/client.rs +++ b/object_store/src/http/client.rs @@ -277,7 +277,6 @@ impl GetClient for Client { const HEADER_CONFIG: HeaderConfig = HeaderConfig { etag_required: false, last_modified_required: false, - version_header: None, }; async fn get_request(&self, path: &Path, options: GetOptions) -> Result { @@ -376,7 +375,6 @@ impl MultiStatusResponse { last_modified, size: self.size()?, e_tag: self.prop_stat.prop.e_tag.clone(), - version: None, }) } diff --git a/object_store/src/lib.rs b/object_store/src/lib.rs index b9d6d597587b..6f852721eb29 100644 --- a/object_store/src/lib.rs +++ b/object_store/src/lib.rs @@ -676,8 +676,6 @@ pub struct ObjectMeta { /// /// pub e_tag: Option, - /// A version indicator for this object - pub version: Option, } /// Options for a get request, such as range @@ -726,8 +724,6 @@ pub struct GetOptions { /// /// pub range: Option>, - /// Request a particular object version - pub version: Option, /// Request transfer of no content /// /// @@ -1422,24 +1418,6 @@ mod tests { }; let err = storage.get_opts(&path, options).await.unwrap_err(); assert!(matches!(err, Error::Precondition { .. }), "{err}"); - - if let Some(version) = meta.version { - storage.put(&path, "bar".into()).await.unwrap(); - - let options = GetOptions { - version: Some(version), - ..GetOptions::default() - }; - - // Can retrieve previous version - let get_opts = storage.get_opts(&path, options).await.unwrap(); - let old = get_opts.bytes().await.unwrap(); - assert_eq!(old, b"foo".as_slice()); - - // Current version contains the updated data - let current = storage.get(&path).await.unwrap().bytes().await.unwrap(); - assert_eq!(¤t, b"bar".as_slice()); - } } /// Returns a chunk of length `chunk_length` @@ -1752,7 +1730,6 @@ mod tests { last_modified: Utc.timestamp_nanos(100), size: 100, e_tag: Some("123".to_string()), - version: None, }; let mut options = GetOptions::default(); diff --git a/object_store/src/local.rs b/object_store/src/local.rs index ce9aa4683499..9be3ee923244 100644 --- a/object_store/src/local.rs +++ b/object_store/src/local.rs @@ -969,7 +969,6 @@ fn convert_metadata(metadata: Metadata, location: Path) -> Result { last_modified, size, e_tag: Some(get_etag(&metadata)), - version: None, }) } diff --git a/object_store/src/memory.rs b/object_store/src/memory.rs index 8b9522e48de8..da7b55d3a83f 100644 --- a/object_store/src/memory.rs +++ b/object_store/src/memory.rs @@ -166,7 +166,6 @@ impl ObjectStore for InMemory { last_modified: entry.last_modified, size: entry.data.len(), e_tag: Some(e_tag), - version: None, }; options.check_preconditions(&meta)?; @@ -213,7 +212,6 @@ impl ObjectStore for InMemory { last_modified: entry.last_modified, size: entry.data.len(), e_tag: Some(entry.e_tag.to_string()), - version: None, }) } @@ -243,7 +241,6 @@ impl ObjectStore for InMemory { last_modified: value.last_modified, size: value.data.len(), e_tag: Some(value.e_tag.to_string()), - version: None, }) }) .collect(); @@ -288,7 +285,6 @@ impl ObjectStore for InMemory { last_modified: v.last_modified, size: v.data.len(), e_tag: Some(v.e_tag.to_string()), - version: None, }; objects.push(object); } diff --git a/object_store/src/prefix.rs b/object_store/src/prefix.rs index b5bff8b12dd7..c4cb77b66d01 100644 --- a/object_store/src/prefix.rs +++ b/object_store/src/prefix.rs @@ -73,7 +73,6 @@ impl PrefixStore { size: meta.size, location: self.strip_prefix(meta.location), e_tag: meta.e_tag, - version: None, } } }