File tree 2 files changed +18
-0
lines changed
src/object_store/src/object/opendal_engine
2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ use opendal::Operator;
18
18
19
19
use super :: { EngineType , OpendalObjectStore } ;
20
20
use crate :: object:: ObjectResult ;
21
+
22
+ /// The fixed number of bytes that is buffered before they are uploaded as a part, will be used in
23
+ /// streaing upload.
24
+ ///
25
+ /// Reference: <https://cloud.google.com/storage/docs/streaming-uploads>
26
+ const GCS_PART_SIZE : usize = 16 * 1024 * 1024 ;
27
+
21
28
impl OpendalObjectStore {
22
29
/// create opendal gcs engine.
23
30
pub fn new_gcs_engine ( bucket : String , root : String ) -> ObjectResult < Self > {
@@ -28,6 +35,8 @@ impl OpendalObjectStore {
28
35
29
36
builder. root ( & root) ;
30
37
38
+ builder. write_fixed_size ( GCS_PART_SIZE ) ;
39
+
31
40
// if credential env is set, use it. Otherwise, ADC will be used.
32
41
let cred = std:: env:: var ( "GOOGLE_APPLICATION_CREDENTIALS" ) ;
33
42
if let Ok ( cred) = cred {
Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ use opendal::Operator;
18
18
19
19
use super :: { EngineType , OpendalObjectStore } ;
20
20
use crate :: object:: ObjectResult ;
21
+
22
+ /// The minimum number of bytes that is buffered before they are uploaded as a part, , will be used
23
+ /// in streaing upload.
24
+ ///
25
+ /// Reference: <https://www.alibabacloud.com/help/en/oss/user-guide/multipart-upload-12>
26
+ const OSS_PART_SIZE : usize = 16 * 1024 * 1024 ;
27
+
21
28
impl OpendalObjectStore {
22
29
/// create opendal oss engine.
23
30
pub fn new_oss_engine ( bucket : String , root : String ) -> ObjectResult < Self > {
@@ -26,6 +33,8 @@ impl OpendalObjectStore {
26
33
27
34
builder. bucket ( & bucket) ;
28
35
36
+ builder. write_min_size ( OSS_PART_SIZE ) ;
37
+
29
38
builder. root ( & root) ;
30
39
31
40
let endpoint = std:: env:: var ( "OSS_ENDPOINT" )
You can’t perform that action at this time.
0 commit comments