AuthSrvImpl(const AuthSrvImpl& source);
AuthSrvImpl& operator=(const AuthSrvImpl& source);
public:
- AuthSrvImpl(const bool use_cache, AbstractXfroutClient& xfrout_client,
+ AuthSrvImpl(AbstractXfroutClient& xfrout_client,
BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrvImpl();
- isc::data::ConstElementPtr setDbFile(isc::data::ConstElementPtr config);
bool processNormalQuery(const IOMessage& io_message, Message& message,
OutputBuffer& buffer,
ModuleCCSession* config_session_;
AbstractSession* xfrin_session_;
- /// In-memory data source. Currently class IN only for simplicity.
- /// Hot spot cache
- isc::datasrc::HotCache cache_;
-
/// Interval timer for periodic submission of statistics counters.
IntervalTimer statistics_timer_;
auth::Query query_;
};
-AuthSrvImpl::AuthSrvImpl(const bool use_cache,
- AbstractXfroutClient& xfrout_client,
+AuthSrvImpl::AuthSrvImpl(AbstractXfroutClient& xfrout_client,
BaseSocketSessionForwarder& ddns_forwarder) :
config_session_(NULL),
xfrin_session_(NULL),
xfrout_connected_(false),
xfrout_client_(xfrout_client),
ddns_forwarder_("update", ddns_forwarder)
-{
- // enable or disable the cache
- cache_.setEnabled(use_cache);
-}
+{}
AuthSrvImpl::~AuthSrvImpl() {
if (xfrout_connected_) {
AuthSrv* server_;
};
-AuthSrv::AuthSrv(const bool use_cache,
- isc::xfr::AbstractXfroutClient& xfrout_client,
+AuthSrv::AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
isc::util::io::BaseSocketSessionForwarder& ddns_forwarder)
{
- impl_ = new AuthSrvImpl(use_cache, xfrout_client, ddns_forwarder);
+ impl_ = new AuthSrvImpl(xfrout_client, ddns_forwarder);
checkin_ = new ConfigChecker(this);
dns_lookup_ = new MessageLookup(this);
dns_answer_ = new MessageAnswer(this);
return (impl_->io_service_);
}
-void
-AuthSrv::setCacheSlots(const size_t slots) {
- impl_->cache_.setSlots(slots);
-}
-
-size_t
-AuthSrv::getCacheSlots() const {
- return (impl_->cache_.getSlots());
-}
-
void
AuthSrv::setXfrinSession(AbstractSession* xfrin_session) {
impl_->xfrin_session_ = xfrin_session;
public:
/// The constructor.
///
- /// \param use_cache Whether to enable hot spot cache for lookup results.
/// \param xfrout_client Communication interface with a separate xfrout
/// process. It's normally a reference to an xfr::XfroutClient object,
/// but can refer to a local mock object for testing (or other
/// experimental) purposes.
- AuthSrv(const bool use_cache,
- isc::xfr::AbstractXfroutClient& xfrout_client,
+ AuthSrv(isc::xfr::AbstractXfroutClient& xfrout_client,
isc::util::io::BaseSocketSessionForwarder& ddns_forwarder);
~AuthSrv();
//@}
/// \brief Return pointer to the Checkin callback function
isc::asiolink::SimpleCallback* getCheckinProvider() const { return (checkin_); }
- /// \brief Set or update the size (number of slots) of hot spot cache.
- ///
- /// If the specified size is 0, it means the size will be unlimited.
- /// The specified size is recorded even if the cache is disabled; the
- /// new size will be effective when the cache is enabled.
- ///
- /// This method never throws an exception.
- ///
- /// \param slots The number of cache slots.
- void setCacheSlots(const size_t slots);
-
- /// \brief Get the current size (number of slots) of hot spot cache.
- ///
- /// It always returns the recorded size regardless of the cache is enabled.
- ///
- /// This method never throws an exception.
- ///
- /// \return The current number of cache slots.
- size_t getCacheSlots() const;
-
/// \brief Set the communication session with a separate process for
/// outgoing zone transfers.
///
<refsynopsisdiv>
<cmdsynopsis>
<command>b10-auth</command>
- <arg><option>-n</option></arg>
<arg><option>-v</option></arg>
</cmdsynopsis>
</refsynopsisdiv>
<para>The arguments are as follows:</para>
<variablelist>
- <varlistentry>
- <term><option>-n</option></term>
- <listitem><para>
- Do not cache answers in memory.
- The default is to use the cache for faster responses.
- The cache keeps the most recent 30,000 answers (positive
- and negative) in memory for 30 seconds (instead of querying
- the data source, such as SQLite3 database, each time).
- </para></listitem>
-<!-- TODO: this is SQLite3 only -->
- </varlistentry>
-
<varlistentry>
<term><option>-v</option></term>
<listitem><para>
private:
typedef boost::shared_ptr<const IOEndpoint> IOEndpointPtr;
protected:
- QueryBenchMark(const bool enable_cache,
- const BenchQueries& queries, Message& query_message,
+ QueryBenchMark(const BenchQueries& queries, Message& query_message,
OutputBuffer& buffer) :
- server_(new AuthSrv(enable_cache, xfrout_client, ddns_forwarder)),
+ server_(new AuthSrv(xfrout_client, ddns_forwarder)),
queries_(queries),
query_message_(query_message),
buffer_(buffer),
class Sqlite3QueryBenchMark : public QueryBenchMark {
public:
- Sqlite3QueryBenchMark(const int cache_slots,
- const char* const datasrc_file,
+ Sqlite3QueryBenchMark(const char* const datasrc_file,
const BenchQueries& queries,
Message& query_message,
OutputBuffer& buffer) :
- QueryBenchMark(cache_slots >= 0 ? true : false, queries,
- query_message, buffer)
+ QueryBenchMark(queries, query_message, buffer)
{
- if (cache_slots >= 0) {
- server_->setCacheSlots(cache_slots);
- }
server_->updateConfig(Element::fromJSON("{\"database_file\": \"" +
string(datasrc_file) + "\"}"));
}
const BenchQueries& queries,
Message& query_message,
OutputBuffer& buffer) :
- QueryBenchMark(false, queries, query_message, buffer)
+ QueryBenchMark(queries, query_message, buffer)
{
configureAuthServer(*server_,
Element::fromJSON(
switch (datasrc_type) {
case SQLITE3:
- cout << "Benchmark enabling Hot Spot Cache with unlimited slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(0, datasrc_file, queries,
- message, buffer));
-
- cout << "Benchmark enabling Hot Spot Cache with 10*#queries slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(10 * queries.size(), datasrc_file,
- queries, message, buffer));
-
- cout << "Benchmark enabling Hot Spot Cache with #queries/2 slots "
- << endl;
- BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(queries.size() / 2, datasrc_file,
- queries, message, buffer));
-
- cout << "Benchmark disabling Hot Spot Cache" << endl;
+ cout << "Benchmark with SQLite3" << endl;
BenchMark<Sqlite3QueryBenchMark>(
- iteration, Sqlite3QueryBenchMark(-1, datasrc_file, queries,
+ iteration, Sqlite3QueryBenchMark(datasrc_file, queries,
message, buffer));
break;
case MEMORY:
void
usage() {
- cerr << "Usage: b10-auth [-u user] [-nv]"
+ cerr << "Usage: b10-auth [-v]"
<< endl;
- cerr << "\t-n: do not cache answers in memory" << endl;
cerr << "\t-v: verbose logging (debug-level)" << endl;
exit(1);
}
int
main(int argc, char* argv[]) {
int ch;
- bool cache = true;
bool verbose = false;
while ((ch = getopt(argc, argv, ":nu:v")) != -1) {
switch (ch) {
- case 'n':
- cache = false;
- break;
case 'v':
verbose = true;
break;
specfile = string(AUTH_SPECFILE_LOCATION);
}
- auth_server = new AuthSrv(cache, xfrout_client, ddns_forwarder);
+ auth_server = new AuthSrv(xfrout_client, ddns_forwarder);
LOG_INFO(auth_logger, AUTH_SERVER_CREATED);
SimpleCallback* checkin = auth_server->getCheckinProvider();
protected:
AuthSrvTest() :
dnss_(),
- server(true, xfrout, ddns_forwarder),
+ server(xfrout, ddns_forwarder),
// The empty string is expected value of the parameter of
// requestSocket, not the app_name (there's no fallback, it checks
// the empty string is passed).
opcode.getCode(), QR_FLAG | AA_FLAG, 1, 1, 1, 0);
}
-TEST_F(AuthSrvTest, cacheSlots) {
- // simple check for the get/set operations
- server.setCacheSlots(10); // 10 = arbitrary choice
- EXPECT_EQ(10, server.getCacheSlots());
-
- // 0 is a valid size
- server.setCacheSlots(0);
- EXPECT_EQ(00, server.getCacheSlots());
-}
-
// Submit UDP normal query and check query counter
TEST_F(AuthSrvTest, queryCounterUDPNormal) {
// The counter should be initialized to 0.
}
TEST_F(AuthSrvTest, DDNSForwardClose) {
- scoped_ptr<AuthSrv> tmp_server(new AuthSrv(true, xfrout, ddns_forwarder));
+ scoped_ptr<AuthSrv> tmp_server(new AuthSrv(xfrout, ddns_forwarder));
UnitTestUtil::createRequestMessage(request_message, Opcode::UPDATE(),
default_qid, Name("example.com"),
RRClass::IN(), RRType::SOA());
class AuthCommandTest : public ::testing::Test {
protected:
AuthCommandTest() :
- server_(false, xfrout_, ddns_forwarder_),
+ server_(xfrout_, ddns_forwarder_),
rcode_(-1),
expect_rcode_(0),
itimer_(server_.getIOService())
AuthConfigTest() :
dnss_(),
rrclass(RRClass::IN()),
- server(true, xfrout, ddns_forwarder),
+ server(xfrout, ddns_forwarder),
// The empty string is expected value of the parameter of
// requestSocket, not the app_name (there's no fallback, it checks
// the empty string is passed).
<arg><option>-c <replaceable>config-filename</replaceable></option></arg>
<arg><option>-i</option></arg>
<arg><option>-m <replaceable>file</replaceable></option></arg>
- <arg><option>-n</option></arg>
<arg><option>-p <replaceable>data_path</replaceable></option></arg>
<arg><option>-u <replaceable>user</replaceable></option></arg>
<arg><option>-v</option></arg>
<arg><option>--config-file</option> <replaceable>config-filename</replaceable></arg>
<arg><option>--data-path</option> <replaceable>directory</replaceable></arg>
<arg><option>--msgq-socket-file <replaceable>file</replaceable></option></arg>
- <arg><option>--no-cache</option></arg>
<arg><option>--no-kill</option></arg>
<arg><option>--pid-file</option> <replaceable>filename</replaceable></arg>
<arg><option>--pretty-name <replaceable>name</replaceable></option></arg>
</listitem>
</varlistentry>
- <varlistentry>
- <term><option>-n</option>, <option>--no-cache</option></term>
- <listitem>
- <para>Disables the hot-spot caching used by the
- <citerefentry><refentrytitle>b10-auth</refentrytitle><manvolnum>8</manvolnum></citerefentry>
- daemon.</para>
- </listitem>
- </varlistentry>
-
<varlistentry>
<term><option>-i</option>, <option>--no-kill</option></term>
<listitem>
"""Boss of BIND class."""
def __init__(self, msgq_socket_file=None, data_path=None,
- config_filename=None, clear_config=False, nocache=False,
+ config_filename=None, clear_config=False,
verbose=False, nokill=False, setuid=None, setgid=None,
username=None, cmdctl_port=None, wait_time=10):
"""
self.ccs = None
self.curproc = None
self.msgq_socket_file = msgq_socket_file
- self.nocache = nocache
self.component_config = {}
# Some time in future, it may happen that a single component has
# multple processes (like a pipeline-like component). If so happens,
if self.uid is not None and self.__started:
logger.warn(BIND10_START_AS_NON_ROOT_AUTH)
authargs = ['b10-auth']
- if self.nocache:
- authargs += ['-n']
if self.verbose:
authargs += ['-v']
parser.add_option("-m", "--msgq-socket-file", dest="msgq_socket_file",
type="string", default=None,
help="UNIX domain socket file the b10-msgq daemon will use")
- parser.add_option("-n", "--no-cache", action="store_true", dest="nocache",
- default=False, help="disable hot-spot cache in authoritative DNS server")
parser.add_option("-i", "--no-kill", action="store_true", dest="nokill",
default=False, help="do not send SIGTERM and SIGKILL signals to modules during shutdown")
parser.add_option("-u", "--user", dest="user", type="string", default=None,
# Go bob!
boss_of_bind = BoB(options.msgq_socket_file, options.data_path,
options.config_file, options.clear_config,
- options.nocache, options.verbose, options.nokill,
+ options.verbose, options.nokill,
setuid, setgid, username, options.cmdctl_port,
options.wait_time)
startup_result = boss_of_bind.startup()
self.assertEqual(bob.runnable, False)
self.assertEqual(bob.uid, None)
self.assertEqual(bob.username, None)
- self.assertEqual(bob.nocache, False)
self.assertIsNone(bob._socket_cache)
def test_set_creator(self):
self.assertEqual(bob.runnable, False)
self.assertEqual(bob.uid, None)
self.assertEqual(bob.username, None)
- self.assertEqual(bob.nocache, False)
def test_command_handler(self):
class DummySession():
It will also fail if there is a running process with the given process_name
already.
"""
- args = [ 'bind10', '-n', '-v' ]
+ args = [ 'bind10', '-v' ]
if config_file is not None:
args.append('-p')
args.append("configurations/")