summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>2012-07-17 10:33:53 +0200
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>2012-07-17 10:33:53 +0200
commita2eb4d27f6b6ad6e9f6a13f1ef8f966da6b9bd13 (patch)
tree0d213fd1cf205efddf112ba1bb5615401826747e
parenta[2051] Wrap the configure method (diff)
downloadkea-a2eb4d27f6b6ad6e9f6a13f1ef8f966da6b9bd13.tar.xz
kea-a2eb4d27f6b6ad6e9f6a13f1ef8f966da6b9bd13.zip
[2051] Change the internals of DataSourceClient wrapper
So it will better support the case when created from the client list.
-rw-r--r--src/lib/python/isc/datasrc/client_python.cc16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/lib/python/isc/datasrc/client_python.cc b/src/lib/python/isc/datasrc/client_python.cc
index bdf84a351e..c237115f89 100644
--- a/src/lib/python/isc/datasrc/client_python.cc
+++ b/src/lib/python/isc/datasrc/client_python.cc
@@ -51,8 +51,12 @@ namespace {
// The s_* Class simply covers one instantiation of the object
class s_DataSourceClient : public PyObject {
public:
- s_DataSourceClient() : cppobj(NULL) {};
+ s_DataSourceClient() :
+ cppobj(NULL),
+ client(NULL)
+ {};
DataSourceClientContainer* cppobj;
+ DataSourceClient* client;
};
PyObject*
@@ -62,7 +66,7 @@ DataSourceClient_findZone(PyObject* po_self, PyObject* args) {
if (PyArg_ParseTuple(args, "O!", &name_type, &name)) {
try {
DataSourceClient::FindResult find_result(
- self->cppobj->getInstance().findZone(PyName_ToName(name)));
+ self->client->findZone(PyName_ToName(name)));
result::Result r = find_result.code;
ZoneFinderPtr zfp = find_result.zone_finder;
@@ -103,7 +107,7 @@ DataSourceClient_getIterator(PyObject* po_self, PyObject* args) {
}
}
return (createZoneIteratorObject(
- self->cppobj->getInstance().getIterator(PyName_ToName(name_obj),
+ self->client->getIterator(PyName_ToName(name_obj),
separate_rrs),
po_self));
} catch (const isc::NotImplemented& ne) {
@@ -139,7 +143,7 @@ DataSourceClient_getUpdater(PyObject* po_self, PyObject* args) {
const bool journaling = (journaling_obj == Py_True);
try {
ZoneUpdaterPtr updater =
- self->cppobj->getInstance().getUpdater(PyName_ToName(name_obj),
+ self->client->getUpdater(PyName_ToName(name_obj),
replace, journaling);
if (!updater) {
return (Py_None);
@@ -184,7 +188,7 @@ DataSourceClient_getJournalReader(PyObject* po_self, PyObject* args) {
&begin_obj, &end_obj)) {
try {
pair<ZoneJournalReader::Result, ZoneJournalReaderPtr> result =
- self->cppobj->getInstance().getJournalReader(
+ self->client->getJournalReader(
PyName_ToName(name_obj), static_cast<uint32_t>(begin_obj),
static_cast<uint32_t>(end_obj));
PyObject* po_reader;
@@ -245,6 +249,7 @@ DataSourceClient_init(PyObject* po_self, PyObject* args, PyObject*) {
isc::data::Element::fromJSON(ds_config_str);
self->cppobj = new DataSourceClientContainer(ds_type_str,
ds_config);
+ self->client = &self->cppobj->getInstance();
return (0);
} else {
return (-1);
@@ -281,6 +286,7 @@ DataSourceClient_destroy(PyObject* po_self) {
s_DataSourceClient* const self = static_cast<s_DataSourceClient*>(po_self);
delete self->cppobj;
self->cppobj = NULL;
+ self->client = NULL;
Py_TYPE(self)->tp_free(self);
}