CAPIO-CL 1.2.0
CAPIO-CL: Cross Application Programmable I/O - Coordination Language
Loading...
Searching...
No Matches
capiocl::monitor::FileSystemMonitor Class Referencefinal

Monitor implementation that represents commit state using the filesystem. More...

#include <monitor.h>

Inheritance diagram for capiocl::monitor::FileSystemMonitor:
Collaboration diagram for capiocl::monitor::FileSystemMonitor:

Public Member Functions

 FileSystemMonitor ()
 Construct a filesystem-based commit monitor.
 ~FileSystemMonitor () override=default
 Destructor for FileSystemMonitor.
bool isCommitted (const std::filesystem::path &path) const override
 Check whether the given file has been committed.
void setCommitted (const std::filesystem::path &path) const override
 Mark the given file as committed.
void setHomeNode (const std::filesystem::path &path) const override
const std::string & getHomeNode (const std::filesystem::path &path) const override
Public Member Functions inherited from capiocl::monitor::MonitorInterface
virtual ~MonitorInterface ()=default
 Virtual destructor for safe polymorphic deletion.

Additional Inherited Members

Protected Attributes inherited from capiocl::monitor::MonitorInterface
std::mutex committed_lock
 Mutex protecting access to the committed file list.
std::mutex home_node_lock
 Mutex protecting access to the home nodes list.
std::vector< std::string > _committed_files
 List of committed file paths stored as strings.
std::unordered_map< std::string, std::string > _home_nodes
 Lookup table to get home node staring from path. Key = file path; Value = hostname of home node.
char _hostname [HOST_NAME_MAX] = {0}
 hostname of the current instance

Detailed Description

Monitor implementation that represents commit state using the filesystem.

FileSystemMonitor uses token files on disk to record when a file is committed. A committed file <path> is associated with a token file whose name is computed from the path. Existence of the token file implies commit state.

Member Function Documentation

◆ getHomeNode()

const std::string & capiocl::monitor::FileSystemMonitor::getHomeNode ( const std::filesystem::path & path) const
overridevirtual

Get the home node for a given path as reported by the implementation of this interface

Parameters
path
Returns
the home node responsible for the given path

Reimplemented from capiocl::monitor::MonitorInterface.

◆ isCommitted()

bool capiocl::monitor::FileSystemMonitor::isCommitted ( const std::filesystem::path & path) const
overridevirtual

Check whether the given file has been committed.

Parameters
pathPath to the file being queried.
Returns
true if the file is recorded as committed, false otherwise.

Reimplemented from capiocl::monitor::MonitorInterface.

◆ setCommitted()

void capiocl::monitor::FileSystemMonitor::setCommitted ( const std::filesystem::path & path) const
overridevirtual

Mark the given file as committed.

Parameters
pathPath to the file to mark as committed.

Reimplemented from capiocl::monitor::MonitorInterface.

◆ setHomeNode()

void capiocl::monitor::FileSystemMonitor::setHomeNode ( const std::filesystem::path & path) const
overridevirtual

Set the current hostname as the home node for a given path

Parameters
path

Reimplemented from capiocl::monitor::MonitorInterface.


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