Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sebastian Schrader
Kea
Commits
11944200
Commit
11944200
authored
Jul 28, 2011
by
Michal 'vorner' Vaner
Browse files
[trac1060] Rename MemoryZoneFinder to InMemoryZoneFinder
To preserve consistency.
parent
feae0b93
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
src/bin/auth/auth_config.cc
View file @
11944200
...
...
@@ -163,7 +163,8 @@ MemoryDatasourceConfig::build(ConstElementPtr config_value) {
isc_throw
(
AuthConfigError
,
"Missing zone file for zone: "
<<
origin
->
str
());
}
shared_ptr
<
MemoryZoneFinder
>
new_zone
(
new
MemoryZoneFinder
(
rrclass_
,
shared_ptr
<
InMemoryZoneFinder
>
new_zone
(
new
InMemoryZoneFinder
(
rrclass_
,
Name
(
origin
->
stringValue
())));
const
result
::
Result
result
=
memory_client_
->
addZone
(
new_zone
);
if
(
result
==
result
::
EXIST
)
{
...
...
src/bin/auth/command.cc
View file @
11944200
...
...
@@ -136,8 +136,8 @@ public:
// that doesn't block other server operations.
// TODO: we may (should?) want to check the "last load time" and
// the timestamp of the file and skip loading if the file isn't newer.
shared_ptr
<
MemoryZoneFinder
>
newzone
(
new
MemoryZoneFinder
(
oldzone
->
getClass
(),
oldzone
->
getOrigin
()));
shared_ptr
<
In
MemoryZoneFinder
>
newzone
(
new
In
MemoryZoneFinder
(
oldzone
->
getClass
(),
oldzone
->
getOrigin
()));
newzone
->
load
(
oldzone
->
getFileName
());
oldzone
->
swap
(
*
newzone
);
LOG_DEBUG
(
auth_logger
,
DBG_AUTH_OPS
,
AUTH_LOAD_ZONE
)
...
...
@@ -146,7 +146,7 @@ public:
private:
// zone finder to be updated with the new file.
shared_ptr
<
MemoryZoneFinder
>
oldzone
;
shared_ptr
<
In
MemoryZoneFinder
>
oldzone
;
// A helper private method to parse and validate command parameters.
// On success, it sets 'oldzone' to the zone to be updated.
...
...
@@ -195,7 +195,7 @@ private:
" is not found in data source"
);
}
oldzone
=
boost
::
dynamic_pointer_cast
<
MemoryZoneFinder
>
(
oldzone
=
boost
::
dynamic_pointer_cast
<
In
MemoryZoneFinder
>
(
result
.
zone_finder
);
return
(
true
);
...
...
src/lib/datasrc/memory_datasrc.cc
View file @
11944200
...
...
@@ -32,10 +32,10 @@ using namespace isc::dns;
namespace
isc
{
namespace
datasrc
{
// Private data and hidden methods of MemoryZoneFinder
struct
MemoryZoneFinder
::
MemoryZoneFinderImpl
{
// Private data and hidden methods of
In
MemoryZoneFinder
struct
In
MemoryZoneFinder
::
In
MemoryZoneFinderImpl
{
// Constructor
MemoryZoneFinderImpl
(
const
RRClass
&
zone_class
,
const
Name
&
origin
)
:
In
MemoryZoneFinderImpl
(
const
RRClass
&
zone_class
,
const
Name
&
origin
)
:
zone_class_
(
zone_class
),
origin_
(
origin
),
origin_data_
(
NULL
),
domains_
(
true
)
{
...
...
@@ -223,7 +223,7 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
* Implementation of longer methods. We put them here, because the
* access is without the impl_-> and it will get inlined anyway.
*/
// Implementation of MemoryZoneFinder::add
// Implementation of
In
MemoryZoneFinder::add
result
::
Result
add
(
const
ConstRRsetPtr
&
rrset
,
DomainTree
*
domains
)
{
// Sanitize input. This will cause an exception to be thrown
// if the input RRset is empty.
...
...
@@ -409,7 +409,7 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
}
}
// Implementation of MemoryZoneFinder::find
// Implementation of
In
MemoryZoneFinder::find
FindResult
find
(
const
Name
&
name
,
RRType
type
,
RRsetList
*
target
,
const
FindOptions
options
)
const
{
...
...
@@ -593,50 +593,50 @@ struct MemoryZoneFinder::MemoryZoneFinderImpl {
}
};
MemoryZoneFinder
::
MemoryZoneFinder
(
const
RRClass
&
zone_class
,
const
Name
&
origin
)
:
impl_
(
new
MemoryZoneFinderImpl
(
zone_class
,
origin
))
In
MemoryZoneFinder
::
In
MemoryZoneFinder
(
const
RRClass
&
zone_class
,
const
Name
&
origin
)
:
impl_
(
new
In
MemoryZoneFinderImpl
(
zone_class
,
origin
))
{
LOG_DEBUG
(
logger
,
DBG_TRACE_BASIC
,
DATASRC_MEM_CREATE
).
arg
(
origin
).
arg
(
zone_class
);
}
MemoryZoneFinder
::~
MemoryZoneFinder
()
{
In
MemoryZoneFinder
::~
In
MemoryZoneFinder
()
{
LOG_DEBUG
(
logger
,
DBG_TRACE_BASIC
,
DATASRC_MEM_DESTROY
).
arg
(
getOrigin
()).
arg
(
getClass
());
delete
impl_
;
}
const
Name
&
MemoryZoneFinder
::
getOrigin
()
const
{
In
MemoryZoneFinder
::
getOrigin
()
const
{
return
(
impl_
->
origin_
);
}
const
RRClass
&
MemoryZoneFinder
::
getClass
()
const
{
In
MemoryZoneFinder
::
getClass
()
const
{
return
(
impl_
->
zone_class_
);
}
ZoneFinder
::
FindResult
MemoryZoneFinder
::
find
(
const
Name
&
name
,
const
RRType
&
type
,
In
MemoryZoneFinder
::
find
(
const
Name
&
name
,
const
RRType
&
type
,
RRsetList
*
target
,
const
FindOptions
options
)
const
{
return
(
impl_
->
find
(
name
,
type
,
target
,
options
));
}
result
::
Result
MemoryZoneFinder
::
add
(
const
ConstRRsetPtr
&
rrset
)
{
In
MemoryZoneFinder
::
add
(
const
ConstRRsetPtr
&
rrset
)
{
return
(
impl_
->
add
(
rrset
,
&
impl_
->
domains_
));
}
void
MemoryZoneFinder
::
load
(
const
string
&
filename
)
{
In
MemoryZoneFinder
::
load
(
const
string
&
filename
)
{
LOG_DEBUG
(
logger
,
DBG_TRACE_BASIC
,
DATASRC_MEM_LOAD
).
arg
(
getOrigin
()).
arg
(
filename
);
// Load it into a temporary tree
MemoryZoneFinderImpl
::
DomainTree
tmp
;
In
MemoryZoneFinderImpl
::
DomainTree
tmp
;
masterLoad
(
filename
.
c_str
(),
getOrigin
(),
getClass
(),
boost
::
bind
(
&
MemoryZoneFinderImpl
::
addFromLoad
,
impl_
,
_1
,
&
tmp
));
boost
::
bind
(
&
In
MemoryZoneFinderImpl
::
addFromLoad
,
impl_
,
_1
,
&
tmp
));
// If it went well, put it inside
impl_
->
file_name_
=
filename
;
tmp
.
swap
(
impl_
->
domains_
);
...
...
@@ -644,14 +644,14 @@ MemoryZoneFinder::load(const string& filename) {
}
void
MemoryZoneFinder
::
swap
(
MemoryZoneFinder
&
zone
)
{
In
MemoryZoneFinder
::
swap
(
In
MemoryZoneFinder
&
zone
)
{
LOG_DEBUG
(
logger
,
DBG_TRACE_BASIC
,
DATASRC_MEM_SWAP
).
arg
(
getOrigin
()).
arg
(
zone
.
getOrigin
());
std
::
swap
(
impl_
,
zone
.
impl_
);
}
const
string
MemoryZoneFinder
::
getFileName
()
const
{
In
MemoryZoneFinder
::
getFileName
()
const
{
return
(
impl_
->
file_name_
);
}
...
...
@@ -659,7 +659,7 @@ MemoryZoneFinder::getFileName() const {
/// interface.
///
/// For now, \c InMemoryClient only contains a \c ZoneTable object, which
/// consists of (pointers to) \c MemoryZoneFinder objects, we may add more
/// consists of (pointers to) \c
In
MemoryZoneFinder objects, we may add more
/// member variables later for new features.
class
InMemoryClient
::
InMemoryClientImpl
{
public:
...
...
src/lib/datasrc/memory_datasrc.h
View file @
11944200
...
...
@@ -38,7 +38,7 @@ namespace datasrc {
/// backend). This is why the class has methods like \c load() or \c add().
///
/// This class is non copyable.
class
MemoryZoneFinder
:
boost
::
noncopyable
,
public
ZoneFinder
{
class
In
MemoryZoneFinder
:
boost
::
noncopyable
,
public
ZoneFinder
{
///
/// \name Constructors and Destructor.
public:
...
...
@@ -50,11 +50,11 @@ public:
///
/// \param rrclass The RR class of the zone.
/// \param origin The origin name of the zone.
MemoryZoneFinder
(
const
isc
::
dns
::
RRClass
&
rrclass
,
In
MemoryZoneFinder
(
const
isc
::
dns
::
RRClass
&
rrclass
,
const
isc
::
dns
::
Name
&
origin
);
/// The destructor.
virtual
~
MemoryZoneFinder
();
virtual
~
In
MemoryZoneFinder
();
//@}
/// \brief Returns the origin of the zone.
...
...
@@ -171,15 +171,15 @@ public:
///
/// This method never throws an exception.
///
/// \param zone Another \c MemoryZone object which is to be swapped with
/// \param zone Another \c
In
MemoryZone object which is to be swapped with
/// \c this zone.
void
swap
(
MemoryZoneFinder
&
zone
);
void
swap
(
In
MemoryZoneFinder
&
zone
);
private:
/// \name Hidden private data
//@{
struct
MemoryZoneFinderImpl
;
MemoryZoneFinderImpl
*
impl_
;
struct
In
MemoryZoneFinderImpl
;
In
MemoryZoneFinderImpl
*
impl_
;
//@}
};
...
...
@@ -208,7 +208,7 @@ private:
/// backend.
///
/// The findZone() method takes a domain name and returns the best matching
/// \c MemoryZoneFinder in the form of (Boost) shared pointer, so that it can
/// \c
In
MemoryZoneFinder in the form of (Boost) shared pointer, so that it can
/// provide the general interface for all data sources.
class
InMemoryClient
:
public
DataSourceClient
{
public:
...
...
src/lib/datasrc/tests/memory_datasrc_unittest.cc
View file @
11944200
This diff is collapsed.
Click to expand it.
src/lib/datasrc/tests/zonetable_unittest.cc
View file @
11944200
...
...
@@ -18,7 +18,7 @@
#include
<dns/rrclass.h>
#include
<datasrc/zonetable.h>
// We use MemoryZone to put something into the table
// We use
In
MemoryZone to put something into the table
#include
<datasrc/memory_datasrc.h>
#include
<gtest/gtest.h>
...
...
@@ -28,29 +28,29 @@ using namespace isc::datasrc;
namespace
{
TEST
(
ZoneTest
,
init
)
{
MemoryZoneFinder
zone
(
RRClass
::
IN
(),
Name
(
"example.com"
));
In
MemoryZoneFinder
zone
(
RRClass
::
IN
(),
Name
(
"example.com"
));
EXPECT_EQ
(
Name
(
"example.com"
),
zone
.
getOrigin
());
EXPECT_EQ
(
RRClass
::
IN
(),
zone
.
getClass
());
MemoryZoneFinder
ch_zone
(
RRClass
::
CH
(),
Name
(
"example"
));
In
MemoryZoneFinder
ch_zone
(
RRClass
::
CH
(),
Name
(
"example"
));
EXPECT_EQ
(
Name
(
"example"
),
ch_zone
.
getOrigin
());
EXPECT_EQ
(
RRClass
::
CH
(),
ch_zone
.
getClass
());
}
TEST
(
ZoneTest
,
find
)
{
MemoryZoneFinder
zone
(
RRClass
::
IN
(),
Name
(
"example.com"
));
In
MemoryZoneFinder
zone
(
RRClass
::
IN
(),
Name
(
"example.com"
));
EXPECT_EQ
(
ZoneFinder
::
NXDOMAIN
,
zone
.
find
(
Name
(
"www.example.com"
),
RRType
::
A
()).
code
);
}
class
ZoneTableTest
:
public
::
testing
::
Test
{
protected:
ZoneTableTest
()
:
zone1
(
new
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example.com"
))),
zone2
(
new
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example.net"
))),
zone3
(
new
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example"
)))
ZoneTableTest
()
:
zone1
(
new
In
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example.com"
))),
zone2
(
new
In
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example.net"
))),
zone3
(
new
In
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"example"
)))
{}
ZoneTable
zone_table
;
ZoneFinderPtr
zone1
,
zone2
,
zone3
;
...
...
@@ -61,8 +61,8 @@ TEST_F(ZoneTableTest, addZone) {
EXPECT_EQ
(
result
::
EXIST
,
zone_table
.
addZone
(
zone1
));
// names are compared in a case insensitive manner.
EXPECT_EQ
(
result
::
EXIST
,
zone_table
.
addZone
(
ZoneFinderPtr
(
new
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"EXAMPLE.COM"
)))));
ZoneFinderPtr
(
new
In
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"EXAMPLE.COM"
)))));
EXPECT_EQ
(
result
::
SUCCESS
,
zone_table
.
addZone
(
zone2
));
EXPECT_EQ
(
result
::
SUCCESS
,
zone_table
.
addZone
(
zone3
));
...
...
@@ -70,8 +70,8 @@ TEST_F(ZoneTableTest, addZone) {
// Zone table is indexed only by name. Duplicate origin name with
// different zone class isn't allowed.
EXPECT_EQ
(
result
::
EXIST
,
zone_table
.
addZone
(
ZoneFinderPtr
(
new
MemoryZoneFinder
(
RRClass
::
CH
(),
Name
(
"example.com"
)))));
ZoneFinderPtr
(
new
In
MemoryZoneFinder
(
RRClass
::
CH
(),
Name
(
"example.com"
)))));
/// Bogus zone (NULL)
EXPECT_THROW
(
zone_table
.
addZone
(
ZoneFinderPtr
()),
isc
::
InvalidParameter
);
...
...
@@ -109,7 +109,7 @@ TEST_F(ZoneTableTest, findZone) {
// make sure the partial match is indeed the longest match by adding
// a zone with a shorter origin and query again.
ZoneFinderPtr
zone_com
(
new
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"com"
)));
ZoneFinderPtr
zone_com
(
new
In
MemoryZoneFinder
(
RRClass
::
IN
(),
Name
(
"com"
)));
EXPECT_EQ
(
result
::
SUCCESS
,
zone_table
.
addZone
(
zone_com
));
EXPECT_EQ
(
Name
(
"example.com"
),
zone_table
.
findZone
(
Name
(
"www.example.com"
)).
zone
->
getOrigin
());
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment