Derecho-Project / derecho

The main code repository for the Derecho project.
BSD 3-Clause "New" or "Revised" License
186 stars 47 forks source link

Expose frontiers through Replicated<T> #225

Closed songweijia closed 2 years ago

songweijia commented 2 years ago

Although we expose the stability frontiers by a set of callbacks passed to the Derecho group constructor, application code inside a subgroup type wrapped in Replicated<T> also needs access to those frontiers. This patch exposes those frontiers through a set of methods in the group handle available to Replicated<T>.

  1. Replicated<T>::get_global_persistence_frontier()
  2. Replicated<T>::get_global_verified_frontier()
  3. wait_for_global_persistence_frontier()

wait_for_global_verified_frontier() is left for future, when we really need it. The mechanism should be the same as that of wait_for_global_persistence_frontier().

I've tested it using the Cascade branch refactor_get_api and it works.

songweijia commented 2 years ago

@etremel Thanks for reviewing. I just documented those internal APIs in multicast_group.hpp. And yes, multiple threads will access those counters, that's why I use atomic counters.