Skip to content

Commit 1ce68c0

Browse files
committed
refactor: PutMultiPartOpts => PutMultiPartOptions (apache#406)
See apache#339. The old name is kept as a deprecated alias for now.
1 parent f422dce commit 1ce68c0

File tree

16 files changed

+55
-48
lines changed

16 files changed

+55
-48
lines changed

src/aws/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ use crate::client::{GetOptionsExt, HttpClient, HttpError, HttpResponse};
3636
use crate::list::{PaginatedListOptions, PaginatedListResult};
3737
use crate::multipart::PartId;
3838
use crate::{
39-
Attribute, Attributes, ClientOptions, GetOptions, MultipartId, Path, PutMultipartOpts,
39+
Attribute, Attributes, ClientOptions, GetOptions, MultipartId, Path, PutMultipartOptions,
4040
PutPayload, PutResult, Result, RetryConfig, TagSet,
4141
};
4242
use async_trait::async_trait;
@@ -631,9 +631,9 @@ impl S3Client {
631631
pub(crate) async fn create_multipart(
632632
&self,
633633
location: &Path,
634-
opts: PutMultipartOpts,
634+
opts: PutMultipartOptions,
635635
) -> Result<MultipartId> {
636-
let PutMultipartOpts {
636+
let PutMultipartOptions {
637637
tags,
638638
attributes,
639639
extensions,

src/aws/mod.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ use crate::signer::Signer;
4545
use crate::util::STRICT_ENCODE_SET;
4646
use crate::{
4747
Error, GetOptions, GetResult, ListResult, MultipartId, MultipartUpload, ObjectMeta,
48-
ObjectStore, Path, PutMode, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result,
48+
ObjectStore, Path, PutMode, PutMultipartOptions, PutOptions, PutPayload, PutResult, Result,
4949
UploadPart,
5050
};
5151

@@ -245,7 +245,7 @@ impl ObjectStore for AmazonS3 {
245245
async fn put_multipart_opts(
246246
&self,
247247
location: &Path,
248-
opts: PutMultipartOpts,
248+
opts: PutMultipartOptions,
249249
) -> Result<Box<dyn MultipartUpload>> {
250250
let upload_id = self.client.create_multipart(location, opts).await?;
251251

@@ -331,7 +331,7 @@ impl ObjectStore for AmazonS3 {
331331
Some(S3CopyIfNotExists::Multipart) => {
332332
let upload_id = self
333333
.client
334-
.create_multipart(to, PutMultipartOpts::default())
334+
.create_multipart(to, PutMultipartOptions::default())
335335
.await?;
336336

337337
let res = async {
@@ -460,7 +460,7 @@ impl MultipartUpload for S3MultiPartUpload {
460460
impl MultipartStore for AmazonS3 {
461461
async fn create_multipart(&self, path: &Path) -> Result<MultipartId> {
462462
self.client
463-
.create_multipart(path, PutMultipartOpts::default())
463+
.create_multipart(path, PutMultipartOptions::default())
464464
.await
465465
}
466466

@@ -536,7 +536,7 @@ mod tests {
536536

537537
let str = "test.bin";
538538
let path = Path::parse(str).unwrap();
539-
let opts = PutMultipartOpts::default();
539+
let opts = PutMultipartOptions::default();
540540
let mut upload = store.put_multipart_opts(&path, opts).await.unwrap();
541541

542542
upload
@@ -567,7 +567,7 @@ mod tests {
567567

568568
let str = "test.bin";
569569
let path = Path::parse(str).unwrap();
570-
let opts = PutMultipartOpts::default();
570+
let opts = PutMultipartOptions::default();
571571
let mut upload = store.put_multipart_opts(&path, opts).await.unwrap();
572572

573573
upload

src/azure/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use crate::multipart::PartId;
2929
use crate::util::{deserialize_rfc1123, GetRange};
3030
use crate::{
3131
Attribute, Attributes, ClientOptions, GetOptions, ListResult, ObjectMeta, Path, PutMode,
32-
PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, RetryConfig, TagSet,
32+
PutMultipartOptions, PutOptions, PutPayload, PutResult, Result, RetryConfig, TagSet,
3333
};
3434
use async_trait::async_trait;
3535
use base64::prelude::{BASE64_STANDARD, BASE64_STANDARD_NO_PAD};
@@ -597,9 +597,9 @@ impl AzureClient {
597597
&self,
598598
path: &Path,
599599
parts: Vec<PartId>,
600-
opts: PutMultipartOpts,
600+
opts: PutMultipartOptions,
601601
) -> Result<PutResult> {
602-
let PutMultipartOpts {
602+
let PutMultipartOptions {
603603
tags,
604604
attributes,
605605
extensions,

src/azure/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ use crate::{
2727
path::Path,
2828
signer::Signer,
2929
GetOptions, GetResult, ListResult, MultipartId, MultipartUpload, ObjectMeta, ObjectStore,
30-
PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, UploadPart,
30+
PutMultipartOptions, PutOptions, PutPayload, PutResult, Result, UploadPart,
3131
};
3232
use async_trait::async_trait;
3333
use futures::stream::{BoxStream, StreamExt, TryStreamExt};
@@ -99,7 +99,7 @@ impl ObjectStore for MicrosoftAzure {
9999
async fn put_multipart_opts(
100100
&self,
101101
location: &Path,
102-
opts: PutMultipartOpts,
102+
opts: PutMultipartOptions,
103103
) -> Result<Box<dyn MultipartUpload>> {
104104
Ok(Box::new(AzureMultiPartUpload {
105105
part_idx: 0,
@@ -221,7 +221,7 @@ impl Signer for MicrosoftAzure {
221221
struct AzureMultiPartUpload {
222222
part_idx: usize,
223223
state: Arc<UploadState>,
224-
opts: PutMultipartOpts,
224+
opts: PutMultipartOptions,
225225
}
226226

227227
#[derive(Debug)]

src/buffered.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
2020
use crate::path::Path;
2121
use crate::{
22-
Attributes, ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayloadMut, TagSet,
22+
Attributes, ObjectMeta, ObjectStore, PutMultipartOptions, PutOptions, PutPayloadMut, TagSet,
2323
WriteMultipart,
2424
};
2525
use bytes::Bytes;
@@ -337,7 +337,7 @@ impl BufWriter {
337337
} else {
338338
let buffer = std::mem::take(b);
339339
let path = std::mem::take(path);
340-
let opts = PutMultipartOpts {
340+
let opts = PutMultipartOptions {
341341
attributes: self.attributes.take().unwrap_or_default(),
342342
tags: self.tags.take().unwrap_or_default(),
343343
extensions: self.extensions.take().unwrap_or_default(),
@@ -397,7 +397,7 @@ impl AsyncWrite for BufWriter {
397397
if b.content_length().saturating_add(buf.len()) >= cap {
398398
let buffer = std::mem::take(b);
399399
let path = std::mem::take(path);
400-
let opts = PutMultipartOpts {
400+
let opts = PutMultipartOptions {
401401
attributes: self.attributes.take().unwrap_or_default(),
402402
tags: self.tags.take().unwrap_or_default(),
403403
extensions: self.extensions.take().unwrap_or_default(),

src/chunked.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ use futures::StreamExt;
2929
use crate::path::Path;
3030
use crate::{
3131
GetOptions, GetResult, GetResultPayload, ListResult, MultipartUpload, ObjectMeta, ObjectStore,
32-
PutMultipartOpts, PutOptions, PutResult,
32+
PutMultipartOptions, PutOptions, PutResult,
3333
};
3434
use crate::{PutPayload, Result};
3535

@@ -78,7 +78,7 @@ impl ObjectStore for ChunkedStore {
7878
async fn put_multipart_opts(
7979
&self,
8080
location: &Path,
81-
opts: PutMultipartOpts,
81+
opts: PutMultipartOptions,
8282
) -> Result<Box<dyn MultipartUpload>> {
8383
self.inner.put_multipart_opts(location, opts).await
8484
}

src/gcp/client.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ use crate::multipart::PartId;
3232
use crate::path::Path;
3333
use crate::util::hex_encode;
3434
use crate::{
35-
Attribute, Attributes, ClientOptions, GetOptions, MultipartId, PutMode, PutMultipartOpts,
35+
Attribute, Attributes, ClientOptions, GetOptions, MultipartId, PutMode, PutMultipartOptions,
3636
PutOptions, PutPayload, PutResult, Result, RetryConfig,
3737
};
3838
use async_trait::async_trait;
@@ -444,9 +444,9 @@ impl GoogleCloudStorageClient {
444444
pub(crate) async fn multipart_initiate(
445445
&self,
446446
path: &Path,
447-
opts: PutMultipartOpts,
447+
opts: PutMultipartOptions,
448448
) -> Result<MultipartId> {
449-
let PutMultipartOpts {
449+
let PutMultipartOptions {
450450
// not supported by GCP
451451
tags: _,
452452
attributes,

src/gcp/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use crate::gcp::credential::GCSAuthorizer;
4242
use crate::signer::Signer;
4343
use crate::{
4444
multipart::PartId, path::Path, GetOptions, GetResult, ListResult, MultipartId, MultipartUpload,
45-
ObjectMeta, ObjectStore, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result,
45+
ObjectMeta, ObjectStore, PutMultipartOptions, PutOptions, PutPayload, PutResult, Result,
4646
UploadPart,
4747
};
4848
use async_trait::async_trait;
@@ -161,7 +161,7 @@ impl ObjectStore for GoogleCloudStorage {
161161
async fn put_multipart_opts(
162162
&self,
163163
location: &Path,
164-
opts: PutMultipartOpts,
164+
opts: PutMultipartOptions,
165165
) -> Result<Box<dyn MultipartUpload>> {
166166
let upload_id = self.client.multipart_initiate(location, opts).await?;
167167

@@ -213,7 +213,7 @@ impl ObjectStore for GoogleCloudStorage {
213213
impl MultipartStore for GoogleCloudStorage {
214214
async fn create_multipart(&self, path: &Path) -> Result<MultipartId> {
215215
self.client
216-
.multipart_initiate(path, PutMultipartOpts::default())
216+
.multipart_initiate(path, PutMultipartOptions::default())
217217
.await
218218
}
219219

src/http/mod.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ use crate::http::client::Client;
4646
use crate::path::Path;
4747
use crate::{
4848
ClientConfigKey, ClientOptions, GetOptions, GetResult, ListResult, MultipartUpload, ObjectMeta,
49-
ObjectStore, PutMode, PutMultipartOpts, PutOptions, PutPayload, PutResult, Result, RetryConfig,
49+
ObjectStore, PutMode, PutMultipartOptions, PutOptions, PutPayload, PutResult, Result,
50+
RetryConfig,
5051
};
5152

5253
mod client;
@@ -122,7 +123,7 @@ impl ObjectStore for HttpStore {
122123
async fn put_multipart_opts(
123124
&self,
124125
_location: &Path,
125-
_opts: PutMultipartOpts,
126+
_opts: PutMultipartOptions,
126127
) -> Result<Box<dyn MultipartUpload>> {
127128
Err(crate::Error::NotImplemented)
128129
}

src/lib.rs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -614,7 +614,7 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
614614
///
615615
/// For more advanced multipart uploads see [`MultipartStore`](multipart::MultipartStore)
616616
async fn put_multipart(&self, location: &Path) -> Result<Box<dyn MultipartUpload>> {
617-
self.put_multipart_opts(location, PutMultipartOpts::default())
617+
self.put_multipart_opts(location, PutMultipartOptions::default())
618618
.await
619619
}
620620

@@ -627,7 +627,7 @@ pub trait ObjectStore: std::fmt::Display + Send + Sync + Debug + 'static {
627627
async fn put_multipart_opts(
628628
&self,
629629
location: &Path,
630-
opts: PutMultipartOpts,
630+
opts: PutMultipartOptions,
631631
) -> Result<Box<dyn MultipartUpload>>;
632632

633633
/// Return the bytes that are stored at the specified location.
@@ -823,7 +823,7 @@ macro_rules! as_ref_impl {
823823
async fn put_multipart_opts(
824824
&self,
825825
location: &Path,
826-
opts: PutMultipartOpts,
826+
opts: PutMultipartOptions,
827827
) -> Result<Box<dyn MultipartUpload>> {
828828
self.as_ref().put_multipart_opts(location, opts).await
829829
}
@@ -1234,9 +1234,14 @@ impl From<Attributes> for PutOptions {
12341234
}
12351235
}
12361236

1237+
// See <https://github.com/apache/arrow-rs-object-store/issues/339>.
1238+
#[doc(hidden)]
1239+
#[deprecated(note = "Use PutMultipartOptions", since = "0.13.0")]
1240+
pub type PutMultipartOpts = PutMultipartOptions;
1241+
12371242
/// Options for [`ObjectStore::put_multipart_opts`]
12381243
#[derive(Debug, Clone, Default)]
1239-
pub struct PutMultipartOpts {
1244+
pub struct PutMultipartOptions {
12401245
/// Provide a [`TagSet`] for this object
12411246
///
12421247
/// Implementations that don't support object tagging should ignore this
@@ -1254,7 +1259,7 @@ pub struct PutMultipartOpts {
12541259
pub extensions: ::http::Extensions,
12551260
}
12561261

1257-
impl PartialEq<Self> for PutMultipartOpts {
1262+
impl PartialEq<Self> for PutMultipartOptions {
12581263
fn eq(&self, other: &Self) -> bool {
12591264
let Self {
12601265
tags,
@@ -1270,9 +1275,9 @@ impl PartialEq<Self> for PutMultipartOpts {
12701275
}
12711276
}
12721277

1273-
impl Eq for PutMultipartOpts {}
1278+
impl Eq for PutMultipartOptions {}
12741279

1275-
impl From<TagSet> for PutMultipartOpts {
1280+
impl From<TagSet> for PutMultipartOptions {
12761281
fn from(tags: TagSet) -> Self {
12771282
Self {
12781283
tags,
@@ -1281,7 +1286,7 @@ impl From<TagSet> for PutMultipartOpts {
12811286
}
12821287
}
12831288

1284-
impl From<Attributes> for PutMultipartOpts {
1289+
impl From<Attributes> for PutMultipartOptions {
12851290
fn from(attributes: Attributes) -> Self {
12861291
Self {
12871292
attributes,

0 commit comments

Comments
 (0)