12 #include <type_traits> 60 return std::make_unique<RawObject>();
69 #if defined(_PERFORMANCE_DEBUG) || !defined(NDEBUG) 78 #if defined(_PERFORMANCE_DEBUG) || !defined(NDEBUG) 99 uint64_t next_timestamp_us = 0;
163 return *user_object_ptr &&
true;
184 auto p2p_send(
node_id_t dest_node, Args&&... args);
196 auto ordered_send(Args&&... args);
203 void send(
unsigned long long int payload_size,
const std::function<
void(
char* buf)>& msg_generator);
209 std::size_t object_size()
const;
218 void send_object(
tcp::socket& receiver_socket)
const;
228 void send_object_raw(
tcp::socket& receiver_socket)
const;
238 std::size_t receive_object(
char* buffer);
240 const uint64_t compute_global_stability_frontier();
244 HLC hlc(this->compute_global_stability_frontier() / 1e3, 0);
274 persistent_registry_ptr->
trim(earliest_version);
284 persistent_registry_ptr->
truncate(latest_version);
291 next_version = version;
292 next_timestamp_us = ts_us;
299 return std::tie(next_version,next_timestamp_us);
314 this->persistent_registry_ptr->
registerPersist(object_name, vf, pf, tf, gf, tcf);
318 template <
typename T>
346 auto p2p_send(
node_id_t dest_node, Args&&... args);
351 template <
typename T>
360 shard_reps(shard_reps) {}
362 auto p2p_send(Args&&... args);
uint32_t subgroup_id_t
Type alias for the internal Subgroup IDs generated by ViewManager.
const uint32_t shard_num
The index, within the subgroup, of the shard that replicates this object.
partial_wrapped< Tag, Ret, NewClass, Args... > tag(Ret(NewClass::*fun)(Args...))
User-facing entry point for the series of functions that binds a FunctionTag to a class's member func...
unsigned long long FunctionTag
ShardIterator(ExternalCaller< T > &EC, std::vector< node_id_t > shard_reps)
void trim(const int64_t &earliest_version) noexcept(false)
Trims the log of all versions earlier than the argument.
uint32_t subgroup_type_id_t
Type of the numeric ID used to refer to subgroup types within a Group; this is currently computed as ...
virtual void truncate(const persistent::version_t &latest_version)
Truncate the logs of all Persistent<T> members back to the version specified.
const subgroup_id_t subgroup_id
The internally-generated subgroup ID of the subgroup that replicates this object. ...
virtual void make_version(const persistent::version_t &ver, const HLC &hlc) noexcept(false)
make a version for all the persistent<T> members.
std::is_base_of< PersistsFields, T > has_persistent_fields
A template whose member field "value" will be true if type T inherits from PersistsFields, and false otherwise.
std::function< void(const version_t &, const HLC &)> VersionFunc
const node_id_t node_id
The ID of this node.
std::unique_ptr< rpc::RemoteInvokerFor< T > > wrapped_this
The actual implementation of ExternalCaller, which has lots of ugly template parameters.
subgroup_id_t subgroup_id
The internally-generated subgroup ID of the subgroup that this ExternalCaller will contact...
uint32_t get_shard_num() const
std::function< const version_t(void)> PersistFunc
bool send(uint16_t group_number, std::shared_ptr< rdma::memory_region > mr, size_t offset, size_t length) __attribute__((warn_unused_result))
std::unique_ptr< persistent::PersistentRegistry > persistent_registry_ptr
persistent registry for persistent<t>
const uint32_t subgroup_index
void truncate(const int64_t &last_version)
Truncates the log, deleting all versions newer than the provided argument.
virtual bool is_persistent() const
virtual void trim(const persistent::version_t &earliest_version) noexcept(false)
trim the logs to a version, inclusively.
rpc::RPCManager & group_rpc_manager
Reference to the RPCManager for the Group this Replicated is in.
std::unique_ptr< RawObject > raw_object_factory(persistent::PersistentRegistry *)
An implementation of Factory<T> for RawObject, which is trivial because RawObjects have no state...
Common interface for all types of Replicated<T>, specifying some methods for state transfer and persi...
virtual void register_persistent_member(const char *object_name, const persistent::VersionFunc &vf, const persistent::PersistFunc &pf, const persistent::TrimFunc &tf, const persistent::LatestPersistedGetterFunc &gf, persistent::TruncateFunc tcf) noexcept(false)
Register a persistent member.
std::function< std::unique_ptr< T >(persistent::PersistentRegistry *)> Factory
The type of factory function the user must provide to the Group constructor, to construct each Replic...
void makeVersion(const int64_t &ver, const HLC &mhlc) noexcept(false)
Make a new version capturing the current state of the object.
This is a marker interface for user-defined Replicated Objects (i.e.
std::function< void(const int64_t &)> TruncateFunc
virtual std::tuple< persistent::version_t, uint64_t > get_next_version()
Get the next version to be handled.
std::function< void(const version_t &)> TrimFunc
uint32_t node_id_t
Type alias for Node IDs in a Derecho group.
std::unique_ptr< rpc::RemoteInvocableOf< T > > wrapped_this
The actual implementation of Replicated<T>, hiding its ugly template parameters.
std::function< const version_t(void)> LatestPersistedGetterFunc
An empty class to be used as the "replicated type" for a subgroup that doesn't implement a Replicated...
std::unique_ptr< std::unique_ptr< T > > user_object_ptr
The user-provided state object with some RPC methods.
void registerPersist(const char *obj_name, const VersionFunc &vf, const PersistFunc &pf, const TrimFunc &tf, const LatestPersistedGetterFunc &lpgf, const TruncateFunc &tcf) noexcept(false)
set the latest version for serialization register a Persistent<T> along with its lambda ...
const std::vector< node_id_t > shard_reps
static auto register_functions()
virtual void post_next_version(const persistent::version_t &version, const uint64_t &ts_us)
Post the next version to be handled.
const node_id_t node_id
The ID of this node.
rpc::RPCManager & group_rpc_manager
Reference to the RPCManager for the Group this ExternalCaller is in.
PersistentRegistry is a book for all the Persistent<T> or Volatile<T> variables.