class ReportStoreMetadata

Defined at line 23 of file ../../src/developer/forensics/crash_reports/report_store_metadata.h

In-memory metadata about the report store in the filesystem at |report_store_root|.

Note: Clients must use Add and Delete to keep the metadata in sync with the report store in the

filesystem. Use with caution!

Public Methods

void ReportStoreMetadata (std::string report_store_root, StorageSize max_size)

Defined at line 25 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

bool IsDirectoryUsable ()

Returns true if the directory underlying the ReportStoreMetadata can safely be used.

Note: Add and Delete will check-fail if this is false as the underlying directory shouldn't be

manipulated.

Defined at line 122 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

bool RecreateFromAndCleanupFilesystem ()

Recreates the metadata from the report store at |report_store_root_|. If any paths aren't in

the expected format (e.g. the report ID directory name isn't an integer), it will be deleted.

Returns false if the the report store root can't be safely used.

Defined at line 33 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

bool Contains (ReportId report_id)

Defined at line 124 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

bool Contains (const std::string & program)

Defined at line 128 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

StorageSize CurrentSize ()

Defined at line 132 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

StorageSize RemainingSpace ()

Defined at line 134 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::string & RootDir ()

Defined at line 136 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

void Add (ReportId report_id, std::string program_shortname, std::vector<std::string> attachments, StorageSize size)

Defined at line 138 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

void Delete (ReportId report_id)

Defined at line 153 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

std::vector<std::string> Programs ()

Defined at line 168 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

std::vector<ReportId> Reports ()

Defined at line 177 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::string & ProgramDirectory (const std::string & program)

The directory that contains reports for |program|.

Defined at line 196 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::deque<ReportId> & ProgramReports (const std::string & program)

The ReportIds of all reports filed for |program|.

Defined at line 186 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::string & ReportProgramShortname (ReportId report_id)

The program report |report_id| was filed under.

Defined at line 191 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::string & ReportDirectory (ReportId report_id)

The directory that contains the attachments of report |report_id|.

Defined at line 201 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

StorageSize ReportSize (ReportId report_id)

The size of report |report_id|.

Defined at line 206 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

void IncreaseSize (ReportId report_id, StorageSize additional_size)

Increases the size of report |report_id| by |additional_size|.

Defined at line 211 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

std::vector<std::string> ReportAttachments (ReportId report_id, bool absolute_paths)

The attachments for report |report_id|. If |absolute_paths| is true, the absolute path of the

attachments in the filesystem will be returned otherwise the attachment file names will be

returned.

Defined at line 219 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

std::optional<std::string> ReportAttachmentPath (ReportId report_id, const std::string & attachment_name)

Returns the absolute path to |attachment_name| for report |report_id|. Returns std::nullopt if

the attachment doesn't exist.

Defined at line 237 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc