Skip to content

Commit 95bb1ce

Browse files
Revert "Add ObjectMeta::version and GetOptions::version (#4925) (apache#4935)"
This reverts commit f4a2a88.
1 parent 2769380 commit 95bb1ce

File tree

11 files changed

+9
-75
lines changed

11 files changed

+9
-75
lines changed

object_store/src/aws/client.rs

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use crate::aws::credential::{AwsCredential, CredentialExt};
2020
use crate::aws::{AwsCredentialProvider, S3CopyIfNotExists, STORE, STRICT_PATH_ENCODE_SET};
2121
use crate::client::get::GetClient;
2222
use crate::client::header::get_etag;
23-
use crate::client::header::HeaderConfig;
2423
use crate::client::list::ListClient;
2524
use crate::client::list_response::ListResponse;
2625
use crate::client::retry::RetryExt;
@@ -550,12 +549,6 @@ impl S3Client {
550549
impl GetClient for S3Client {
551550
const STORE: &'static str = STORE;
552551

553-
const HEADER_CONFIG: HeaderConfig = HeaderConfig {
554-
etag_required: false,
555-
last_modified_required: false,
556-
version_header: Some("x-amz-version-id"),
557-
};
558-
559552
/// Make an S3 GET request <https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html>
560553
async fn get_request(&self, path: &Path, options: GetOptions) -> Result<Response> {
561554
let credential = self.get_credential().await?;
@@ -565,11 +558,7 @@ impl GetClient for S3Client {
565558
false => Method::GET,
566559
};
567560

568-
let mut builder = self.client.request(method, url);
569-
570-
if let Some(v) = &options.version {
571-
builder = builder.query(&[("versionId", v)])
572-
}
561+
let builder = self.client.request(method, url);
573562

574563
let response = builder
575564
.with_get_options(options)

object_store/src/azure/client.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use super::credential::AzureCredential;
1919
use crate::azure::credential::*;
2020
use crate::azure::{AzureCredentialProvider, STORE};
2121
use crate::client::get::GetClient;
22-
use crate::client::header::HeaderConfig;
2322
use crate::client::list::ListClient;
2423
use crate::client::retry::RetryExt;
2524
use crate::client::GetOptionsExt;
@@ -255,12 +254,6 @@ impl AzureClient {
255254
impl GetClient for AzureClient {
256255
const STORE: &'static str = STORE;
257256

258-
const HEADER_CONFIG: HeaderConfig = HeaderConfig {
259-
etag_required: true,
260-
last_modified_required: true,
261-
version_header: Some("x-ms-version-id"),
262-
};
263-
264257
/// Make an Azure GET request
265258
/// <https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob>
266259
/// <https://docs.microsoft.com/en-us/rest/api/storageservices/get-blob-properties>
@@ -272,16 +265,12 @@ impl GetClient for AzureClient {
272265
false => Method::GET,
273266
};
274267

275-
let mut builder = self
268+
let builder = self
276269
.client
277270
.request(method, url)
278271
.header(CONTENT_LENGTH, HeaderValue::from_static("0"))
279272
.body(Bytes::new());
280273

281-
if let Some(v) = &options.version {
282-
builder = builder.query(&[("versionid", v)])
283-
}
284-
285274
let response = builder
286275
.with_get_options(options)
287276
.with_azure_authorization(&credential, &self.config.account)
@@ -438,7 +427,6 @@ impl TryFrom<Blob> for ObjectMeta {
438427
last_modified: value.properties.last_modified,
439428
size: value.properties.content_length as usize,
440429
e_tag: value.properties.e_tag,
441-
version: None, // For consistency with S3 and GCP which don't include this
442430
})
443431
}
444432
}

object_store/src/client/get.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ pub trait GetClient: Send + Sync + 'static {
2929
const STORE: &'static str;
3030

3131
/// Configure the [`HeaderConfig`] for this client
32-
const HEADER_CONFIG: HeaderConfig;
32+
const HEADER_CONFIG: HeaderConfig = HeaderConfig {
33+
etag_required: true,
34+
last_modified_required: true,
35+
};
3336

3437
async fn get_request(&self, path: &Path, options: GetOptions) -> Result<Response>;
3538
}

object_store/src/client/header.rs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ pub struct HeaderConfig {
3535
///
3636
/// Defaults to `true`
3737
pub last_modified_required: bool,
38-
39-
/// The version header name if any
40-
pub version_header: Option<&'static str>,
4138
}
4239

4340
#[derive(Debug, Snafu)]
@@ -101,20 +98,14 @@ pub fn header_meta(
10198
.context(MissingContentLengthSnafu)?;
10299

103100
let content_length = content_length.to_str().context(BadHeaderSnafu)?;
104-
let size = content_length
101+
let content_length = content_length
105102
.parse()
106103
.context(InvalidContentLengthSnafu { content_length })?;
107104

108-
let version = match cfg.version_header.and_then(|h| headers.get(h)) {
109-
Some(v) => Some(v.to_str().context(BadHeaderSnafu)?.to_string()),
110-
None => None,
111-
};
112-
113105
Ok(ObjectMeta {
114106
location: location.clone(),
115107
last_modified,
116-
version,
117-
size,
108+
size: content_length,
118109
e_tag,
119110
})
120111
}

object_store/src/client/list_response.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ impl TryFrom<ListContents> for ObjectMeta {
8080
last_modified: value.last_modified,
8181
size: value.size,
8282
e_tag: value.e_tag,
83-
version: None,
8483
})
8584
}
8685
}

