#include <config.h>
#include <util/io/sockaddr_util.h>
-#include <util/memory_segment_local.h>
#include <dns/message.h>
#include <dns/messagerenderer.h>
real_list, ThrowWhen throw_when, bool isc_exception,
ConstRRsetPtr fake_rrset = ConstRRsetPtr()) :
ConfigurableClientList(RRClass::IN()),
- real_(real_list)
+ real_(real_list),
+ config_(Element::fromJSON("{}")),
+ segment_(isc::datasrc::memory::ZoneTableSegment::create(
+ (*config_.get())))
{
BOOST_FOREACH(const DataSourceInfo& info, real_->getDataSources()) {
const isc::datasrc::DataSourceClientPtr
data_sources_.push_back(
DataSourceInfo(client.get(),
isc::datasrc::DataSourceClientContainerPtr(),
- false, RRClass::IN(), mem_sgmt_));
+ false, RRClass::IN(), segment_));
}
}
private:
const boost::shared_ptr<isc::datasrc::ConfigurableClientList> real_;
+ const ConstElementPtr config_;
+ boost::shared_ptr<isc::datasrc::memory::ZoneTableSegment> segment_;
vector<isc::datasrc::DataSourceClientPtr> clients_;
- MemorySegmentLocal mem_sgmt_;
};
} // end anonymous namespace for throwing proxy classes
using boost::shared_ptr;
using boost::dynamic_pointer_cast;
using isc::datasrc::memory::InMemoryClient;
+using isc::datasrc::memory::ZoneTableSegment;
namespace isc {
namespace datasrc {
ConfigurableClientList::DataSourceInfo::DataSourceInfo(
DataSourceClient* data_src_client,
const DataSourceClientContainerPtr& container, bool has_cache,
- const RRClass& rrclass, MemorySegment& mem_sgmt) :
+ const RRClass& rrclass, shared_ptr<ZoneTableSegment>& segment) :
data_src_client_(data_src_client),
container_(container)
{
if (has_cache) {
- cache_.reset(new InMemoryClient(mem_sgmt, rrclass));
+ cache_.reset(new InMemoryClient(segment, rrclass));
}
}
ConfigurableClientList::DataSourceInfo::DataSourceInfo(
- const RRClass& rrclass, MemorySegment& mem_sgmt, bool has_cache) :
+ const RRClass& rrclass, shared_ptr<ZoneTableSegment>& segment,
+ bool has_cache) :
data_src_client_(NULL)
{
if (has_cache) {
- cache_.reset(new InMemoryClient(mem_sgmt, rrclass));
+ cache_.reset(new InMemoryClient(segment, rrclass));
}
}
size_t i(0); // Outside of the try to be able to access it in the catch
try {
vector<DataSourceInfo> new_data_sources;
+ shared_ptr<ZoneTableSegment> ztable_segment(
+ ZoneTableSegment::create(*config.get()));
for (; i < config->size(); ++i) {
// Extract the parameters
const ConstElementPtr dconf(config->get(i));
isc_throw(ConfigurationError, "The cache must be enabled "
"for the MasterFiles type");
}
- new_data_sources.push_back(DataSourceInfo(rrclass_, *mem_sgmt_,
+ new_data_sources.push_back(DataSourceInfo(rrclass_,
+ ztable_segment,
true));
} else {
// Ask the factory to create the data source for us
// And put it into the vector
new_data_sources.push_back(DataSourceInfo(ds.first, ds.second,
want_cache, rrclass_,
- *mem_sgmt_));
+ ztable_segment));
}
if (want_cache) {
#include <dns/rrclass.h>
#include <cc/data.h>
#include <exceptions/exceptions.h>
+#include "memory/zone_table_segment.h"
#include <vector>
#include <boost/shared_ptr.hpp>
/// \todo The content yet to be defined.
struct DataSourceInfo {
// Plays a role of default constructor too (for vector)
- DataSourceInfo(const dns::RRClass& rrclass,
- util::MemorySegment& mem_sgmt,
+ DataSourceInfo(const dns::RRClass& rrclass, boost::shared_ptr
+ <isc::datasrc::memory::ZoneTableSegment>& segment,
bool has_cache = false);
DataSourceInfo(DataSourceClient* data_src_client,
const DataSourceClientContainerPtr& container,
bool has_cache, const dns::RRClass& rrclass,
- util::MemorySegment& mem_sgmt);
+ boost::shared_ptr
+ <isc::datasrc::memory::ZoneTableSegment>& segment);
DataSourceClient* data_src_client_;
DataSourceClientContainerPtr container_;
// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
// PERFORMANCE OF THIS SOFTWARE.
-#include <util/memory_segment_local.h>
-
#include <datasrc/client_list.h>
#include <datasrc/client.h>
#include <datasrc/iterator.h>
#include <datasrc/data_source.h>
#include <datasrc/memory/memory_client.h>
+#include <datasrc/memory/zone_table_segment.h>
#include <datasrc/memory/zone_finder.h>
#include <dns/rrclass.h>
using namespace isc::datasrc;
using isc::datasrc::memory::InMemoryClient;
+using isc::datasrc::memory::ZoneTableSegment;
using isc::datasrc::memory::InMemoryZoneFinder;
using namespace isc::data;
using namespace isc::dns;
" \"type\": \"test_type\","
" \"params\": [\"example.org\", \"example.com\", "
" \"noiter.org\", \"null.org\"]"
- "}]"))
+ "}]")),
+ config_(Element::fromJSON("{}")),
+ segment_(ZoneTableSegment::create((*config_.get())))
{
for (size_t i(0); i < ds_count; ++ i) {
shared_ptr<MockDataSourceClient>
ds_.push_back(ds);
ds_info_.push_back(ConfigurableClientList::DataSourceInfo(
ds.get(), DataSourceClientContainerPtr(),
- false, rrclass_, mem_sgmt_));
+ false, rrclass_, segment_));
}
}
// Create cache from the temporary data source, and push it to the
// client list.
- const shared_ptr<InMemoryClient> cache(new InMemoryClient(mem_sgmt_,
+ const shared_ptr<InMemoryClient> cache(new InMemoryClient(segment_,
rrclass_));
cache->load(zone, *mock_client.getIterator(zone, false));
shared_ptr<InMemoryClient>());
}
const RRClass rrclass_;
- isc::util::MemorySegmentLocal mem_sgmt_;
shared_ptr<TestedList> list_;
const ClientList::FindResult negative_result_;
vector<shared_ptr<MockDataSourceClient> > ds_;
vector<ConfigurableClientList::DataSourceInfo> ds_info_;
- const ConstElementPtr config_elem_, config_elem_zones_;
+ const ConstElementPtr config_elem_, config_elem_zones_, config_;
+ shared_ptr<ZoneTableSegment> segment_;
};
// Test the test itself
#include <exceptions/exceptions.h>
-#include <util/memory_segment_local.h>
-
#include <dns/masterload.h>
#include <dns/name.h>
#include <dns/rrclass.h>
#include <datasrc/zone.h>
#include <datasrc/memory/memory_client.h>
+#include <datasrc/memory/zone_table_segment.h>
#include <datasrc/database.h>
#include <datasrc/sqlite3_accessor.h>
using namespace std;
using boost::shared_ptr;
+using namespace isc::data;
using namespace isc::util;
using namespace isc::dns;
using namespace isc::datasrc;
using isc::datasrc::memory::InMemoryClient;
+using isc::datasrc::memory::ZoneTableSegment;
using namespace isc::testutils;
namespace {
// This is the type used as the test parameter. Note that this is
// intentionally a plain old type (i.e. a function pointer), not a class;
// otherwise it could cause initialization fiasco at the instantiation time.
-typedef DataSourceClientPtr (*ClientCreator)(MemorySegment&, RRClass,
- const Name&);
+typedef DataSourceClientPtr (*ClientCreator)(RRClass, const Name&);
// Creator for the in-memory client to be tested
DataSourceClientPtr
-createInMemoryClient(MemorySegment& mem_sgmt, RRClass zclass,
- const Name& zname)
+createInMemoryClient(RRClass zclass, const Name& zname)
{
- shared_ptr<InMemoryClient> client(new InMemoryClient(mem_sgmt, zclass));
+ const ElementPtr config(Element::fromJSON("{}"));
+ shared_ptr<ZoneTableSegment> ztable_segment(
+ ZoneTableSegment::create(*config.get()));
+ shared_ptr<InMemoryClient> client(new InMemoryClient(ztable_segment,
+ zclass));
client->load(zname, TEST_ZONE_FILE);
return (client);
}
DataSourceClientPtr
-createSQLite3Client(MemorySegment&, RRClass zclass, const Name& zname) {
+createSQLite3Client(RRClass zclass, const Name& zname) {
// We always begin with an empty template SQLite3 DB file and install
// the zone data from the zone file to ensure both cases have the
// same test data.
{
protected:
ZoneFinderContextTest() : qclass_(RRClass::IN()), qzone_("example.org") {
- client_ = (*GetParam())(mem_sgmt_, qclass_, qzone_);
+ client_ = (*GetParam())(qclass_, qzone_);
REQUESTED_A.push_back(RRType::A());
REQUESTED_AAAA.push_back(RRType::AAAA());
REQUESTED_BOTH.push_back(RRType::A());
ASSERT_TRUE(finder_);
}
- MemorySegmentLocal mem_sgmt_;
const RRClass qclass_;
const Name qzone_;
DataSourceClientPtr client_;