4template<FileHandleConcept FileHandleClass>
9 std::ostringstream work_oss;
10 work_oss << m_config_params->get_directory_path();
11 if (work_oss.str().length() > 0) {
14 work_oss << m_operational_environment +
"_" + m_config_params->get_filename_params()->get_file_type_prefix();
15 if (work_oss.str().length() > 0) {
19 work_oss << m_config_params->get_filename_params()->get_run_number_prefix();
20 work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_run_number()) << std::setfill(
'0')
24 work_oss << m_config_params->get_filename_params()->get_file_index_prefix();
25 work_oss << std::setw(m_config_params->get_filename_params()->get_digits_for_file_index()) << std::setfill(
'0')
28 work_oss <<
"_" << m_writer_identifier;
29 work_oss <<
"." << m_file_handle->get_file_name_extension();
30 return work_oss.str();
33template<FileHandleConcept FileHandleClass>
35FileDataStoreImpl<FileHandleClass>::get_free_space(
const std::string& the_path)
const
37 struct statvfs vfs_results;
38 int retval = statvfs(the_path.c_str(), &vfs_results);
42 return vfs_results.f_bsize * vfs_results.f_bavail;
45template<FileHandleConcept FileHandleClass>
47FileDataStoreImpl<FileHandleClass>::throw_if_insufficient_space_for_object(
const size_t obj_size,
48 const std::string& obj_name)
const
51 size_t current_free_space = get_free_space(m_path);
53 if (current_free_space < (m_free_space_safety_factor_for_write * obj_size)) {
54 std::ostringstream msg_oss;
55 msg_oss <<
"a safety factor of " << m_free_space_safety_factor_for_write <<
" times the " << obj_name <<
" size";
56 InsufficientDiskSpace issue(
ERS_HERE,
60 (m_free_space_safety_factor_for_write * obj_size),
63 "writing a " + obj_name +
" to file" + (m_file_handle ?
" " + m_file_handle->get_file_name() :
"");
64 throw RetryableDataStoreProblem(
ERS_HERE, get_name(), msg, issue);
An ERS Issue for DataStore creation failure.