chitralverma commented on PR #9377:
URL: https://github.com/apache/opendal/pull/9377#issuecomment-7256514069

   (AI-generated reply) Re [your 
review](https://github.com/apache/opendal/pull/9377#pullrequestreview-6102976384):
 both points are addressed in e0e8c133ec60a1c2e75e843b223675fd9e90e676, the 
head, which follows a merge of main at `c275bf8dd` (with #9375).
   
   1. **Short-file sentence.** The `size` doc now reads:
   
      > A `size` of `0` validates the other options, then returns empty bytes 
without accessing storage. When `size` is positive, a file that ends before 
`offset` plus `size` fails the read.
   
      The class summary renders core's "A read with a zero limit or an empty 
range validates" as "A read with `size=0` validates", and "an empty buffer" as 
"empty bytes". On a build of this head, a 6-byte file with `offset=7, size=0` 
returns `b''` through `read` and through a file from `open`, sync and async, on 
memory, fs, and Silo S3. With `offset=7, size=1` the read raises 
`RangeNotSatisfied` (`OSError` from an opened file), and with `offset=4, 
size=4` it raises `Unexpected` (`OSError` from an opened file).
   
   2. **Seeking from the end.** `OpenKwargs` now says the deferred errors raise 
`OSError` "from the file's read methods, or from `seek()` when seeking from the 
end needs the file's size", and the `OSError` entry of both `open` methods says 
the same. On the same build, sync and async, on memory, fs, and Silo: opening a 
missing path with default options or with only `offset` succeeds and `seek(0, 
2)` raises `OSError`, while the sync file's `seek(0, 0)` returns `0`. With 
`size=4`, `seek(0, 2)` returns `4`. With a positive `chunk` and no `size`, 
`open` raises `opendal.exceptions.NotFound` itself. On fs and Silo, a failing 
condition behaves the same way on `seek(0, 2)`.
   
   The same fixup also follows #9375 for the Python wording of its new `chunk` 
paragraph: "A read with a positive `chunk` and no `size` first stats the file 
to learn its length", without `content_length_hint`, which Python does not 
expose. On fs, `read("f", chunk=2, if_modified_since=...)` raises `Unsupported` 
from `stat`, also with `prefetch=1` and through `open`, while the same read 
with `size=4` or `chunk=0` succeeds. Generation fails if core no longer 
contains the text these rewrites replace.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to