Agent

Struct Agent 

Source
pub struct Agent { /* private fields */ }
Expand description

A NIXL agent that can create backends and manage memory

Implementations§

Source§

impl Agent

Source

pub fn new(name: &str) -> Result<Self, NixlError>

Creates a new agent with the given name

Source

pub fn new_configured(name: &str, cfg: &AgentConfig) -> Result<Self, NixlError>

Creates a new agent with the given configuration

Source

pub fn name(&self) -> String

Gets the name of the agent

Source

pub fn get_available_plugins(&self) -> Result<StringList, NixlError>

Gets the list of available plugins

Source

pub fn get_plugin_params( &self, plugin_name: &str, ) -> Result<(MemList, Params), NixlError>

Gets the parameters for a plugin

§Arguments
  • plugin_name - The name of the plugin
§Returns

The plugin’s memory list and parameters

§Errors

Returns a NixlError if:

  • The plugin name contains interior nul bytes
  • The operation fails
Source

pub fn create_backend( &self, plugin: &str, params: &Params, ) -> Result<Backend, NixlError>

Creates a new backend for the given plugin using the provided parameters

Source

pub fn get_backend(&self, name: &str) -> Option<Backend>

Gets a backend by name

Source

pub fn get_backend_params( &self, backend: &Backend, ) -> Result<(MemList, Params), NixlError>

Gets the parameters and memory types for a backend after initialization

Source

pub fn register_memory( &self, descriptor: &impl NixlDescriptor, opt_args: Option<&OptArgs>, ) -> Result<RegistrationHandle, NixlError>

Registers a memory descriptor with the agent

§Arguments
  • descriptor - The memory descriptor to register
  • opt_args - Optional arguments for the registration
Source

