[bind10-dev] proposal: separate ModuleCCSession and ConfigData
JINMEI Tatuya / 神明達哉
jinmei at isc.org
Thu Mar 29 04:47:17 UTC 2012
While I looked into #1707 (http://bind10.isc.org/ticket/1707) I
thought this was probably an opportunity of revisiting config-related
APIs.
I have a specific proposal. In short, the idea is to separate the
ModuleCCSession and ConfigData classes separately:
_ New ModuleCCSession will only be responsible for the protocol with
cfgmgr, synchronous/asynchronous communication, and subscriber
management. "Module" will now just be opaque string for this class.
- New ConfigData will be responsible for the data handling part of the
current ModuleCCSession, such as merging new and old config,
validation according to the spec syntax, etc.
Using this concept, the revised initialization process of b10-auth
would look like this:
// Construct the local module spec from file
ModuleSpec auth_spec = moduleSpecFromFile(specfile);
// Establish communication channel
isc::cc::Session* session(new Session());
ModuleCCSession cc_session(*session);
// Register this module at the cfgmgr and (via cfgmgr) cmdctl
cc_session.sendSpec(auth_spec.getModuleName(), auth_spec.getFullSpec());
cc_session.setCommandCallback(auth_spec.getModuleName(),
execAuthServerCommand);
// Setup local configuration. start() will get stored config from cfgmgr
// via cc_session, and call configureAuthServer() with the merged full
// config. Communication via cc_session is synchronous at this point.
ConfigData local_config(auth_spec, cc_session, configureAuthServer);
local_config.start();
// Setup TSIG key configuration
ConfigData keyring_config("tsig_keys", cc_session, keyringCallback);
keyring_config.start();
// Initial configuration is completed. Move to asynchronous mode for any
// update or command from others.
cc_session.start();
This sequence would solve #1707 as a result; the initial configuration
phase now takes the full config, and if it fails it would result in
an exception and terminate the process.
I'll send detailed background and other design details in a separate
message.
---
JINMEI, Tatuya
More information about the bind10-dev
mailing list