pub struct ObjectReader { /* private fields */ }Expand description
What:
A running object reader and the blobs it has already read.
Option<ReaderPipes> is “open pipes or nothing”;
nothing means closed.
Rc<[u8]> is a shared read-only byte list.
Why:
One value owns the process for its whole life,
so the process is always
stopped and collected when the value is dropped.
In TS you’d write (pseudocode):
class ObjectReader { #child: ChildProcess; #pipes?: ReaderPipes; #blobs: Map<ObjectId, Uint8Array> }Implementations§
Source§impl ObjectReader
What:
impl ObjectReader { ... } attaches the read operations,
like class methods.
Why:
Only complete object names and the fixed word HEAD are ever written as
requests,
so no caller text can inject a second request line.
impl ObjectReader
What:
impl ObjectReader { ... } attaches the read operations,
like class methods.
Why:
Only complete object names and the fixed word HEAD are ever written as
requests,
so no caller text can inject a second request line.
In TS you’d write (pseudocode):
class ObjectReader { blob(oid) {} headCommit() {} }Sourcepub fn blob(&mut self, object: &ObjectId) -> Result<Rc<[u8]>, CandidateError>
pub fn blob(&mut self, object: &ObjectId) -> Result<Rc<[u8]>, CandidateError>
What:
The exact bytes of one blob,
read once and shared afterwards.
Rc::clone(..) makes another handle to the same bytes without copying them.
Why:
The same blob often backs several paths and several policies;
each further
use costs neither a request nor a copy.
In TS you’d write (pseudocode):
async blob(oid: ObjectId): Promise<Uint8Array>Sourcepub fn head_commit(&mut self) -> Result<Option<ObjectId>, CandidateError>
pub fn head_commit(&mut self) -> Result<Option<ObjectId>, CandidateError>
What:
The commit HEAD names,
or nothing when the branch has no commit yet.
Option<ObjectId> is “a commit name or nothing”.
Why:
The staged listing compares against this commit.
Asking the running
reader costs no further process.
In TS you’d write (pseudocode):
async headCommit(): Promise<ObjectId | undefined>Trait Implementations§
Source§impl Drop for ObjectReader
What:
impl Drop runs when the value goes out of scope,
like a finally block
attached to the value itself.
Why:
A child that is never waited for stays in the process table as a zombie,
which counts against the process limit of long sessions and containers.
impl Drop for ObjectReader
What:
impl Drop runs when the value goes out of scope,
like a finally block
attached to the value itself.
Why:
A child that is never waited for stays in the process table as a zombie,
which counts against the process limit of long sessions and containers.
In TS you’d write (pseudocode):
[Symbol.dispose]() { this.#pipes = undefined; this.#child.kill(); }Auto Trait Implementations§
impl !Send for ObjectReader
impl !Sync for ObjectReader
impl Freeze for ObjectReader
impl RefUnwindSafe for ObjectReader
impl Unpin for ObjectReader
impl UnsafeUnpin for ObjectReader
impl UnwindSafe for ObjectReader
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more