Barretenberg
The ZK-SNARK library at the core of Aztec
Loading...
Searching...
No Matches
bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType > Class Template Reference

#include <content_addressed_cache.hpp>

Classes

struct  Journal
 

Public Types

using LeafType = LeafValueType
 
using IndexedLeafValueType = IndexedLeaf< LeafValueType >
 
using SharedPtr = std::shared_ptr< ContentAddressedCache >
 
using UniquePtr = std::unique_ptr< ContentAddressedCache >
 

Public Member Functions

 ContentAddressedCache ()=delete
 
 ContentAddressedCache (uint32_t depth)
 
 ~ContentAddressedCache ()=default
 
 ContentAddressedCache (const ContentAddressedCache &other)=default
 
ContentAddressedCacheoperator= (const ContentAddressedCache &other)=default
 
 ContentAddressedCache (ContentAddressedCache &&other) noexcept=default
 
ContentAddressedCacheoperator= (ContentAddressedCache &&other) noexcept=default
 
bool operator== (const ContentAddressedCache &other) const =default
 
void checkpoint ()
 
void revert ()
 
void commit ()
 
void revert_all ()
 
void commit_all ()
 
void reset (uint32_t depth)
 
std::pair< bool, index_tfind_low_value (const uint256_t &new_leaf_key, const uint256_t &retrieved_value, const index_t &db_index) const
 
bool get_leaf_preimage_by_hash (const fr &leaf_hash, IndexedLeafValueType &leaf_pre_image) const
 
void put_leaf_preimage_by_hash (const fr &leaf_hash, const IndexedLeafValueType &leaf_pre_image)
 
bool get_leaf_by_index (const index_t &index, IndexedLeafValueType &leaf_pre_image) const
 
void put_leaf_by_index (const index_t &index, const IndexedLeafValueType &leaf_pre_image)
 
void update_leaf_key_index (const index_t &index, const fr &leaf_key)
 
std::optional< index_tget_leaf_key_index (const fr &leaf_key) const
 
void put_node (const fr &node_hash, const NodePayload &node)
 
bool get_node (const fr &node_hash, NodePayload &node) const
 
void put_meta (const TreeMeta &meta)
 
const TreeMetaget_meta () const
 
std::optional< frget_node_by_index (uint32_t level, const index_t &index) const
 
void put_node_by_index (uint32_t level, const index_t &index, const fr &node)
 
const std::map< uint256_t, index_t > & get_indices () const
 
bool is_equivalent_to (const ContentAddressedCache &other) const
 

Private Attributes

std::unordered_map< fr, NodePayloadnodes_
 
std::map< uint256_t, index_tindices_
 
std::unordered_map< fr, IndexedLeafValueTypeleaves_
 
TreeMeta meta_
 
std::vector< std::unordered_map< index_t, fr > > nodes_by_index_
 
std::unordered_map< index_t, IndexedLeafValueTypeleaf_pre_image_by_index_
 
std::vector< Journaljournals_
 

Detailed Description

template<typename LeafValueType>
class bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >

Definition at line 34 of file content_addressed_cache.hpp.

Member Typedef Documentation

◆ IndexedLeafValueType

Definition at line 37 of file content_addressed_cache.hpp.

◆ LeafType

Definition at line 36 of file content_addressed_cache.hpp.

◆ SharedPtr

template<typename LeafValueType >
using bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::SharedPtr = std::shared_ptr<ContentAddressedCache>

Definition at line 38 of file content_addressed_cache.hpp.

◆ UniquePtr

template<typename LeafValueType >
using bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::UniquePtr = std::unique_ptr<ContentAddressedCache>

Definition at line 39 of file content_addressed_cache.hpp.

Constructor & Destructor Documentation

◆ ContentAddressedCache() [1/4]

template<typename LeafValueType >
bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::ContentAddressedCache ( )
delete

◆ ContentAddressedCache() [2/4]

template<typename LeafValueType >
bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::ContentAddressedCache ( uint32_t  depth)

Definition at line 124 of file content_addressed_cache.hpp.

◆ ~ContentAddressedCache()

◆ ContentAddressedCache() [3/4]

template<typename LeafValueType >
bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::ContentAddressedCache ( const ContentAddressedCache< LeafValueType > &  other)
default

◆ ContentAddressedCache() [4/4]

template<typename LeafValueType >
bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::ContentAddressedCache ( ContentAddressedCache< LeafValueType > &&  other)
defaultnoexcept

Member Function Documentation

◆ checkpoint()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::checkpoint ( )

Definition at line 129 of file content_addressed_cache.hpp.

◆ commit()

Definition at line 181 of file content_addressed_cache.hpp.

◆ commit_all()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::commit_all ( )

Definition at line 230 of file content_addressed_cache.hpp.

