pub struct Child { /* private fields */ }Expand description
A running llama-server, killed on Drop so no orphan outlives us.
Implementations§
Source§impl Child
impl Child
Sourcepub fn spawn(cfg: &Config) -> Result<Self, OcrError>
pub fn spawn(cfg: &Config) -> Result<Self, OcrError>
Spawns llama-server and waits until /health answers.
§Errors
OcrError::WeightsMissing when the GGUFs are absent,
OcrError::BinaryMissing when the binary cannot be found,
OcrError::SpawnFailed when the process will not start, and
OcrError::NotReady when /health never answers in time.
Sourcepub fn idle_expired(&self, now: Instant) -> bool
pub fn idle_expired(&self, now: Instant) -> bool
True when the child has gone unused for longer than the idle timeout.
Sourcepub fn set_busy(&mut self, busy: bool)
pub fn set_busy(&mut self, busy: bool)
Marks the child as actively serving (or having finished) a request.
While true, Child::should_reap always returns false: a request
in flight must never have its child dropped out from under it.
Sourcepub fn should_reap(&self, now: Instant) -> bool
pub fn should_reap(&self, now: Instant) -> bool
True when this child is safe to drop: idle-expired and not currently serving a request.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Child
impl RefUnwindSafe for Child
impl Send for Child
impl Sync for Child
impl Unpin for Child
impl UnsafeUnpin for Child
impl UnwindSafe for Child
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
Mutably borrows from an owned value. Read more