pub struct FileReadQuery {
pub path: String,
pub start_line: Option<u64>,
pub end_line: Option<u64>,
}Expand description
Query string for GET /v1/fs/file, which is FsQuery plus an optional line
range.
A separate type rather than two more fields on FsQuery, because a line range
means nothing on PUT /v1/fs/file or on either tar route and a shared type would
publish it on all four. mode is absent here for the same reason pointing the
other way: it is a property of a write.
The semantics are the AI SDK harness contract’s, verbatim, because that is the
consumer: 1-based and inclusive on both ends, and an end_line past the
file’s last line reads through EOF without an error. A caller asking for lines
1..1000 of a 12-line file gets the 12 lines and a 200, not a 416.
Fields§
§path: String§start_line: Option<u64>First line to return, 1-based inclusive. Absent means 1.
Zero is refused with 400 rather than treated as 1. A caller who sends 0 is working from a 0-based mental model, and silently reinterpreting it would hand back a window one line off from the one they will compute offsets against.
end_line: Option<u64>Last line to return, 1-based inclusive. Absent means through EOF.
Past the last line is not an error: the read returns through EOF. A range
ending before start_line is refused with 400, because it can only be a
caller who computed one of the two wrong — there is no file for which it is
the right question.
Implementations§
Source§impl FileReadQuery
impl FileReadQuery
Sourcepub fn line_window(&self) -> Result<Option<(u64, Option<u64>)>, String>
pub fn line_window(&self) -> Result<Option<(u64, Option<u64>)>, String>
The requested window as (start_line, end_line), None when no range was asked for,
or why no file could satisfy it.
The one statement of the range rule, read by the daemon before it opens the file and by
the client before it sends the request, so a range the daemon would refuse costs the
client no call and the two can’t disagree on it or on its wording. None must stay
distinguishable from a range that covers the whole file: with no range the daemon
answers the un-sliced stream it always has, byte for byte.
start_line absent is 1 and end_line absent is through EOF, the harness contract’s
defaults. Refused: a start_line of 0, since lines are 1-based, and an end_line before
start_line. An end_line past the last line is not refused; it reads through EOF.
Trait Implementations§
Source§impl Debug for FileReadQuery
impl Debug for FileReadQuery
Source§impl Default for FileReadQuery
impl Default for FileReadQuery
Source§impl<'de> Deserialize<'de> for FileReadQuery
impl<'de> Deserialize<'de> for FileReadQuery
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for FileReadQuery
impl JsonSchema for FileReadQuery
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more