object_store/src/gcp/client.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
// under the License.
1717

1818
use crate::client::get::GetClient;
19-
use crate::client::header::{get_etag, HeaderConfig};
19+
use crate::client::header::get_etag;
2020
use crate::client::list::ListClient;
2121
use crate::client::list_response::ListResponse;
2222
use crate::client::retry::RetryExt;
@@ -333,11 +333,6 @@ impl GoogleCloudStorageClient {
333333
#[async_trait]
334334
impl GetClient for GoogleCloudStorageClient {
335335
const STORE: &'static str = STORE;
336-
const HEADER_CONFIG: HeaderConfig = HeaderConfig {
337-
etag_required: true,
338-
last_modified_required: true,
339-
version_header: Some("x-goog-generation"),
340-
};
341336

342337
/// Perform a get request <https://cloud.google.com/storage/docs/xml-api/get-object-download>
343338
async fn get_request(&self, path: &Path, options: GetOptions) -> Result<Response> {

object_store/src/http/client.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,6 @@ impl GetClient for Client {
277277
const HEADER_CONFIG: HeaderConfig = HeaderConfig {
278278
etag_required: false,
279279
last_modified_required: false,
280-
version_header: None,
281280
};
282281

283282
async fn get_request(&self, path: &Path, options: GetOptions) -> Result<Response> {
@@ -376,7 +375,6 @@ impl MultiStatusResponse {
376375
last_modified,
377376
size: self.size()?,
378377
e_tag: self.prop_stat.prop.e_tag.clone(),
379-
version: None,
380378
})
381379
}
382380

object_store/src/lib.rs

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -676,8 +676,6 @@ pub struct ObjectMeta {
676676
///
677677
/// <https://datatracker.ietf.org/doc/html/rfc9110#name-etag>
678678
pub e_tag: Option<String>,
679-
/// A version indicator for this object
680-
pub version: Option<String>,
681679
}
682680

683681
/// Options for a get request, such as range
@@ -726,8 +724,6 @@ pub struct GetOptions {
726724
///
727725
/// <https://datatracker.ietf.org/doc/html/rfc9110#name-range>
728726
pub range: Option<Range<usize>>,
729-
/// Request a particular object version
730-
pub version: Option<String>,
731727
/// Request transfer of no content
732728
///
733729
/// <https://datatracker.ietf.org/doc/html/rfc9110#name-head>
@@ -1422,24 +1418,6 @@ mod tests {
14221418
};
14231419
let err = storage.get_opts(&path, options).await.unwrap_err();
14241420
assert!(matches!(err, Error::Precondition { .. }), "{err}");
1425-
1426-
if let Some(version) = meta.version {
1427-
storage.put(&path, "bar".into()).await.unwrap();
1428-
1429-
let options = GetOptions {
1430-
version: Some(version),
1431-
..GetOptions::default()
1432-
};
1433-
1434-
// Can retrieve previous version
1435-
let get_opts = storage.get_opts(&path, options).await.unwrap();
1436-
let old = get_opts.bytes().await.unwrap();
1437-
assert_eq!(old, b"foo".as_slice());
1438-
1439-
// Current version contains the updated data
1440-
let current = storage.get(&path).await.unwrap().bytes().await.unwrap();
1441-
assert_eq!(&current, b"bar".as_slice());
1442-
}
14431421
}
14441422

14451423
/// Returns a chunk of length `chunk_length`
@@ -1752,7 +1730,6 @@ mod tests {
17521730
last_modified: Utc.timestamp_nanos(100),
17531731
size: 100,
17541732
e_tag: Some("123".to_string()),
1755-
version: None,
17561733
};
17571734

17581735
let mut options = GetOptions::default();

object_store/src/local.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -969,7 +969,6 @@ fn convert_metadata(metadata: Metadata, location: Path) -> Result<ObjectMeta> {
969969
last_modified,
970970
size,
971971
e_tag: Some(get_etag(&metadata)),
972-
version: None,
973972
})
974973
}
975974

object_store/src/memory.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ impl ObjectStore for InMemory {
166166
last_modified: entry.last_modified,
167167
size: entry.data.len(),
168168
e_tag: Some(e_tag),
169-
version: None,
170169
};
171170
options.check_preconditions(&meta)?;
172171

@@ -213,7 +212,6 @@ impl ObjectStore for InMemory {
213212
last_modified: entry.last_modified,
214213
size: entry.data.len(),
215214
e_tag: Some(entry.e_tag.to_string()),
216-
version: None,
217215
})
218216
}
219217

@@ -243,7 +241,6 @@ impl ObjectStore for InMemory {
243241
last_modified: value.last_modified,
244242
size: value.data.len(),
245243
e_tag: Some(value.e_tag.to_string()),
246-
version: None,
247244
})
248245
})
249246
.collect();
@@ -288,7 +285,6 @@ impl ObjectStore for InMemory {
288285
last_modified: v.last_modified,
289286
size: v.data.len(),
290287
e_tag: Some(v.e_tag.to_string()),
291-
version: None,
292288
};
293289
objects.push(object);
294290
}

object_store/src/prefix.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ impl<T: ObjectStore> PrefixStore<T> {
7373
size: meta.size,
7474
location: self.strip_prefix(meta.location),
7575
e_tag: meta.e_tag,
76-
version: None,
7776
}
7877
}
7978
}

0 commit comments

Comments
 (0)