28 const std::shared_ptr<AbstractMap>& m,
29 std::unique_ptr<untyped::ChangeSet>&&
cs);
33 std::shared_ptr<AbstractMap>
map;
49 std::unique_ptr<PrivateImpl>
pimpl;
56 const std::string& map_name,
57 std::unique_ptr<untyped::ChangeSet>&& change_set,
58 const std::shared_ptr<AbstractMap>& abstract_map);
60 const std::string& map_name, std::unique_ptr<AbstractHandle>&& handle);
63 const std::string& map_name,
bool track_deletes_on_missing_keys);
66 const std::string& map_name);
70 template <
class THandle>
72 const std::string& map_name,
bool track_deletes_on_missing_keys)
75 for (
auto handle : possible_handles)
77 auto typed_handle =
dynamic_cast<THandle*
>(handle);
78 if (typed_handle !=
nullptr)
87 auto& [abstract_map, change_set] = it->second;
89 auto typed_handle =
new THandle(*change_set, map_name);
90 std::unique_ptr<AbstractHandle> abstract_handle(typed_handle);
97 map_name, track_deletes_on_missing_keys);
99 if (change_set ==
nullptr)
104 auto typed_handle =
new THandle(*change_set, map_name);
105 std::unique_ptr<AbstractHandle> abstract_handle(typed_handle);
138 return get_handle_by_name<typename M::Diff>(m.get_name(),
true);
147 typename M::Diff*
diff(
const std::string& map_name)
149 return get_handle_by_name<typename M::Diff>(map_name,
true);
169 typename M::ReadOnlyHandle*
ro(M& m)
174 return get_handle_by_name<typename M::Handle>(m.get_name(),
false);
183 typename M::ReadOnlyHandle*
ro(
const std::string& map_name)
185 return get_handle_by_name<typename M::Handle>(map_name,
false);
203 using ReadOnlyTx::ReadOnlyTx;
212 typename M::Handle*
rw(M& m)
214 return get_handle_by_name<typename M::Handle>(m.get_name(),
false);
223 typename M::Handle*
rw(
const std::string& map_name)
225 return get_handle_by_name<typename M::Handle>(map_name,
false);
233 typename M::WriteOnlyHandle*
wo(M& m)
237 return get_handle_by_name<typename M::Handle>(m.get_name(),
false);
246 typename M::WriteOnlyHandle*
wo(
const std::string& map_name)
248 return get_handle_by_name<typename M::Handle>(map_name,
false);
Definition kv_types.h:680
void compacted_version_conflict(const std::string &map_name)
Definition tx.cpp:118
void retain_change_set(const std::string &map_name, std::unique_ptr< untyped::ChangeSet > &&change_set, const std::shared_ptr< AbstractMap > &abstract_map)
Definition tx.cpp:25
BaseTx(AbstractStore *store_)
Definition tx.cpp:132
THandle * get_handle_by_name(const std::string &map_name, bool track_deletes_on_missing_keys)
Definition tx.h:71
void retain_handle(const std::string &map_name, std::unique_ptr< AbstractHandle > &&handle)
Definition tx.cpp:43
MapChanges get_map_and_change_set_by_name(const std::string &map_name, bool track_deletes_on_missing_keys)
Definition tx.cpp:49
OrderedChanges all_changes
Definition tx.h:51
std::optional< ccf::crypto::Sha256Hash > root_at_read_version
Definition tx.h:53
BaseTx & operator=(BaseTx &&other)=default
std::unique_ptr< PrivateImpl > pimpl
Definition tx.h:49
BaseTx(const BaseTx &that)=delete
std::optional< ccf::crypto::Sha256Hash > get_root_at_read_version()
Definition tx.h:124
std::list< AbstractHandle * > get_possible_handles(const std::string &map_name)
Definition tx.cpp:103
M::ReadOnlyHandle * ro(M &m)
Definition tx.h:169
M::ReadOnlyHandle * ro(const std::string &map_name)
Definition tx.h:183
M::Diff * diff(const std::string &map_name)
Definition tx.h:147
M::Diff * diff(M &m)
Definition tx.h:136
M::Handle * rw(M &m)
Definition tx.h:212
M::WriteOnlyHandle * wo(const std::string &map_name)
Definition tx.h:246
M::WriteOnlyHandle * wo(M &m)
Definition tx.h:233
M::Handle * rw(const std::string &map_name)
Definition tx.h:223
Definition app_interface.h:19
std::map< std::string, MapChanges > OrderedChanges
Definition tx.h:41
std::unique_ptr< untyped::ChangeSet > changeset
Definition tx.h:36
std::shared_ptr< AbstractMap > map
Definition tx.h:33