◆ find_low_value()

template<typename LeafValueType >
std::pair< bool, index_t > bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::find_low_value ( const uint256_t new_leaf_key,
const uint256_t retrieved_value,
const index_t db_index 
) const

Definition at line 301 of file content_addressed_cache.hpp.

◆ get_indices()

template<typename LeafValueType >
const std::map< uint256_t, index_t > & bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_indices ( ) const
inline

Definition at line 79 of file content_addressed_cache.hpp.

◆ get_leaf_by_index()

template<typename LeafValueType >
bool bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_leaf_by_index ( const index_t index,
IndexedLeafValueType leaf_pre_image 
) const

Definition at line 356 of file content_addressed_cache.hpp.

◆ get_leaf_key_index()

template<typename LeafValueType >
std::optional< index_t > bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_leaf_key_index ( const fr leaf_key) const

Definition at line 409 of file content_addressed_cache.hpp.

◆ get_leaf_preimage_by_hash()

template<typename LeafValueType >
bool bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_leaf_preimage_by_hash ( const fr leaf_hash,
IndexedLeafValueType leaf_pre_image 
) const

Definition at line 337 of file content_addressed_cache.hpp.

◆ get_meta()

template<typename LeafValueType >
const TreeMeta & bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_meta ( ) const
inline

Definition at line 74 of file content_addressed_cache.hpp.

◆ get_node()

template<typename LeafValueType >
bool bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_node ( const fr node_hash,
NodePayload node 
) const

Definition at line 425 of file content_addressed_cache.hpp.

◆ get_node_by_index()

template<typename LeafValueType >
std::optional< fr > bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::get_node_by_index ( uint32_t  level,
const index_t index 
) const

Definition at line 436 of file content_addressed_cache.hpp.

◆ is_equivalent_to()

template<typename LeafValueType >
bool bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::is_equivalent_to ( const ContentAddressedCache< LeafValueType > &  other) const

Definition at line 254 of file content_addressed_cache.hpp.

◆ operator=() [1/2]

◆ operator=() [2/2]

◆ operator==()

template<typename LeafValueType >
bool bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::operator== ( const ContentAddressedCache< LeafValueType > &  other) const
default

◆ put_leaf_by_index()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::put_leaf_by_index ( const index_t index,
const IndexedLeafValueType leaf_pre_image 
)

Definition at line 369 of file content_addressed_cache.hpp.

◆ put_leaf_preimage_by_hash()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::put_leaf_preimage_by_hash ( const fr leaf_hash,
const IndexedLeafValueType leaf_pre_image 
)

Definition at line 349 of file content_addressed_cache.hpp.

◆ put_meta()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::put_meta ( const TreeMeta meta)
inline

Definition at line 73 of file content_addressed_cache.hpp.

◆ put_node()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::put_node ( const fr node_hash,
const NodePayload node 
)

Definition at line 419 of file content_addressed_cache.hpp.

◆ put_node_by_index()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::put_node_by_index ( uint32_t  level,
const index_t index,
const fr node 
)

Definition at line 446 of file content_addressed_cache.hpp.

◆ reset()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::reset ( uint32_t  depth)

Definition at line 243 of file content_addressed_cache.hpp.

◆ revert()

Definition at line 134 of file content_addressed_cache.hpp.

◆ revert_all()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::revert_all ( )

Definition at line 237 of file content_addressed_cache.hpp.

◆ update_leaf_key_index()

template<typename LeafValueType >
void bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::update_leaf_key_index ( const index_t index,
const fr leaf_key 
)

Definition at line 397 of file content_addressed_cache.hpp.

Member Data Documentation

◆ indices_

Definition at line 109 of file content_addressed_cache.hpp.

◆ journals_

template<typename LeafValueType >
std::vector<Journal> bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::journals_
private

Definition at line 121 of file content_addressed_cache.hpp.

◆ leaf_pre_image_by_index_

template<typename LeafValueType >
std::unordered_map<index_t, IndexedLeafValueType> bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::leaf_pre_image_by_index_
private

Definition at line 118 of file content_addressed_cache.hpp.

◆ leaves_

template<typename LeafValueType >
std::unordered_map<fr, IndexedLeafValueType> bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::leaves_
private

Definition at line 113 of file content_addressed_cache.hpp.

◆ meta_

◆ nodes_

template<typename LeafValueType >
std::unordered_map<fr, NodePayload> bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::nodes_
private

Definition at line 105 of file content_addressed_cache.hpp.

◆ nodes_by_index_

template<typename LeafValueType >
std::vector<std::unordered_map<index_t, fr> > bb::crypto::merkle_tree::ContentAddressedCache< LeafValueType >::nodes_by_index_
private

Definition at line 117 of file content_addressed_cache.hpp.


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