BIND 10 trac2835, updated. 2e6d5f8d602a632d8a770c13d7ccbc09a25825ad [2835] The DataSourceStatus class
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 15 10:21:16 UTC 2013
The branch, trac2835 has been updated
via 2e6d5f8d602a632d8a770c13d7ccbc09a25825ad (commit)
from 7642e09748501d041309b84de9d46b3aeab74a63 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 2e6d5f8d602a632d8a770c13d7ccbc09a25825ad
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Mar 15 11:20:02 2013 +0100
[2835] The DataSourceStatus class
Just a thin state holder class
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/client_list.h | 49 +++++++++++++++++++++++++
src/lib/datasrc/tests/client_list_unittest.cc | 9 +++++
2 files changed, 58 insertions(+)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/client_list.h b/src/lib/datasrc/client_list.h
index e97ee46..28c0e20 100644
--- a/src/lib/datasrc/client_list.h
+++ b/src/lib/datasrc/client_list.h
@@ -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.
+ MSS_LOCAL,
+ /// \brief No segment used for this data source.
+ MSS_UNUSED,
+ /// \brief It is a mapped segment and we wait for information how to map
+ /// it.
+ MSS_WAITING,
+ /// \brief A mapped segment and in active use.
+ MSS_MAPPED
+};
+
+/// \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 {
+public:
+ /// \brief Constructor
+ ///
+ /// Sets initial values.
+ DataSourceStatus(const std::string& name, MemorySegmentState state) :
+ name_(name),
+ state_(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_);
+ }
+private:
+ 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
diff --git a/src/lib/datasrc/tests/client_list_unittest.cc b/src/lib/datasrc/tests/client_list_unittest.cc
index fe42ebf..445bc22 100644
--- a/src/lib/datasrc/tests/client_list_unittest.cc
+++ b/src/lib/datasrc/tests/client_list_unittest.cc
@@ -1136,4 +1136,13 @@ TYPED_TEST(ReloadTest, reloadMasterFile) {
RRType::TXT())->code);
}
+// 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());
+ status.setSegmentState(MSS_LOCAL);
+ EXPECT_EQ(MSS_LOCAL, status.getSegmentState());
+}
+
}
More information about the bind10-changes
mailing list