CCF
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ccf::kv::CommittableTx Class Reference

#include <committable_tx.h>

Inherits ccf::kv::Tx, and ccf::kv::AbstractChangeContainer.

Inherited by ccf::kv::ReservedTx.

Public Types

enum class  TxFlag : TxFlags { LEDGER_CHUNK_AT_NEXT_SIGNATURE = 0x01 , SNAPSHOT_AT_NEXT_SIGNATURE = 0x02 , LEDGER_CHUNK_BEFORE_THIS_TX = 0x04 }
 
using TxFlags = uint8_t
 

Public Member Functions

 CommittableTx (AbstractStore *_store)
 
CommitResult commit (const ccf::ClaimsDigest &claims=ccf::empty_claims(), std::function< std::tuple< Version, Version >(bool has_new_map)> version_resolver=nullptr, std::function< void(const std::vector< uint8_t > &write_set, const std::string &commit_evidence)> write_set_observer=nullptr)
 
Version commit_version ()
 
Version commit_term ()
 
Version get_version ()
 
std::optional< TxIDget_txid ()
 
void set_change_list (OrderedChanges &&change_list_, Term term_) override
 
void set_view (ccf::View view_)
 
void set_req_id (const ccf::kv::TxHistory::RequestID &req_id_)
 
const ccf::kv::TxHistory::RequestIDget_req_id ()
 
void set_read_txid (const TxID &tx_id, Term commit_view_)
 
void set_root_at_read_version (const ccf::crypto::Sha256Hash &r)
 
virtual void set_tx_flag (TxFlag flag)
 
virtual void unset_tx_flag (TxFlag flag)
 
virtual bool tx_flag_enabled (TxFlag f) const
 
- Public Member Functions inherited from ccf::kv::Tx
template<class M >
M::Handle * rw (M &m)
 
template<class M >
M::Handle * rw (const std::string &map_name)
 
template<class M >
M::WriteOnlyHandle * wo (M &m)
 
template<class M >
M::WriteOnlyHandle * wo (const std::string &map_name)
 
- Public Member Functions inherited from ccf::kv::ReadOnlyTx
template<class M >
M::ReadOnlyHandle * ro (M &m)
 
template<class M >
M::ReadOnlyHandle * ro (const std::string &map_name)
 
 BaseTx (AbstractStore *store_)
 
 BaseTx (const BaseTx &that)=delete
 
- Public Member Functions inherited from ccf::kv::BaseTx
 BaseTx (AbstractStore *store_)
 
 BaseTx (const BaseTx &that)=delete
 
BaseTxoperator= (BaseTx &&other)=default
 
virtual ~BaseTx ()
 
std::optional< ccf::crypto::Sha256Hashget_root_at_read_version ()
 
- Public Member Functions inherited from ccf::kv::AbstractChangeContainer
virtual ~AbstractChangeContainer ()=default
 

Protected Member Functions

std::vector< uint8_t > serialise (ccf::crypto::Sha256Hash &commit_evidence_digest, std::string &commit_evidence, const ccf::ClaimsDigest &claims_digest_, bool include_reads=false)
 
- Protected Member Functions inherited from ccf::kv::BaseTx
void retain_change_set (const std::string &map_name, std::unique_ptr< untyped::ChangeSet > &&change_set, const std::shared_ptr< AbstractMap > &abstract_map)
 
void retain_handle (const std::string &map_name, std::unique_ptr< AbstractHandle > &&handle)
 
MapChanges get_map_and_change_set_by_name (const std::string &map_name, bool track_deletes_on_missing_keys)
 
std::list< AbstractHandle * > get_possible_handles (const std::string &map_name)
 
void compacted_version_conflict (const std::string &map_name)
 
template<class THandle >
THandle * get_handle_by_name (const std::string &map_name, bool track_deletes_on_missing_keys)
 

Protected Attributes

bool committed = false
 
bool success = false
 
Version version = NoVersion
 
ccf::kv::TxHistory::RequestID req_id
 
TxFlags flags = 0
 
SerialisedEntryFlags entry_flags = 0
 
- Protected Attributes inherited from ccf::kv::BaseTx
std::unique_ptr< PrivateImplpimpl
 
OrderedChanges all_changes
 
std::optional< ccf::crypto::Sha256Hashroot_at_read_version = std::nullopt
 

