Title
Enable efficient retrieval of file size from directory_entry
Status
resolved
Section
[fs.op.file.size]
Submitter
Gor Nishanov

Created on 2014-05-22.00:00:00 last changed 100 months ago

Messages

Date: 2016-08-01.17:17:36

Proposed resolution:

In [class.directory_entry] Class directory_entry add the following observer declarations:

      uintmax_t file_size();
      uintmax_t file_size(error_code& ec) noexcept;
    

In directory_entry observers [directory_entry.obs] add the following:

      uintmax_t file_size();
      uintmax_t file_size(error_code& ec) noexcept;
    

Returns: if *this contains a cached file size, return it. Otherwise return file_size(path()) or file_size(path(), ec) respectively.

Throws: As specified in Error reporting (7).

Date: 2016-08-06.20:44:18

[ 2016-08, Beman comments ]

This will be resolved by P0317R1, Directory Entry Caching for Filesystem.

Fri AM: Moved to Tentatively Resolved

Date: 2017-03-19.19:35:20

[ Apr 2016 Issue updated to address the C++ Working Paper. Previously addressed File System TS ]

Previous resolution [SUPERSEDED]

In [fs.class.directory_entry] Class directory_entry add the following observer declarations:

      uintmax_t file_size();
      uintmax_t file_size(error_code& ec) noexcept;
    

In directory_entry observers [fs.dir.entry.obs] add the following:

      uintmax_t file_size();
      uintmax_t file_size(error_code& ec) noexcept;
    

Returns: if *this contains a cached file size, return it. Otherwise return file_size(path()) or file_size(path(), ec) respectively.

Throws: As specified in Error reporting (7).

Date: 2016-04-10.22:23:37

[ Mar 2016 Jacksonville Beman to provide paper about this ]

Date: 2016-01-28.01:00:35

[ 23 Nov 2015 Editorally correct name of data structure mentioned in discussion. ]

Date: 2016-01-28.01:00:35

[ 17 Jun 2014 Rapperswil LWG will investigate issue at a subsequent meeting. ]

Date: 2016-04-10.22:23:37

On Windows, the FindFileData WIN32_FIND_DATA structure, which is the underlying data type for directory_entry, contains the file size as one of the fields. Thus efficient enumeration of files and getting their sizes is possible without doing a separate query for the file size.

History
Date User Action Args
2016-08-06 20:44:18adminsetstatus: new -> resolved
2016-08-01 17:17:36adminsetmessages: + msg8272
2016-04-10 22:23:37adminsetmessages: + msg8037
2016-03-07 04:46:57adminsetmessages: + msg8006
2016-01-28 01:00:35adminsetmessages: + msg7915
2016-01-28 01:00:35adminsetmessages: + msg7914
2016-01-28 01:00:35adminsetmessages: + msg7913
2014-05-22 00:00:00admincreate