Skip to main content

Server

Struct Server 

Source
pub struct Server {
    pub root: PathBuf,
    pub runner: PathBuf,
    pub launch: Launch,
    pub input_dir: PathBuf,
    pub input_store_bytes: u64,
    pub shutdown: AtomicBool,
    /* private fields */
}
Expand description

The MCP server over one node root.

Fields§

§root: PathBuf

The node root.

§runner: PathBuf

The optimization-run executable that every tool calls.

§launch: Launch

How jobs are started.

§input_dir: PathBuf

The directory that relative input files of inline jobs are read from.

§input_store_bytes: u64

Limit of the input store’s total size.

§shutdown: AtomicBool

Set at the end of input; waiting requests stop, jobs keep running.

Implementations§

Source§

impl Server

Source

pub fn cli( &self, args: &[&str], timeout: Duration, ctx: &Ctx, ) -> Result<Value, Fail>

Runs optimization-run --root ROOT ARGS and returns its JSON output, or its coded error. A read stops early when the request is cancelled.

Source

pub fn cli_mutating(&self, args: &[&str]) -> Result<Value, Fail>

Server::cli for commands that change a job: once started they run to their end, even when the request is cancelled (whose response is then dropped), because killing the runner halfway could leave a job half created or half stopped.

Source

pub fn get(&self, id: &str, ctx: &Ctx) -> Result<Value, Fail>

jobs get, with the job ID also under job_id.

Source§

impl Server

Source

pub fn validation_permit(&self, ctx: &Ctx) -> Result<Permit<'_>, Fail>

Waits for a validation place; a cancelled request stops waiting.

Source

pub fn send(&self, message: &Value)

Writes one message as one line; a closed stdout ends the server.

Source

pub fn notify(&self, method: &str, params: Value)

Sends the notification method with params.

Source

pub fn progress( &self, ctx: &Ctx, progress: u64, total: Option<u64>, message: &str, )

Reports progress of total for a request that asked for progress.

Auto Trait Implementations§

§

impl !Freeze for Server

§

impl Forget for Server

§

impl Move for Server

§

impl RefUnwindSafe for Server

§

impl Send for Server

§

impl Sync for Server

§

impl Unpin for Server

§

impl UnsafeUnpin for Server

§

impl UnwindSafe for Server

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.