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 24 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 114 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 32 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

bool Contains (ReportId report_id)

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

bool Contains (const std::string & program)

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

StorageSize CurrentSize ()

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

StorageSize RemainingSpace ()

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

const std::string & RootDir ()

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

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

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

void Delete (ReportId report_id)

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

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

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

std::vector<ReportId> Reports ()

Defined at line 169 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 188 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 178 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc

const std::string & ReportProgram (ReportId report_id)

The program report |report_id| was filed under.

Defined at line 183 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 193 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 198 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 203 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 211 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 229 of file ../../src/developer/forensics/crash_reports/report_store_metadata.cc