pub struct Agent { /* private fields */ }Expand description
A NIXL agent that can create backends and manage memory
Implementations§
Source§impl Agent
impl Agent
Sourcepub fn new_configured(name: &str, cfg: &AgentConfig) -> Result<Self, NixlError>
pub fn new_configured(name: &str, cfg: &AgentConfig) -> Result<Self, NixlError>
Creates a new agent with the given configuration
Sourcepub fn get_available_plugins(&self) -> Result<StringList, NixlError>
pub fn get_available_plugins(&self) -> Result<StringList, NixlError>
Gets the list of available plugins
Sourcepub fn create_backend(
&self,
plugin: &str,
params: &Params,
) -> Result<Backend, NixlError>
pub fn create_backend( &self, plugin: &str, params: &Params, ) -> Result<Backend, NixlError>
Creates a new backend for the given plugin using the provided parameters
Sourcepub fn get_backend(&self, name: &str) -> Option<Backend>
pub fn get_backend(&self, name: &str) -> Option<Backend>
Gets a backend by name
Sourcepub fn get_backend_params(
&self,
backend: &Backend,
) -> Result<(MemList, Params), NixlError>
pub fn get_backend_params( &self, backend: &Backend, ) -> Result<(MemList, Params), NixlError>
Gets the parameters and memory types for a backend after initialization
Sourcepub fn register_memory(
&self,
descriptor: &impl NixlDescriptor,
opt_args: Option<&OptArgs>,
) -> Result<RegistrationHandle, NixlError>
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 registeropt_args- Optional arguments for the registration
Sourcepub fn query_mem(
&self,
descs: &RegDescList<'_>,
opt_args: Option<&OptArgs>,
) -> Result<QueryResponseList, NixlError>
pub fn query_mem( &self, descs: &RegDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<QueryResponseList, NixlError>
Sourcepub fn get_local_md(&self) -> Result<Vec<u8>, NixlError>
pub fn get_local_md(&self) -> Result<Vec<u8>, NixlError>
Gets the local metadata for this agent as a byte array
Sourcepub fn get_local_partial_md(
&self,
descs: &RegDescList<'_>,
opt_args: Option<&OptArgs>,
) -> Result<Vec<u8>, NixlError>
pub fn get_local_partial_md( &self, descs: &RegDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<Vec<u8>, NixlError>
Sourcepub fn load_remote_md(&self, metadata: &[u8]) -> Result<String, NixlError>
pub fn load_remote_md(&self, metadata: &[u8]) -> Result<String, NixlError>
Loads remote metadata from a byte slice
pub fn make_connection( &self, remote_agent: &str, opt_args: Option<&OptArgs>, ) -> Result<(), NixlError>
pub fn prepare_xfer_dlist( &self, agent_name: &str, descs: &XferDescList<'_>, opt_args: Option<&OptArgs>, ) -> Result<XferDlistHandle, NixlError>
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>
Sourcepub fn check_remote_metadata(
&self,
remote_agent: &str,
descs: Option<&XferDescList<'_>>,
) -> bool
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 checkdescs- 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
Sourcepub fn invalidate_remote_md(&self, remote_agent: &str) -> Result<(), NixlError>
pub fn invalidate_remote_md(&self, remote_agent: &str) -> Result<(), NixlError>
Invalidates a remote metadata for this agent
Sourcepub fn invalidate_all_remotes(&self) -> Result<(), NixlError>
pub fn invalidate_all_remotes(&self) -> Result<(), NixlError>
Invalidates all remote metadata for this agent
Sourcepub fn send_local_md(&self, opt_args: Option<&OptArgs>) -> Result<(), NixlError>
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
Sourcepub fn send_local_partial_md(
&self,
descs: &RegDescList<'_>,
opt_args: Option<&OptArgs>,
) -> Result<(), NixlError>
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 sendopt_args- Optional arguments for sending metadata
Sourcepub fn fetch_remote_md(
&self,
remote_name: &str,
opt_args: Option<&OptArgs>,
) -> Result<(), NixlError>
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 foropt_args- Optional arguments for fetching metadata
Sourcepub fn invalidate_local_md(
&self,
opt_args: Option<&OptArgs>,
) -> Result<(), NixlError>
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
Sourcepub fn send_notification(
&self,
remote_agent: &str,
message: &[u8],
backend: Option<&Backend>,
) -> Result<(), NixlError>
pub fn send_notification( &self, remote_agent: &str, message: &[u8], backend: Option<&Backend>, ) -> Result<(), NixlError>
Sourcepub fn create_xfer_req(
&self,
operation: XferOp,
local_descs: &XferDescList<'_>,
remote_descs: &XferDescList<'_>,
remote_agent: &str,
opt_args: Option<&OptArgs>,
) -> Result<XferRequest, NixlError>
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 listremote_descs- The remote descriptor listremote_agent- The name of the remote agentopt_args- Optional arguments for the transfer
§Returns
A handle to the transfer request
§Errors
Returns a NixlError if the operation fails
Sourcepub fn estimate_xfer_cost(
&self,
req: &XferRequest,
opt_args: Option<&OptArgs>,
) -> Result<(i64, i64, CostMethod), NixlError>
pub fn estimate_xfer_cost( &self, req: &XferRequest, opt_args: Option<&OptArgs>, ) -> Result<(i64, i64, CostMethod), NixlError>
Sourcepub fn post_xfer_req(
&self,
req: &XferRequest,
opt_args: Option<&OptArgs>,
) -> Result<bool, NixlError>
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 fromcreate_xfer_reqopt_args- Optional arguments for the transfer request
§Returns
Ok(false)- If the transfer completed immediatelyOk(true)- If the transfer is in progressErr- If there was an error posting the transfer request
Sourcepub fn get_xfer_status(
&self,
req: &XferRequest,
) -> Result<XferStatus, NixlError>
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 afterpost_xfer_req
Sourcepub fn query_xfer_backend(
&self,
req: &XferRequest,
) -> Result<Backend, NixlError>
pub fn query_xfer_backend( &self, req: &XferRequest, ) -> Result<Backend, NixlError>
Sourcepub fn get_notifications(
&self,
notifs: &mut NotificationMap,
opt_args: Option<&OptArgs>,
) -> Result<(), NixlError>
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 notificationsopt_args- Optional arguments to filter notifications by backend