first_committed_name("first_committed"),
last_accepted_name("last_accepted"),
mkfs_name("mkfs"),
- full_version_name("full"), full_latest_name("latest")
+ full_version_name("full"), full_latest_name("latest"),
+ cached_first_committed(0), cached_last_committed(0)
{
proposing.set(0);
}
* @}
*/
+ /**
+ * @defgroup PaxosService_h_version_cache Variables holding cached values
+ * for the most used versions (first
+ * and last committed); we only have
+ * to read them when the store is
+ * updated, so in-between updates we
+ * may very well use cached versions
+ * and avoid the overhead.
+ * @{
+ */
+ version_t cached_first_committed;
+ version_t cached_last_committed;
+ /**
+ * @}
+ */
+
/**
* Callback list to be used whenever we are running a proposal through
* Paxos. These callbacks will be awaken whenever the said proposal
* the back store for reading purposes
* @{
*/
+
+ /**
+ * @defgroup PaxosService_h_version_cache Obtain cached versions for this
+ * service.
+ * @{
+ */
/**
* Get the first committed version
*
* @returns Our first committed version (that is available)
*/
version_t get_first_committed() {
- return mon->store->get(get_service_name(), first_committed_name);
+ return cached_first_committed;
}
/**
* Get the last committed version
* @returns Our last committed version
*/
version_t get_last_committed() {
- return mon->store->get(get_service_name(), last_committed_name);
+ return cached_last_committed;
}
/**
* Get our current version
version_t get_version() {
return get_last_committed();
}
+
+ /**
+ * @}
+ */
+
/**
* Get the contents of a given version @p ver
*