Pixie
Loading...
Searching...
No Matches
pixie::FileArchiveIndex< Storage > Class Template Reference

Storage-backed byte-oriented file archive. More...

#include <file_archive.h>

Inheritance diagram for pixie::FileArchiveIndex< Storage >:
pixie::FileArchiveBase< FileArchiveIndex< Storage > > pixie::SerializationBase< FileArchiveIndex< Storage > >

Public Member Functions

 FileArchiveIndex (const FileArchiveIndex &)=default
 Owning archives are move-only; archive views are copyable.
 
FileArchiveIndexoperator= (const FileArchiveIndex &)=default
 
 FileArchiveIndex (const FileArchiveIndex &)=delete
 
FileArchiveIndexoperator= (const FileArchiveIndex &)=delete
 
 FileArchiveIndex (FileArchiveIndex &&) noexcept=default
 
FileArchiveIndexoperator= (FileArchiveIndex &&) noexcept=default
 
 FileArchiveIndex (std::vector< FileArchiveSource > sources, WaveletTreeBuildType build_type=WaveletTreeBuildType::Huffman)
 Construct an archive from file and symlink sources.
 
template<class ReadSource>
requires (std::same_as<Storage, AlignedStorage>)
 FileArchiveIndex (std::vector< FileArchiveSourceMetadata > sources, ReadSource &&read_source, WaveletTreeBuildType build_type=WaveletTreeBuildType::Huffman)
 Construct from metadata and a replayable chunk reader.
 
void serialize_impl (BinaryWriter &writer) const
 Serialize one native, framed Pixie file archive.
 
- Public Member Functions inherited from pixie::FileArchiveBase< FileArchiveIndex< Storage > >
std::size_t size () const
 Return the number of archived entries.
 
bool empty () const
 Return whether the archive has no entries.
 
std::size_t logical_size_bytes () const
 Return the number of logical content bytes, excluding framing.
 
WaveletTreeBuildType build_type () const
 Return the wavelet-tree construction strategy.
 
std::size_t file_table_bytes () const
 Return serialized fixed-record bytes.
 
std::size_t path_storage_bytes () const
 Return serialized path-blob bytes.
 
std::size_t metadata_bytes () const
 Return framing, file-table, path, and alignment bytes.
 
std::optional< std::size_t > find (std::string_view path) const
 Find an exact archive-relative path.
 
FileArchiveEntry entry (std::size_t index) const
 Return metadata for an entry.
 
std::vector< std::byte > extract (std::size_t index) const
 Reconstruct the complete byte content of one entry.
 
std::vector< std::byte > extract_lines (std::size_t index, std::size_t left, std::size_t right) const
 Reconstruct zero-based half-open line range [left, right).
 
- Public Member Functions inherited from pixie::SerializationBase< FileArchiveIndex< Storage > >
void serialize (BinaryWriter &writer) const
 Serialize this value through its concrete implementation.
 

Static Public Member Functions

static FileArchiveIndex deserialize_impl (BinaryReader &reader, DeserializationValidation validation=DeserializationValidation::kQuick)
 Deserialize one framed archive using this specialization's storage.
 
- Static Public Member Functions inherited from pixie::FileArchiveBase< FileArchiveIndex< Storage > >
static constexpr std::uint32_t format_version ()
 Return the serialized file-archive format version.
 
- Static Public Member Functions inherited from pixie::SerializationBase< FileArchiveIndex< Storage > >
static FileArchiveIndex< Storage > deserialize (BinaryReader &reader, Context &&... context)
 Restore exactly Derived and advance reader on success.
 
static FileArchiveIndex< Storage > deserialize (std::span< const std::byte > &data, Context &&... context)
 Restore exactly Derived and advance a mutable byte span.
 

Friends

class FileArchiveBase< FileArchiveIndex >
 Permit the facade to use the documented extension points.
 

Detailed Description

template<StorageImplementation Storage>
class pixie::FileArchiveIndex< Storage >

Storage-backed byte-oriented file archive.

Template Parameters
StorageOwning aligned storage or a non-owning read-only view.

Constructor & Destructor Documentation

◆ FileArchiveIndex() [1/3]

template<StorageImplementation Storage>
pixie::FileArchiveIndex< Storage >::FileArchiveIndex ( const FileArchiveIndex< Storage > & )
default

Owning archives are move-only; archive views are copyable.

Internal rank indexes retain views into their wavelet-node bit storage, so copying without rebuilding those indexes would leave views bound to the source archive.

◆ FileArchiveIndex() [2/3]

template<StorageImplementation Storage>
pixie::FileArchiveIndex< Storage >::FileArchiveIndex ( std::vector< FileArchiveSource > sources,
WaveletTreeBuildType build_type = WaveletTreeBuildType::Huffman )
inlineexplicit

Construct an archive from file and symlink sources.

Sources are sorted by path. Paths must be non-empty, unique, valid UTF-8 strings. Content is preserved byte-for-byte.

◆ FileArchiveIndex() [3/3]

template<StorageImplementation Storage>
template<class ReadSource>
requires (std::same_as<Storage, AlignedStorage>)
pixie::FileArchiveIndex< Storage >::FileArchiveIndex ( std::vector< FileArchiveSourceMetadata > sources,
ReadSource && read_source,
WaveletTreeBuildType build_type = WaveletTreeBuildType::Huffman )
inline

Construct from metadata and a replayable chunk reader.

The reader is called twice per source in sorted path order. It receives (const FileArchiveSourceMetadata&, consumer) and must pass the same immutable content to consumer as byte spans on both calls. The first pass derives metadata and symbol counts; the second constructs the tree without retaining complete source contents.

Exceptions
std::invalid_argumentfor invalid metadata or changed content.

Member Function Documentation

◆ deserialize_impl()

template<StorageImplementation Storage>
static FileArchiveIndex pixie::FileArchiveIndex< Storage >::deserialize_impl ( BinaryReader & reader,
DeserializationValidation validation = DeserializationValidation::kQuick )
inlinestatic

Deserialize one framed archive using this specialization's storage.

Owners copy paths and all wavelet-tree storage. Views retain slices of the reader's backing bytes, which must outlive the result.


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