Android-cuttlefish cvd tool
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | Friends | List of all members
cuttlefish::BuildArchive Class Reference

#include <build_archive.h>

Public Member Functions

const std::set< std::string, std::less< void > > & Members () const
 
Result< std::string > MemberFilepath (std::string_view member_name, std::optional< std::string_view > extract_dir)
 
Result< std::string > MemberContents (std::string_view name)
 

Static Public Member Functions

static Result< BuildArchiveFromFetcherConfig (const FetcherConfig &, FileSource, std::string_view archive_name)
 
static Result< BuildArchiveFromZip (ReadableZip)
 
static Result< BuildArchiveFromZipPath (const std::string &)
 

Private Member Functions

 BuildArchive (std::optional< FileSource >, std::map< std::string, std::string, std::less< void > >, std::set< std::string, std::less< void > >, std::optional< ReadableZip >)
 

Private Attributes

std::optional< FileSourcesource_
 
std::map< std::string, std::string, std::less< void > > extracted_
 
std::set< std::string, std::less< void > > members_
 
std::optional< ReadableZipzip_file_
 

Friends

PrettyStruct Pretty (const BuildArchive &, PrettyAdlPlaceholder unused)
 

Detailed Description

An archive that was downloaded by cvd fetch or created by a build system runnning locally.

The archive may be partially or completely extracted, and the archive may have been deleted as part of the fetch process, leaving only extracted files.

Constructor & Destructor Documentation

◆ BuildArchive()

cuttlefish::BuildArchive::BuildArchive ( std::optional< FileSource source,
std::map< std::string, std::string, std::less< void > >  extracted,
std::set< std::string, std::less< void > >  members,
std::optional< ReadableZip zip_file 
)
private

Member Function Documentation

◆ FromFetcherConfig()

Result< BuildArchive > cuttlefish::BuildArchive::FromFetcherConfig ( const FetcherConfig fetcher_config,
FileSource  source,
std::string_view  archive_name 
)
static

◆ FromZip()

Result< BuildArchive > cuttlefish::BuildArchive::FromZip ( ReadableZip  zip_file)
static

◆ FromZipPath()

Result< BuildArchive > cuttlefish::BuildArchive::FromZipPath ( const std::string &  path)
static

◆ MemberContents()

Result< std::string > cuttlefish::BuildArchive::MemberContents ( std::string_view  name)

◆ MemberFilepath()

Result< std::string > cuttlefish::BuildArchive::MemberFilepath ( std::string_view  member_name,
std::optional< std::string_view >  extract_dir 
)

Returns the file path to a member of the archive, extracted on the filesystem. If the member is not already extracted and the archive is present, it will extract the file into extract_dir.

Error conditions:

  • The archive does not have a member called member_name.
  • The file needed to be extracted, but extract_dir was not present.
  • There was a failure to extract the file member.

◆ Members()

const std::set< std::string, std::less< void > > & cuttlefish::BuildArchive::Members ( ) const

Returns the filenames of the members held in the archive.

If a subset of the archive members were extracted and the archive was deleted, this may be incomplete.

Friends And Related Function Documentation

◆ Pretty

PrettyStruct Pretty ( const BuildArchive ,
PrettyAdlPlaceholder  unused 
)
friend

Member Data Documentation

◆ extracted_

std::map<std::string, std::string, std::less<void> > cuttlefish::BuildArchive::extracted_
private

◆ members_

std::set<std::string, std::less<void> > cuttlefish::BuildArchive::members_
private

◆ source_

std::optional<FileSource> cuttlefish::BuildArchive::source_
private

◆ zip_file_

std::optional<ReadableZip> cuttlefish::BuildArchive::zip_file_
private

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