|
CCF
|
#include <store.h>
Inherits ccf::kv::AbstractStore, ccf::kv::StoreState, ccf::kv::ExecutionWrapperStore, and ccf::kv::ReadOnlyStore.
Public Member Functions | |
| Store (bool strict_versions_=true, bool is_historical_=false) | |
| Store (const Store &that)=delete | |
| std::shared_ptr< Consensus > | get_consensus () override |
| void | set_consensus (const std::shared_ptr< Consensus > &consensus_) |
| std::shared_ptr< TxHistory > | get_history () override |
| void | set_history (const std::shared_ptr< TxHistory > &history_) |
| std::shared_ptr< ILedgerChunker > | get_chunker () override |
| void | set_chunker (const std::shared_ptr< ILedgerChunker > &chunker_) |
| void | set_encryptor (const EncryptorPtr &encryptor_) |
| EncryptorPtr | get_encryptor () override |
| void | set_snapshotter (const SnapshotterPtr &snapshotter_) |
| std::shared_ptr< AbstractMap > | get_map (ccf::kv::Version v, const std::string &map_name) override |
| std::shared_ptr< AbstractMap > | get_map_unsafe (ccf::kv::Version v, const std::string &map_name) override |
| std::shared_ptr< ccf::kv::untyped::Map > | get_map_internal (ccf::kv::Version v, const std::string &map_name) |
| void | add_dynamic_map (ccf::kv::Version v, const std::shared_ptr< AbstractMap > &map_) override |
| std::unique_ptr< AbstractSnapshot > | snapshot_unsafe_maps (Version v) override |
| void | lock_maps () override |
| void | unlock_maps () override |
| std::vector< uint8_t > | serialise_snapshot (std::unique_ptr< AbstractSnapshot > snapshot) override |
| ApplyResult | deserialise_snapshot (const uint8_t *data, size_t size, ccf::kv::ConsensusHookPtrs &hooks, std::vector< Version > *view_history=nullptr, bool public_only=false) override |
| void | compact (Version v) override |
| void | rollback (const TxID &tx_id, Term term_of_next_version_) override |
| void | initialise_term (Term t) override |
| bool | fill_maps (const std::vector< uint8_t > &data, bool public_only, ccf::kv::Version &v, ccf::kv::Term &view, ccf::kv::EntryFlags &entry_flags, OrderedChanges &changes, MapCollection &new_maps, ccf::ClaimsDigest &claims_digest, std::optional< ccf::crypto::Sha256Hash > &commit_evidence_digest, bool ignore_strict_versions=false) override |
| std::unique_ptr< ccf::kv::AbstractExecutionWrapper > | deserialize (const std::vector< uint8_t > &data, bool public_only=false, const std::optional< TxID > &expected_txid=std::nullopt) override |
| bool | operator== (const Store &that) const |
| Version | current_version () override |
| ccf::TxID | current_txid () override |
| std::pair< TxID, Term > | current_txid_and_commit_term () override |
| Version | compacted_version () override |
| Term | commit_view () override |
| CommitResult | commit (const TxID &txid, std::unique_ptr< PendingTx > pending_tx, bool globally_committable) override |
| bool | should_create_ledger_chunk (Version version) override |
| bool | should_create_ledger_chunk_unsafe (Version version) override |
| void | lock_map_set () override |
| void | unlock_map_set () override |
| bool | check_rollback_count (Version count) override |
| std::tuple< Version, Version > | next_version (bool commit_new_map) override |
| Version | next_version () override |
| TxID | next_txid () override |
| size_t | committable_gap () override |
| void | swap_private_maps (Store &store) |
| void | set_map_hook (const std::string &map_name, const ccf::kv::untyped::Map::MapHook &hook) |
| void | unset_map_hook (const std::string &map_name) |
| void | set_global_hook (const std::string &map_name, const ccf::kv::untyped::Map::CommitHook &hook) |
| void | unset_global_hook (const std::string &map_name) |
| ReadOnlyTx | create_read_only_tx () override |
| std::unique_ptr< ReadOnlyTx > | create_read_only_tx_ptr () override |
| TxDiff | create_tx_diff () override |
| CommittableTx | create_tx () |
| std::unique_ptr< CommittableTx > | create_tx_ptr () |
| ReservedTx | create_reserved_tx (const TxID &tx_id) |
| void | set_flag (StoreFlag f) override |
| void | unset_flag (StoreFlag f) override |
| bool | flag_enabled (StoreFlag f) override |
| void | set_flag_unsafe (StoreFlag f) override |
| void | unset_flag_unsafe (StoreFlag f) override |
| bool | flag_enabled_unsafe (StoreFlag f) const override |
Public Member Functions inherited from ccf::kv::AbstractStore | |
| virtual | ~AbstractStore ()=default |
| virtual std::unique_ptr< AbstractExecutionWrapper > | deserialize (const std::vector< uint8_t > &data, bool public_only=false, const std::optional< ccf::TxID > &expected_txid=std::nullopt)=0 |
Public Member Functions inherited from ccf::kv::StoreState | |
| void | clear () |
Public Member Functions inherited from ccf::kv::ExecutionWrapperStore | |
| virtual | ~ExecutionWrapperStore ()=default |
Public Member Functions inherited from ccf::kv::ReadOnlyStore | |
| virtual | ~ReadOnlyStore ()=default |
Additional Inherited Members | |
Public Types inherited from ccf::kv::AbstractStore | |
| enum class | StoreFlag : uint8_t { SNAPSHOT_AT_NEXT_SIGNATURE = 0x02 } |
Protected Types inherited from ccf::kv::StoreState | |
| using | Maps = std::map< std::string, std::pair< ccf::kv::Version, std::shared_ptr< untyped::Map > > > |
Protected Attributes inherited from ccf::kv::StoreState | |
| ccf::pal::Mutex | maps_lock |
| Maps | maps |
| ccf::pal::Mutex | version_lock |
| std::atomic< Version > | version = 0 |
| Version | last_new_map = ccf::kv::NoVersion |
| std::atomic< Version > | compacted = 0 |
| ccf::pal::Mutex | commit_lock |
| std::atomic< Term > | term_of_next_version = 0 |
| Term | term_of_last_version = 0 |
| Version | last_replicated = 0 |
| Version | last_committable = 0 |
| Version | rollback_count = 0 |
| std::unordered_map< Version, std::tuple< std::unique_ptr< PendingTx >, bool > > | pending_txs |
|
inline |
|
delete |
|
inlineoverridevirtual |
Transfer ownership of a dynamically created map to this Store.
Should be called as part of the commit process, once a transaction is known to be conflict-free and has been assigned a unique Version. This publishes dynamically created Maps so they can be retrieved via get_map in future transactions.
| v | Version at which map is being committed/created |
| map_ | Map to add |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::ReadOnlyStore.
|
inlineoverridevirtual |
Implements ccf::kv::ReadOnlyStore.
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::ReadOnlyStore.
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverride |
|
inlineoverridevirtual |
Implements ccf::kv::ExecutionWrapperStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Get a map by name, iff it exists at the given version.
This means a prior transaction must have created the map, and successfully committed at a version <= v. If this has not happened (the map has never been created, or never been committed, or committed at a later version) this will return nullptr.
| v | Version at which the map must exist |
| map_name | Name of requested map |
Implements ccf::kv::AbstractStore.
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inline |
This is only safe in very restricted circumstances, and is only meant to be used during catastrophic recovery, between a KV with public-state only and a KV with full state, to swap in the private state from the latter into the former.
It's also important to note that swapping in private state may result in previously uncompacted writes becoming effectively compacted, from a user's perspective (they would not be internally compacted until the next compact() however). So it is important to make sure that the private state being swapped in is fully compacted before the swap.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inlineoverridevirtual |
Implements ccf::kv::AbstractStore.
|
inline |
|
inline |