ifw-daq  3.0.0-pre2
IFW Data Acquisition modules
Public Member Functions | List of all members
daq::dpm::WorkspaceImpl Class Referencefinal

Implementation of daq::dpm::Workspace. More...

#include <workspace.hpp>

+ Inheritance diagram for daq::dpm::WorkspaceImpl:

Public Member Functions

 WorkspaceImpl (std::filesystem::path root)
 Opens or creates workspace in the specified location, using that as a root. More...
 
auto GetPath () const -> std::filesystem::path override
 
auto EnumerateDaqs () const -> std::vector< std::string > override
 Enumerates in-progress DAQs by querying file system. More...
 
auto InitializeDaq (std::string const &daq_id) -> std::unique_ptr< DaqWorkspace > override
 Initializes new DAQ Workspace. More...
 
auto LoadDaq (std::string const &daq_id) -> std::unique_ptr< DaqWorkspace > override
 Loads a previously initialized DAQ workspace. More...
 
void RemoveDaq (std::string const &daq_id) override
 Removes workspace and all containing files for DAQ without archiving it. More...
 
auto ArchiveDaq (std::string const &daq_id) -> std::filesystem::path override
 Archives specified DAQ witout deleting any files, typically by moving it to a specific location in the workspace. More...
 
auto LoadQueue () const -> std::vector< std::string > override
 
void StoreQueue (std::vector< std::string > const &queue) const override
 
virtual auto QueryStorageStatus () const -> std::filesystem::space_info override
 Queries available storage for workspace. More...
 
- Public Member Functions inherited from daq::dpm::Workspace
virtual ~Workspace ()
 

Detailed Description

Implementation of daq::dpm::Workspace.

Definition at line 175 of file workspace.hpp.

Constructor & Destructor Documentation

◆ WorkspaceImpl()

daq::dpm::WorkspaceImpl::WorkspaceImpl ( std::filesystem::path  root)

Opens or creates workspace in the specified location, using that as a root.

If directory does not exist it will attempt to create it, including intermeditate parent directories and basic workspace structure:

  • <root>/in-progress/
  • <root>/archive/

If directories exist the necessary permissions for current user (rwx) is checked.

Exceptions
std::invalid_argumentif root exist and is not a directory.
std::system_errorwith permission denied if directories cannot be created or have the wrong permissions if they already exist.

Member Function Documentation

◆ ArchiveDaq()

auto daq::dpm::WorkspaceImpl::ArchiveDaq ( std::string const &  daq_id) -> std::filesystem::path
overridevirtual

Archives specified DAQ witout deleting any files, typically by moving it to a specific location in the workspace.

Note
Once archived OCM/DPM the ID is essentially reusable. This means that archiving duplicate IDs must be foreseen.
Returns
Absolute path to the relocated daq workspace directory.

Implements daq::dpm::Workspace.

Definition at line 167 of file workspace.cpp.

◆ EnumerateDaqs()

auto daq::dpm::WorkspaceImpl::EnumerateDaqs ( ) const -> std::vector<std::string>
overridevirtual

Enumerates in-progress DAQs by querying file system.

Returns
vector of data acquisition ids (or more accurately the directory).

Implements daq::dpm::Workspace.

Definition at line 145 of file workspace.cpp.

◆ GetPath()

auto daq::dpm::WorkspaceImpl::GetPath ( ) const -> std::filesystem::path
inlineoverridevirtual
Returns
Absolute path to workspace.

Implements daq::dpm::Workspace.

Definition at line 194 of file workspace.hpp.

◆ InitializeDaq()

auto daq::dpm::WorkspaceImpl::InitializeDaq ( std::string const &  daq_id) -> std::unique_ptr< DaqWorkspace >
overridevirtual

Initializes new DAQ Workspace.

Creates a private workspace for DAQ merging.

If workspace creation fails rollback of changes to filesystem will be attempted (deleting files and directories just created).

Note
This does not imply that DAQ is scheduled for merging, only that the workspace is initialized to an empty state.
Parameters
daq_idData Acquisition Id.

Implements daq::dpm::Workspace.

Definition at line 153 of file workspace.cpp.

◆ LoadDaq()

auto daq::dpm::WorkspaceImpl::LoadDaq ( std::string const &  daq_id) -> std::unique_ptr< DaqWorkspace >
overridevirtual

Loads a previously initialized DAQ workspace.

Parameters
daq_idData Acquisition Id.

Implements daq::dpm::Workspace.

Definition at line 158 of file workspace.cpp.

◆ LoadQueue()

auto daq::dpm::WorkspaceImpl::LoadQueue ( ) const -> std::vector<std::string>
overridevirtual

Implements daq::dpm::Workspace.

Definition at line 184 of file workspace.cpp.

◆ QueryStorageStatus()

fs::space_info daq::dpm::WorkspaceImpl::QueryStorageStatus ( ) const -> std::filesystem::space_info
overridevirtual

Queries available storage for workspace.

@thread_safe

Implements daq::dpm::Workspace.

Definition at line 149 of file workspace.cpp.

◆ RemoveDaq()

void daq::dpm::WorkspaceImpl::RemoveDaq ( std::string const &  daq_id)
overridevirtual

Removes workspace and all containing files for DAQ without archiving it.

Workspace is e.g. removed either if user aborts a Data Acquisition or to roll back failed initialization of a workspace.

Parameters
daq_idData Acquisition id.

Implements daq::dpm::Workspace.

Definition at line 163 of file workspace.cpp.

◆ StoreQueue()

void daq::dpm::WorkspaceImpl::StoreQueue ( std::vector< std::string > const &  queue) const
overridevirtual

Implements daq::dpm::Workspace.

Definition at line 196 of file workspace.cpp.


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