pub fn query_mem( &self, descs: &RegDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<QueryResponseList, NixlError>

Query information about memory/storage

§Arguments
  • descs - Registration descriptor list to query
  • opt_args - Optional arguments specifying backends
§Returns

A list of query responses, where each response may contain parameters describing the memory/storage characteristics.

Source

pub fn get_local_md(&self) -> Result<Vec<u8>, NixlError>

Gets the local metadata for this agent as a byte array

Source

pub fn get_local_partial_md( &self, descs: &RegDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<Vec<u8>, NixlError>

Gets the local partial metadata as a byte array

§Arguments
  • descs - Registration descriptor list to get metadata for
  • opt_args - Optional arguments for getting metadata
§Returns

A byte array containing the local partial metadata

Source

pub fn load_remote_md(&self, metadata: &[u8]) -> Result<String, NixlError>

Loads remote metadata from a byte slice

Source

pub fn make_connection( &self, remote_agent: &str, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>

Source

pub fn prepare_xfer_dlist( &self, agent_name: &str, descs: &XferDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<XferDlistHandle, NixlError>

Source

pub fn make_xfer_req( &self, operation: XferOp, local_descs: &XferDlistHandle, local_indices: &[i32], remote_descs: &XferDlistHandle, remote_indices: &[i32], opt_args: Option<&OptArgs>, ) -> Result<XferRequest, NixlError>

Source

pub fn check_remote_metadata( &self, remote_agent: &str, descs: Option<&XferDescList<'_>>, ) -> bool

Check if remote metadata for a specific agent is available

This function checks if the metadata for the specified remote agent has been loaded and if specific descriptors can be found in the metadata.

§Arguments
  • remote_agent - Name of the remote agent to check
  • descs - Optional descriptor list to check against the remote metadata. If None, only checks if any metadata exists for the agent.
§Returns

true if the remote agent’s metadata is available (and descriptors are found if provided), false otherwise

Source

pub fn invalidate_remote_md(&self, remote_agent: &str) -> Result<(), NixlError>

Invalidates a remote metadata for this agent

Source

pub fn invalidate_all_remotes(&self) -> Result<(), NixlError>

Invalidates all remote metadata for this agent

Source

pub fn send_local_md(&self, opt_args: Option<&OptArgs>) -> Result<(), NixlError>

Send this agent’s metadata to etcdAdd commentMore actions

This enables other agents to discover this agent’s metadata via etcd.

§Arguments
  • opt_args - Optional arguments for sending metadata
Source

pub fn send_local_partial_md( &self, descs: &RegDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>

Send this agent’s partial metadata

§Arguments
  • descs - Registration descriptor list to send
  • opt_args - Optional arguments for sending metadata
Source

pub fn fetch_remote_md( &self, remote_name: &str, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>

Fetch a remote agent’s metadata from etcd

Once fetched, the metadata will be loaded and cached locally, enabling communication with the remote agent.

§Arguments
  • remote_name - Name of the remote agent to fetch metadata for
  • opt_args - Optional arguments for fetching metadata
Source

pub fn invalidate_local_md( &self, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>

Invalidate this agent’s metadata in etcd

This signals to other agents that this agent’s metadata is no longer valid.

§Arguments
  • opt_args - Optional arguments for invalidating metadata
Source

pub fn send_notification( &self, remote_agent: &str, message: &[u8], backend: Option<&Backend>, ) -> Result<(), NixlError>

Send a notification to a remote agent

§Arguments
  • remote_agent - Name of the remote agent to send notification to
  • message - The notification message to send
  • backend - Optional backend to use for sending the notification
§Returns

Ok(()) if the notification was sent successfully

Source

pub fn create_xfer_req( &self, operation: XferOp, local_descs: &XferDescList<'_>, remote_descs: &XferDescList<'_>, remote_agent: &str, opt_args: Option<&OptArgs>, ) -> Result<XferRequest, NixlError>

Creates a transfer request between local and remote descriptors

§Arguments
  • operation - The transfer operation (read or write)
  • local_descs - The local descriptor list
  • remote_descs - The remote descriptor list
  • remote_agent - The name of the remote agent
  • opt_args - Optional arguments for the transfer
§Returns

A handle to the transfer request

§Errors

Returns a NixlError if the operation fails

Source

pub fn estimate_xfer_cost( &self, req: &XferRequest, opt_args: Option<&OptArgs>, ) -> Result<(i64, i64, CostMethod), NixlError>

Estimates the cost of a transfer request

§Arguments
  • req - Transfer request handle
  • opt_args - Optional arguments for the estimation
§Returns

A tuple containing (duration in microseconds, error margin in microseconds, cost method)

§Errors

Returns a NixlError if the operation fails

Source

pub fn post_xfer_req( &self, req: &XferRequest, opt_args: Option<&OptArgs>, ) -> Result<bool, NixlError>

Posts a transfer request to initiate a transfer

After this, the transfer state can be checked asynchronously until completion. For small transfers that complete within the call, the function returns Ok(false). Otherwise, it returns Ok(true) to indicate the transfer is in progress.

§Arguments
  • req - Transfer request handle obtained from create_xfer_req
  • opt_args - Optional arguments for the transfer request
§Returns
  • Ok(false) - If the transfer completed immediately
  • Ok(true) - If the transfer is in progress
  • Err - If there was an error posting the transfer request
Source

pub fn get_xfer_status( &self, req: &XferRequest, ) -> Result<XferStatus, NixlError>

Checks the status of a transfer request

Returns Ok(true) if the transfer is still in progress, Ok(false) if it completed successfully.

§Arguments
  • req - Transfer request handle after post_xfer_req
Source

pub fn query_xfer_backend( &self, req: &XferRequest, ) -> Result<Backend, NixlError>

Queries the backend for a transfer request

§Arguments
  • req - Transfer request handle after post_xfer_req
§Returns

A handle to the backend used for the transfer

§Errors

Returns a NixlError if the operation fails

Source

pub fn get_notifications( &self, notifs: &mut NotificationMap, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>

Gets notifications from other agents

§Arguments
  • notifs - Notification map to populate with notifications
  • opt_args - Optional arguments to filter notifications by backend

Trait Implementations§

Source§

impl Clone for Agent

Source§

fn clone(&self) -> Agent

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Agent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Agent

§

impl RefUnwindSafe for Agent

§

impl Send for Agent

§

impl Sync for Agent

§

impl Unpin for Agent

§

impl UnwindSafe for Agent

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more