pstore2
Public Types | Public Member Functions | Static Public Member Functions | List of all members
pstore::repo::fragment Class Reference

Public Types

using member_array = section_sparray< std::uint64_t >
 
using const_iterator = member_array::indices::const_iterator
 

Public Member Functions

bool has_section (section_kind const kind) const noexcept
 Returns true if the fragment contains a section of the kind given by kind, false otherwise. More...
 
std::size_t size () const noexcept
 Return the number of sections in the fragment.
 
member_array const & members () const noexcept
 Returns the array of section offsets.
 
section_kind front () const noexcept
 
const_iterator begin () const noexcept
 
const_iterator end () const noexcept
 
std::size_t size_bytes () const
 Returns the number of bytes of storage that are accupied by this fragment.
 
template<typename Transaction , typename Iterator >
auto alloc (Transaction &transaction, Iterator const first, Iterator const last) -> pstore::extent< fragment >
 
template<typename ReturnType , typename GetOp >
auto load_impl (extent< fragment > const &fext, GetOp get) -> ReturnType
 
Section Access
template<section_kind Key>
auto at () const noexcept -> typename enum_to_section< Key >::type const &
 Returns a const reference to the section data given the section kind. More...
 
template<section_kind Key>
auto at () noexcept -> typename enum_to_section< Key >::type &
 Returns a reference to the section data given the section kind. More...
 
template<section_kind Key>
auto atp () const noexcept -> typename enum_to_section< Key >::type const *
 Returns a pointer to the section data given the section kind or nullptr if the section is not present. More...
 
template<section_kind Key>
auto atp () noexcept -> typename enum_to_section< Key >::type *
 Returns a pointer to the section data given the section kind or nullptr if the section is not present. More...
 

Static Public Member Functions

template<typename Transaction , typename Iterator >
static pstore::extent< fragmentalloc (Transaction &transaction, Iterator first, Iterator last)
 Prepares an instance of a fragment with the collection of sections defined by the iterator range [first, last). More...
 
static std::shared_ptr< fragment const > load (database const &db, extent< fragment > const &location)
 Provides a pointer to an individual fragment instance given a database and a extent describing its address and size. More...
 
static std::shared_ptr< fragmentload (transaction_base &transaction, extent< fragment > const &location)
 Provides a pointer to an individual fragment instance given a transaction and an extent describing its address and size. More...
 
template<typename Iterator >
static std::size_t size_bytes (Iterator first, Iterator last)
 Returns the number of bytes of storage that are required for a fragment containing the sections defined by [first, last). More...
 

Member Function Documentation

◆ alloc()

template<typename Transaction , typename Iterator >
static pstore::extent<fragment> pstore::repo::fragment::alloc ( Transaction &  transaction,
Iterator  first,
Iterator  last 
)
static

Prepares an instance of a fragment with the collection of sections defined by the iterator range [first, last).

Template Parameters
TransactionThe type of the database transaction.
IteratorAn iterator which will yield values of type pstore::repo::section_creation_dispatcher. The values must be sorted in pstore::repo::section_content::kind order.
Parameters
transactionThe transaction to which the fragment should be appended.
firstThe beginning of the range of pstore::repo::section_creation_dispatcher values.
lastThe end of the range of pstore::repo::section_creation_dispatcher values.

◆ at() [1/2]

template<section_kind Key>
auto pstore::repo::fragment::at ( ) const -> typename enum_to_section<Key>::type const &
inlinenoexcept

Returns a const reference to the section data given the section kind.

The section must exist in the fragment.

◆ at() [2/2]

template<section_kind Key>
auto pstore::repo::fragment::at ( ) -> typename enum_to_section<Key>::type &
inlinenoexcept

Returns a reference to the section data given the section kind.

The section must exist in the fragment.

◆ atp() [1/2]

template<section_kind Key>
auto pstore::repo::fragment::atp ( ) const -> typename enum_to_section<Key>::type const *
inlinenoexcept

Returns a pointer to the section data given the section kind or nullptr if the section is not present.

◆ atp() [2/2]

template<section_kind Key>
auto pstore::repo::fragment::atp ( ) -> typename enum_to_section<Key>::type *
inlinenoexcept

Returns a pointer to the section data given the section kind or nullptr if the section is not present.

◆ has_section()

bool pstore::repo::fragment::has_section ( section_kind const  kind) const
inlinenoexcept

Returns true if the fragment contains a section of the kind given by kind, false otherwise.

Parameters
kindThe section kind to check.
Returns
Returns true if the fragment contains a section of the kind given by kind, false otherwise.

◆ load() [1/2]

std::shared_ptr< fragment const > fragment::load ( pstore::database const &  db,
pstore::extent< fragment > const &  location 
)
static

Provides a pointer to an individual fragment instance given a database and a extent describing its address and size.

Parameters
dbThe database from which the fragment is to be read.
locationThe address and size of the fragment data.
Returns
A pointer to the fragment instance.

◆ load() [2/2]

auto pstore::repo::fragment::load ( transaction_base transaction,
pstore::extent< fragment > const &  location 
)
inlinestatic

Provides a pointer to an individual fragment instance given a transaction and an extent describing its address and size.

Parameters
transactionThe transaction from which the fragment is to be read.
locationThe address and size of the fragment data.
Returns
A pointer to the fragment instance.

◆ size_bytes()

template<typename Iterator >
std::size_t pstore::repo::fragment::size_bytes ( Iterator  first,
Iterator  last 
)
static

Returns the number of bytes of storage that are required for a fragment containing the sections defined by [first, last).

Template Parameters
IteratorAn iterator which will yield values of type pstore::repo::section_content. The values must be sorted in pstore::repo::section_content::kind order.
Parameters
firstThe beginning of the range of pstore::repo::section_content values.
lastThe end of the range of pstore::repo::section_content values.

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