Trait DevicePlugin

Source
pub trait DevicePlugin:
    Send
    + Sync
    + 'static {
    type ListAndWatchStream: Stream<Item = Result<ListAndWatchResponse, Status>> + Send + 'static;

    // Required methods
    fn get_device_plugin_options<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Empty>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<DevicePluginOptions>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn list_and_watch<'life0, 'async_trait>(
        &'life0 self,
        request: Request<Empty>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListAndWatchStream>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn get_preferred_allocation<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PreferredAllocationRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PreferredAllocationResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn allocate<'life0, 'async_trait>(
        &'life0 self,
        request: Request<AllocateRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<AllocateResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn pre_start_container<'life0, 'async_trait>(
        &'life0 self,
        request: Request<PreStartContainerRequest>,
    ) -> Pin<Box<dyn Future<Output = Result<Response<PreStartContainerResponse>, Status>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
}
Expand description

Generated trait containing gRPC methods that should be implemented for use with DevicePluginServer.

Required Associated Types§

Source

type ListAndWatchStream: Stream<Item = Result<ListAndWatchResponse, Status>> + Send + 'static

Server streaming response type for the ListAndWatch method.

Required Methods§

Source

fn get_device_plugin_options<'life0, 'async_trait>( &'life0 self, request: Request<Empty>, ) -> Pin<Box<dyn Future<Output = Result<Response<DevicePluginOptions>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetDevicePluginOptions returns options to be communicated with Device Manager

Source

fn list_and_watch<'life0, 'async_trait>( &'life0 self, request: Request<Empty>, ) -> Pin<Box<dyn Future<Output = Result<Response<Self::ListAndWatchStream>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

ListAndWatch returns a stream of List of Devices Whenever a Device state change or a Device disappears, ListAndWatch returns the new list

Source

fn get_preferred_allocation<'life0, 'async_trait>( &'life0 self, request: Request<PreferredAllocationRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<PreferredAllocationResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

GetPreferredAllocation returns a preferred set of devices to allocate from a list of available ones. The resulting preferred allocation is not guaranteed to be the allocation ultimately performed by the devicemanager. It is only designed to help the devicemanager make a more informed allocation decision when possible.

Source

fn allocate<'life0, 'async_trait>( &'life0 self, request: Request<AllocateRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<AllocateResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Allocate is called during container creation so that the Device Plugin can run device specific operations and instruct Kubelet of the steps to make the Device available in the container

Source

fn pre_start_container<'life0, 'async_trait>( &'life0 self, request: Request<PreStartContainerRequest>, ) -> Pin<Box<dyn Future<Output = Result<Response<PreStartContainerResponse>, Status>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

PreStartContainer is called, if indicated by Device Plugin during registeration phase, before each container start. Device plugin can run device specific operations such as resetting the device before making devices available to the container

Implementors§