Member Typedef Documentation

◆ TxFlags

Member Enumeration Documentation

◆ TxFlag

Enumerator
LEDGER_CHUNK_AT_NEXT_SIGNATURE 
SNAPSHOT_AT_NEXT_SIGNATURE 
LEDGER_CHUNK_BEFORE_THIS_TX 

Constructor & Destructor Documentation

◆ CommittableTx()

ccf::kv::CommittableTx::CommittableTx ( AbstractStore _store)
inline

Member Function Documentation

◆ commit()

CommitResult ccf::kv::CommittableTx::commit ( const ccf::ClaimsDigest claims = ccf::empty_claims(),
std::function< std::tuple< Version, Version >(bool has_new_map)>  version_resolver = nullptr,
std::function< void(const std::vector< uint8_t > &write_set, const std::string &commit_evidence)>  write_set_observer = nullptr 
)
inline

Commit this transaction to the local KV and submit it to consensus for replication

A transaction can either succeed and replicate (ccf::kv::CommitResult::SUCCESS), fail because of a conflict with other transactions (ccf::kv::CommitResult::FAIL_CONFLICT), or succeed locally, but fail to replicate (ccf::kv::CommitResult::FAIL_NO_REPLICATE).

Transactions that fail are rolled back, no matter the reason.

Returns
transaction outcome

◆ commit_term()

Version ccf::kv::CommittableTx::commit_term ( )
inline

Get term in which this transaction was committed.

Throws if this is not successfully committed - should only be called if an earlier call to commit() returned CommitResult::SUCCESS

Returns
Commit term

◆ commit_version()

Version ccf::kv::CommittableTx::commit_version ( )
inline

Get version at which this transaction was committed.

Throws if this is not successfully committed - should only be called if an earlier call to commit() returned CommitResult::SUCCESS

Returns
Commit version

◆ get_req_id()

const ccf::kv::TxHistory::RequestID & ccf::kv::CommittableTx::get_req_id ( )
inline

◆ get_txid()

std::optional< TxID > ccf::kv::CommittableTx::get_txid ( )
inline

◆ get_version()

Version ccf::kv::CommittableTx::get_version ( )
inline

Version for the transaction set

Returns
Committed version, or ccf::kv::NoVersion otherwise

◆ serialise()

std::vector< uint8_t > ccf::kv::CommittableTx::serialise ( ccf::crypto::Sha256Hash commit_evidence_digest,
std::string &  commit_evidence,
const ccf::ClaimsDigest claims_digest_,
bool  include_reads = false 
)
inlineprotected

◆ set_change_list()

void ccf::kv::CommittableTx::set_change_list ( OrderedChanges &&  change_list_,
Term  term_ 
)
inlineoverridevirtual

◆ set_read_txid()

void ccf::kv::CommittableTx::set_read_txid ( const TxID tx_id,
Term  commit_view_ 
)
inline

◆ set_req_id()

void ccf::kv::CommittableTx::set_req_id ( const ccf::kv::TxHistory::RequestID req_id_)
inline

◆ set_root_at_read_version()

void ccf::kv::CommittableTx::set_root_at_read_version ( const ccf::crypto::Sha256Hash r)
inline

◆ set_tx_flag()

virtual void ccf::kv::CommittableTx::set_tx_flag ( TxFlag  flag)
inlinevirtual

◆ set_view()

void ccf::kv::CommittableTx::set_view ( ccf::View  view_)
inline

◆ tx_flag_enabled()

virtual bool ccf::kv::CommittableTx::tx_flag_enabled ( TxFlag  f) const
inlinevirtual

◆ unset_tx_flag()

virtual void ccf::kv::CommittableTx::unset_tx_flag ( TxFlag  flag)
inlinevirtual

Member Data Documentation

◆ committed

bool ccf::kv::CommittableTx::committed = false
protected

◆ entry_flags

SerialisedEntryFlags ccf::kv::CommittableTx::entry_flags = 0
protected

◆ flags

TxFlags ccf::kv::CommittableTx::flags = 0
protected

◆ req_id

ccf::kv::TxHistory::RequestID ccf::kv::CommittableTx::req_id
protected

◆ success

bool ccf::kv::CommittableTx::success = false
protected

◆ version

Version ccf::kv::CommittableTx::version = NoVersion
protected

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