Skip to content

Commit

Permalink
Bump to latest upstream rev
Browse files Browse the repository at this point in the history
  • Loading branch information
kylebarron committed Feb 6, 2025
1 parent d40fedc commit 56c3440
Show file tree
Hide file tree
Showing 6 changed files with 126 additions and 45 deletions.
113 changes: 97 additions & 16 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tokio = "1.40"
url = "2"

[patch.crates-io]
object_store = { git = "https://github.com/apache/arrow-rs", rev = "74499c0e7846cfbc498bf9fd7a2c1a4c8731c897" }
object_store = { git = "https://github.com/apache/arrow-rs", rev = "7a15e4b47ca97df2edef689c9f2ebd2f3888b79e" }

[profile.release]
lto = true
Expand Down
2 changes: 1 addition & 1 deletion obstore/src/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl PyReadableFile {
}

#[getter]
fn size(&self) -> usize {
fn size(&self) -> u64 {
self.meta.size
}

Expand Down
48 changes: 24 additions & 24 deletions obstore/src/get.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ impl From<PyGetOptions> for GetOptions {
#[derive(FromPyObject)]
pub(crate) struct PyOffsetRange {
#[pyo3(item)]
offset: usize,
offset: u64,
}

impl From<PyOffsetRange> for GetRange {
Expand All @@ -85,7 +85,7 @@ impl From<PyOffsetRange> for GetRange {
#[derive(FromPyObject)]
pub(crate) struct PySuffixRange {
#[pyo3(item)]
suffix: usize,
suffix: u64,
}

impl From<PySuffixRange> for GetRange {
Expand All @@ -104,7 +104,7 @@ pub(crate) struct PyGetRange(GetRange);
// - {"suffix": usize} to request the last `n` bytes
impl<'py> FromPyObject<'py> for PyGetRange {
fn extract_bound(ob: &Bound<'py, PyAny>) -> PyResult<Self> {
if let Ok(bounded) = ob.extract::<[usize; 2]>() {
if let Ok(bounded) = ob.extract::<[u64; 2]>() {
Ok(Self(GetRange::Bounded(bounded[0]..bounded[1])))
} else if let Ok(offset_range) = ob.extract::<PyOffsetRange>() {
Ok(Self(offset_range.into()))
Expand Down Expand Up @@ -176,7 +176,7 @@ impl PyGetResult {
}

#[getter]
fn range(&self) -> PyResult<(usize, usize)> {
fn range(&self) -> PyResult<(u64, u64)> {
let inner = self.0.lock().unwrap();
let range = &inner
.as_ref()
Expand Down Expand Up @@ -361,9 +361,9 @@ pub(crate) fn get_range(
py: Python,
store: PyObjectStore,
path: String,
start: usize,
end: Option<usize>,
length: Option<usize>,
start: u64,
end: Option<u64>,
length: Option<u64>,
) -> PyObjectStoreResult<pyo3_bytes::PyBytes> {
let runtime = get_runtime(py)?;
let range = params_to_range(start, end, length)?;
Expand All @@ -379,9 +379,9 @@ pub(crate) fn get_range_async(
py: Python,
store: PyObjectStore,
path: String,
start: usize,
end: Option<usize>,
length: Option<usize>,
start: u64,
end: Option<u64>,
length: Option<u64>,
) -> PyResult<Bound<PyAny>> {
let range = params_to_range(start, end, length)?;
pyo3_async_runtimes::tokio::future_into_py(py, async move {
Expand All @@ -395,10 +395,10 @@ pub(crate) fn get_range_async(
}

fn params_to_range(
start: usize,
end: Option<usize>,
length: Option<usize>,
) -> PyObjectStoreResult<Range<usize>> {
start: u64,
end: Option<u64>,
length: Option<u64>,
) -> PyObjectStoreResult<Range<u64>> {
match (end, length) {
(Some(_), Some(_)) => {
Err(PyValueError::new_err("end and length cannot both be non-None.").into())
Expand All @@ -415,9 +415,9 @@ pub(crate) fn get_ranges(
py: Python,
store: PyObjectStore,
path: String,
starts: Vec<usize>,
ends: Option<Vec<usize>>,
lengths: Option<Vec<usize>>,
starts: Vec<u64>,
ends: Option<Vec<u64>>,
lengths: Option<Vec<u64>>,
) -> PyObjectStoreResult<Vec<pyo3_bytes::PyBytes>> {
let runtime = get_runtime(py)?;
let ranges = params_to_ranges(starts, ends, lengths)?;
Expand All @@ -433,9 +433,9 @@ pub(crate) fn get_ranges_async(
py: Python,
store: PyObjectStore,
path: String,
starts: Vec<usize>,
ends: Option<Vec<usize>>,
lengths: Option<Vec<usize>>,
starts: Vec<u64>,
ends: Option<Vec<u64>>,
lengths: Option<Vec<u64>>,
) -> PyResult<Bound<PyAny>> {
let ranges = params_to_ranges(starts, ends, lengths)?;
pyo3_async_runtimes::tokio::future_into_py(py, async move {
Expand All @@ -452,10 +452,10 @@ pub(crate) fn get_ranges_async(
}

fn params_to_ranges(
starts: Vec<usize>,
ends: Option<Vec<usize>>,
lengths: Option<Vec<usize>>,
) -> PyObjectStoreResult<Vec<Range<usize>>> {
starts: Vec<u64>,
ends: Option<Vec<u64>>,
lengths: Option<Vec<u64>>,
) -> PyObjectStoreResult<Vec<Range<u64>>> {
match (ends, lengths) {
(Some(_), Some(_)) => {
Err(PyValueError::new_err("ends and lengths cannot both be non-None.").into())
Expand Down
2 changes: 1 addition & 1 deletion pyo3-object_store/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tokio = { version = "1.40", features = ["rt-multi-thread"] }
url = "2"

[patch.crates-io]
object_store = { git = "https://github.com/apache/arrow-rs", rev = "74499c0e7846cfbc498bf9fd7a2c1a4c8731c897" }
object_store = { git = "https://github.com/apache/arrow-rs", rev = "7a15e4b47ca97df2edef689c9f2ebd2f3888b79e" }

[lib]
crate-type = ["rlib"]
4 changes: 2 additions & 2 deletions pyo3-object_store/src/prefix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ impl<T: ObjectStore> ObjectStore for MaybePrefixedStore<T> {
self.inner.get(&full_path).await
}

async fn get_range(&self, location: &Path, range: Range<usize>) -> Result<Bytes> {
async fn get_range(&self, location: &Path, range: Range<u64>) -> Result<Bytes> {
let full_path = self.full_path(location);
self.inner.get_range(&full_path, range).await
}
Expand All @@ -154,7 +154,7 @@ impl<T: ObjectStore> ObjectStore for MaybePrefixedStore<T> {
self.inner.get_opts(&full_path, options).await
}

async fn get_ranges(&self, location: &Path, ranges: &[Range<usize>]) -> Result<Vec<Bytes>> {
async fn get_ranges(&self, location: &Path, ranges: &[Range<u64>]) -> Result<Vec<Bytes>> {
let full_path = self.full_path(location);
self.inner.get_ranges(&full_path, ranges).await
}
Expand Down

0 comments on commit 56c3440

Please sign in to comment.