pub struct ServerManager { /* private fields */ }Expand description
Backend process lifecycle manager.
Handles subprocess spawning for llamaserver/llamafile, budget resolution, VRAM tier detection, and health polling.
Implementations§
Source§impl ServerManager
impl ServerManager
Sourcepub fn resolve_budget(
&self,
mode: BudgetMode,
manual_tokens: Option<i64>,
n_slots: Option<i64>,
kv_unified: bool,
) -> Result<i64, BudgetResolutionError>
pub fn resolve_budget( &self, mode: BudgetMode, manual_tokens: Option<i64>, n_slots: Option<i64>, kv_unified: bool, ) -> Result<i64, BudgetResolutionError>
Resolve the context budget based on the given mode.
Sourcepub fn ollama_vram_budget() -> i64
pub fn ollama_vram_budget() -> i64
VRAM tier budget for ollama.
Sourcepub fn query_props_context(&self) -> Result<i64, BudgetResolutionError>
pub fn query_props_context(&self) -> Result<i64, BudgetResolutionError>
Query the backend /props endpoint for the actual context length.
Source§impl ServerManager
impl ServerManager
Sourcepub fn start(
&self,
model: &str,
gguf_path: &Path,
mode: &str,
extra_flags: &[String],
ctx_override: Option<i64>,
cache_type_k: Option<&str>,
cache_type_v: Option<&str>,
n_slots: Option<i64>,
kv_unified: bool,
) -> Result<bool, BackendError>
pub fn start( &self, model: &str, gguf_path: &Path, mode: &str, extra_flags: &[String], ctx_override: Option<i64>, cache_type_k: Option<&str>, cache_type_v: Option<&str>, n_slots: Option<i64>, kv_unified: bool, ) -> Result<bool, BackendError>
Start the backend process. No-op for ollama. For llamaserver/llamafile, spawns a subprocess with the given config. Returns true if a new process was spawned, false if reused.
Sourcepub fn stop(&self) -> Result<(), BackendError>
pub fn stop(&self) -> Result<(), BackendError>
Stop the backend process. For ollama, runs ‘ollama stop’. Waits up to 10s for termination, then forces kill. Sleeps 3s after termination for VRAM clearing.
Trait Implementations§
Source§impl Drop for ServerManager
impl Drop for ServerManager
Auto Trait Implementations§
impl !Freeze for ServerManager
impl RefUnwindSafe for ServerManager
impl Send for ServerManager
impl Sync for ServerManager
impl Unpin for ServerManager
impl UnsafeUnpin for ServerManager
impl UnwindSafe for ServerManager
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
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>
Converts
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>
Converts
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 moreCreates a shared type from an unshared type.