Motion Master 6.0.0-alpha.86
Next-generation motion control software
Loading...
Searching...
No Matches
mm::auto_tuning::Client Class Reference

Talks to one running auto-tuning process. More...

#include <client.h>

Public Member Functions

 Client (std::string baseUrl)
 Binds to a running process.
 
std::expected< mm::net::Response, std::string > run (const std::string &requestBody, std::chrono::seconds timeout=std::chrono::seconds{30}) const
 Runs one function.
 
std::expected< mm::net::Response, std::string > spec () const
 Fetches the program's own OpenAPI document.
 
const std::string & baseUrl () const
 The address this client was built with.
 

Detailed Description

Talks to one running auto-tuning process.

Stateless apart from the address, so all methods are safe to call from any thread. That is what the HTTP routes need: several requests may be in flight, and the program serves them concurrently.

Constructor & Destructor Documentation

◆ Client()

mm::auto_tuning::Client::Client ( std::string  baseUrl)
inlineexplicit

Binds to a running process.

Parameters
baseUrlRoot URL of the program's API, as Process::baseUrl reports it.

Member Function Documentation

◆ baseUrl()

const std::string & mm::auto_tuning::Client::baseUrl ( ) const
inline

The address this client was built with.

◆ run()

std::expected< mm::net::Response, std::string > mm::auto_tuning::Client::run ( const std::string &  requestBody,
std::chrono::seconds  timeout = std::chrono::seconds{30} 
) const

Runs one function.

Parameters
requestBodyA JSON document with run and data. Passed through as text: this class neither builds nor validates it, because the program is the authority on what its functions accept and answers a bad request itself.
timeoutWhole-call limit. The default is far above what any function takes — measured against version 3.1.1, the slowest returns in 0.2 s — so it only fires when the program stops answering.
Returns
The reply, status and body, whatever the status. An error only when the request did not reach the program at all, which for a process on loopback means it died.

◆ spec()

std::expected< mm::net::Response, std::string > mm::auto_tuning::Client::spec ( ) const

Fetches the program's own OpenAPI document.

This is the authority on the request and result shapes. Motion Master's own swagger.yml carries a copy of them, so that its generated clients are typed, and serving this alongside is what makes a drift between the two visible.


The documentation for this class was generated from the following files: