Apache Mesos
Classes | Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
mesos::DiskProfileAdaptor Class Referenceabstract

This module is used by Storage Resource Providers to translate the "profile" field of a Resource::DiskInfo::Source into fields that a Container Storage Interface (CSI) plugin can potentially understand. More...

#include <disk_profile.hpp>

Inheritance diagram for mesos::DiskProfileAdaptor:
mesos::internal::profile::UriDiskProfileAdaptor

Classes

struct  ProfileInfo
 

Public Member Functions

virtual ~DiskProfileAdaptor ()
 
virtual process::Future
< ProfileInfo
translate (const std::string &profile, const std::string &csiPluginInfoType)=0
 Called before a Storage Resource Provider makes an affected CSI request. More...
 
virtual process::Future
< hashset< std::string > > 
watch (const hashset< std::string > &knownProfiles, const std::string &csiPluginInfoType)=0
 Returns a future that will be satisifed iff the set of profiles known by the module differs from the knownProfiles parameter. More...
 

Static Public Member Functions

static Try< DiskProfileAdaptor * > create (const Option< std::string > &name=None())
 Factory method used to create a DiskProfileAdaptor instance. More...
 
static void setAdaptor (const std::shared_ptr< DiskProfileAdaptor > &adaptor)
 Global methods for setting and getting a DiskProfileAdaptor instance. More...
 
static std::shared_ptr
< DiskProfileAdaptor
getAdaptor ()
 

Protected Member Functions

 DiskProfileAdaptor ()
 

Detailed Description

This module is used by Storage Resource Providers to translate the "profile" field of a Resource::DiskInfo::Source into fields that a Container Storage Interface (CSI) plugin can potentially understand.

This affects the following CSI requests:

This module is not intended to interact with any CSI plugins directly.

Documentation for each of the CSI requests can be found at: https://github.com/container-storage-interface/spec/

Constructor & Destructor Documentation

virtual mesos::DiskProfileAdaptor::~DiskProfileAdaptor ( )
inlinevirtual
mesos::DiskProfileAdaptor::DiskProfileAdaptor ( )
inlineprotected

Member Function Documentation

static Try<DiskProfileAdaptor*> mesos::DiskProfileAdaptor::create ( const Option< std::string > &  name = None())
static

Factory method used to create a DiskProfileAdaptor instance.

If the name parameter is provided, the module is instantiated using the ModuleManager. Otherwise, a "default" disk profile adaptor instance (defined in src/resource_provider/disk_profile.cpp) is returned.

NOTE: The lifecycle of the returned object is delegated to the caller.

static std::shared_ptr<DiskProfileAdaptor> mesos::DiskProfileAdaptor::getAdaptor ( )
static
static void mesos::DiskProfileAdaptor::setAdaptor ( const std::shared_ptr< DiskProfileAdaptor > &  adaptor)
static

Global methods for setting and getting a DiskProfileAdaptor instance.

The agent (or test) is expected to create and set the adaptor instance and manage the pointer (this method will only keep a weak pointer). Each component that needs to use the DiskProfileAdaptor, such as the Storage Local Resource Provider, should call getAdaptor.

virtual process::Future<ProfileInfo> mesos::DiskProfileAdaptor::translate ( const std::string &  profile,
const std::string &  csiPluginInfoType 
)
pure virtual

Called before a Storage Resource Provider makes an affected CSI request.

The caller is responsible for copying the returned values into the request object.

This method is expected to return a Failure if a matching "profile" cannot be found or retrieved. The caller should not proceed with any of the affected CSI requests if this method returns a failure.

The csiPluginInfoType parameter is the CSIPluginInfo::type field found inside ResourceProviderInfo::storage. This module may choose to filter results based on the type of CSI plugin.

NOTE: This module assumes that profiles are immutable after creation. Changing the VolumeCapability or Parameters of a profile after creation may result in undefined behavior from the SLRP or CSI plugins.

Implemented in mesos::internal::profile::UriDiskProfileAdaptor.

virtual process::Future<hashset<std::string> > mesos::DiskProfileAdaptor::watch ( const hashset< std::string > &  knownProfiles,
const std::string &  csiPluginInfoType 
)
pure virtual

Returns a future that will be satisifed iff the set of profiles known by the module differs from the knownProfiles parameter.

The csiPluginInfoType parameter is the CSIPluginInfo::type field found inside ResourceProviderInfo::storage. This module may choose to filter results based on the type of CSI plugin.

NOTE: It is highly recommended for the module to insert a random delay between discovering a different set of profiles and satisfying this future, because the SLRP is expected to update the set of offered resources based on this future. Adding a random delay may prevent a thundering herd of resource updates to the Mesos master.

Implemented in mesos::internal::profile::UriDiskProfileAdaptor.


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