Skip to main content

ControllerHostVTable

Struct ControllerHostVTable 

Source
#[repr(C)]
pub struct ControllerHostVTable { pub abi_version: u32, pub create_plugin_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub start_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub stop_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub exit_market: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub remove_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub instrument_exists: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub log: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, pub clock_now_ns: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>, }
Expand description

Function table the host passes to every controller plug-in instance.

Each service accepts a JSON request envelope and returns a JSON response envelope as OwnedBytes. The producing side owns and frees returned allocations so host and plug-in allocators remain isolated.

Fields§

§abi_version: u32

ABI version of this vtable. Must equal NAUTILUS_PLUGIN_ABI_VERSION.

§create_plugin_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Creates a plug-in strategy through the host’s registered controller.

§start_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Starts a strategy through the host’s system controller command path.

§stop_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Stops a strategy through the host’s system controller command path.

§exit_market: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Exits the market for a strategy through the system controller.

§remove_strategy: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Removes a strategy through the system controller.

§instrument_exists: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Checks whether an instrument is present in the host cache.

§log: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Emits a structured log record through the host logger.

§clock_now_ns: unsafe extern "C" fn(ctx: *const ControllerHostContext, request_json: BorrowedStr<'_>) -> PluginResult<OwnedBytes>

Returns the host clock reading in a JSON response envelope.

Implementations§

Source§

impl ControllerHostVTable

Source

pub fn matches_compiled_abi(&self) -> bool

Asserts that the embedded ABI version matches the compiled-in constant.

Trait Implementations§

Source§

impl Send for ControllerHostVTable

SAFETY: function pointers are thread-safe by construction; the host guarantees the underlying implementations are Sync.

Source§

impl Sync for ControllerHostVTable

SAFETY: see above.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.