Commit 2e6d5f8d authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

[2835] The DataSourceStatus class

Just a thin state holder class
parent 7642e097
......@@ -46,6 +46,55 @@ class InMemoryClient;
class ZoneWriter;
/// \brief Segment status of the cache
/// Describes the status in which the memory segment of given data source
/// is.
enum MemorySegmentState {
/// \brief The segment is local one.
/// \brief No segment used for this data source.
/// \brief It is a mapped segment and we wait for information how to map
/// it.
/// \brief A mapped segment and in active use.
/// \brief Status of one data source.
/// This indicates the status a data soure is in. It is used with segment
/// and cache management, to discover the data sources than need external
/// mapping or local loading.
class DataSourceStatus {
/// \brief Constructor
/// Sets initial values.
DataSourceStatus(const std::string& name, MemorySegmentState state) :
/// \brief Change the current segment state
void setSegmentState(MemorySegmentState state) {
state_ = state;
/// \brief Get the current segment state
MemorySegmentState getSegmentState() const {
return (state_);
/// \brief Get the current name.
/// \note The name may not be changed once the object is constructed.
const std::string& getName() const {
return (name_);
std::string name_;
MemorySegmentState state_;
/// \brief The list of data source clients.
/// The purpose of this class is to hold several data source clients and search
......@@ -1136,4 +1136,13 @@ TYPED_TEST(ReloadTest, reloadMasterFile) {
// Check the status holds data and can change the segment state
TEST(DataSourceStatus, status) {
DataSourceStatus status("Test", MSS_UNUSED);
EXPECT_EQ("Test", status.getName());
EXPECT_EQ(MSS_UNUSED, status.getSegmentState());
EXPECT_EQ(MSS_LOCAL, status.getSegmentState());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment