asanypath-native 2.3.0__tar.gz → 2.3.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -96,7 +96,7 @@ dependencies = [
96
96
 
97
97
  [[package]]
98
98
  name = "asanypath-native"
99
- version = "2.3.0"
99
+ version = "2.3.1"
100
100
  dependencies = [
101
101
  "anyhow",
102
102
  "aws-config",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "asanypath-native"
3
- version = "2.3.0"
3
+ version = "2.3.1"
4
4
  edition = "2024"
5
5
  license = "MIT"
6
6
  publish = false
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: asanypath-native
3
- Version: 2.3.0
3
+ Version: 2.3.1
4
4
  Summary: Native cloud acceleration for asanypath (Rust/tokio/reqwest)
5
5
  License-Expression: MIT
6
6
  Requires-Python: >=3.10
@@ -16,6 +16,7 @@ use futures::future::join_all;
16
16
  use hmac::{Hmac, KeyInit, Mac};
17
17
  use pyo3::exceptions::{PyRuntimeError, PyValueError};
18
18
  use pyo3::prelude::*;
19
+ use pyo3::pybacked::PyBackedBytes;
19
20
  use quick_xml::Reader;
20
21
  use quick_xml::events::Event;
21
22
  use serde::{Deserialize, Serialize};
@@ -956,7 +957,7 @@ pub fn az_put_block<'py>(
956
957
  container: String,
957
958
  blob: String,
958
959
  block_id: String,
959
- data: Vec<u8>,
960
+ data: PyBackedBytes,
960
961
  account_name: String,
961
962
  account_key: Option<String>,
962
963
  sas_token: Option<String>,
@@ -976,9 +977,10 @@ pub fn az_put_block<'py>(
976
977
  let mut headers = vec![("content-length".to_string(), data.len().to_string())];
977
978
  let params = [("blockid", block_id.as_str()), ("comp", "block")];
978
979
  creds.sign("PUT", &url, &mut headers, Some(&params));
979
- let (status, body) = do_request_light("PUT", &url, &headers, Some(Bytes::from(data)), h2)
980
- .await
981
- .map_err(PyRuntimeError::new_err)?;
980
+ let (status, body) =
981
+ do_request_light("PUT", &url, &headers, Some(Bytes::from_owner(data)), h2)
982
+ .await
983
+ .map_err(PyRuntimeError::new_err)?;
982
984
  if !status.is_success() {
983
985
  return Err(status_to_pyerr(status, &creds.error_path(&blob), &body));
984
986
  }
@@ -18,6 +18,7 @@ use futures::future::join_all;
18
18
  use pyo3::exceptions::PyRuntimeError;
19
19
  use pyo3::exceptions::PyValueError;
20
20
  use pyo3::prelude::*;
21
+ use pyo3::pybacked::PyBackedBytes;
21
22
  use serde::{Deserialize, Serialize};
22
23
  use sonic_rs::JsonValueTrait;
23
24
  use std::collections::{HashMap, HashSet};
@@ -995,7 +996,7 @@ pub fn gcs_start_resumable<'py>(
995
996
  pub fn gcs_upload_chunk<'py>(
996
997
  py: Python<'py>,
997
998
  session_uri: String,
998
- data: Vec<u8>,
999
+ data: PyBackedBytes,
999
1000
  offset: u64,
1000
1001
  total: u64,
1001
1002
  use_h2: Option<bool>,
@@ -1011,10 +1012,15 @@ pub fn gcs_upload_chunk<'py>(
1011
1012
  format!("bytes {offset}-{end}/{total}"),
1012
1013
  ),
1013
1014
  ];
1014
- let (status, body, _h) =
1015
- do_request("PUT", &session_uri, &headers, Some(Bytes::from(data)), h2)
1016
- .await
1017
- .map_err(PyRuntimeError::new_err)?;
1015
+ let (status, body, _h) = do_request(
1016
+ "PUT",
1017
+ &session_uri,
1018
+ &headers,
1019
+ Some(Bytes::from_owner(data)),
1020
+ h2,
1021
+ )
1022
+ .await
1023
+ .map_err(PyRuntimeError::new_err)?;
1018
1024
  // 308 Resume Incomplete = intermediate chunk accepted; 2xx = final chunk done.
1019
1025
  if status.as_u16() == 308 || status.is_success() {
1020
1026
  Ok(())
@@ -25,6 +25,7 @@ use bytes::Bytes;
25
25
  use pyo3::exceptions::PyRuntimeError;
26
26
  use pyo3::exceptions::PyValueError;
27
27
  use pyo3::prelude::*;
28
+ use pyo3::pybacked::PyBackedBytes;
28
29
  use quick_xml::Reader;
29
30
  use quick_xml::{XmlVersion, events::Event};
30
31
  use serde::{Deserialize, Serialize};
@@ -1154,7 +1155,7 @@ pub fn s3_upload_part<'py>(
1154
1155
  key: String,
1155
1156
  upload_id: String,
1156
1157
  part_number: u32,
1157
- data: Vec<u8>,
1158
+ data: PyBackedBytes,
1158
1159
  region: String,
1159
1160
  access_key: String,
1160
1161
  secret_key: String,
@@ -1181,7 +1182,7 @@ pub fn s3_upload_part<'py>(
1181
1182
  "PUT",
1182
1183
  &s3_path,
1183
1184
  &query,
1184
- Some(Bytes::from(data)),
1185
+ Some(Bytes::from_owner(data)),
1185
1186
  h2,
1186
1187
  &[],
1187
1188
  )