[svn] commit: r3318 - /branches/trac375/src/lib/datasrc/python/pydatasrc.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Oct 22 12:11:24 UTC 2010


Author: jelte
Date: Fri Oct 22 12:11:24 2010
New Revision: 3318

Log:
pydocstrings in module

Modified:
    branches/trac375/src/lib/datasrc/python/pydatasrc.cc

Modified: branches/trac375/src/lib/datasrc/python/pydatasrc.cc
==============================================================================
--- branches/trac375/src/lib/datasrc/python/pydatasrc.cc (original)
+++ branches/trac375/src/lib/datasrc/python/pydatasrc.cc Fri Oct 22 12:11:24 2010
@@ -94,44 +94,169 @@
 
 static PyMethodDef DataSrc_methods[] = {
     { "get_class", reinterpret_cast<PyCFunction>(DataSrc_getClass), METH_NOARGS,
-      "Returns the RRClass" },
+      "Returns the RRClass of the DataSrc object." },
     { "init", reinterpret_cast<PyCFunction>(DataSrc_init), METH_VARARGS,
-      "Initializes the data source" },
+      "Initializes the data source with the given configuration.\n"
+      "At this moment, the only configuration is a dict containing\n"
+      "the key 'database_file', of which the value is a string\n"
+      "specifying the SQlite3 database file.\n"
+      "Later versions should support different datasource backends,\n"
+      " and their corrseponding configuration items.\n"
+      "Raises a DataSrcError if there is an error."
+    },
     { "close", reinterpret_cast<PyCFunction>(DataSrc_close), METH_NOARGS,
-      "Closes the data source" },
+      "Closes the data source.\n"
+      "Returns DataSrc.SUCCESS on success, error value otherwise\n"
+    },
     { "find_rrset", reinterpret_cast<PyCFunction>(DataSrc_findRRset), METH_VARARGS,
-      "Searches the datasource for an RRset" },
+      "Searches the datasource for an RRset, or a referral.\n"
+      "This method takes the following arguments:\n"
+      "Name name: The name of the RRset to find\n"
+      "RRClass rrclass: The class of the RRset to find\n"
+      "RRType rrtype: The type of the RRset to find\n"
+      "List result: The results are added to this list\n"
+      "int flags: Contains result flags after this function completes\n"
+      "Name zonename: The name of the zone\n"
+      "Returns DataSrc.SUCCESS on success, error value otherwise\n"
+    },
     { "find_exact_rrset", reinterpret_cast<PyCFunction>(DataSrc_findExactRRset), METH_VARARGS,
-      "Searches the datasource for an RRset" },
+      "Searches the datasource for a specific RRset\n"
+      "This method takes the following arguments:\n"
+      "Name name: The name of the RRset to find\n"
+      "RRClass rrclass: The class of the RRset to find\n"
+      "RRType rrtype: The type of the RRset to find\n"
+      "List result: The results are added to this list\n"
+      "int flags: Contains result flags after this function completes\n"
+      "Name zonename: The name of the zone\n\n"
+      "Returns DataSrc.SUCCESS on success, error value otherwise\n"
+    },
     { "find_addrs", reinterpret_cast<PyCFunction>(DataSrc_findAddrs), METH_VARARGS,
-      "Searches the datasource for an address list" },
+      "Searches the datasource for an address list\n"
+      "This method takes the following arguments:\n"
+      "Name name: The name of the RRsets to find\n"
+      "RRClass rrclass: The class of the RRsets to find\n"
+      "List result: The results are added to this list\n"
+      "int flags: Contains result flags after this function completes\n"
+      "Name zonename: The name of the zone\n\n"
+      "Returns DataSrc.SUCCESS on success, error value otherwise\n"
+    },
     { "find_referral", reinterpret_cast<PyCFunction>(DataSrc_findReferral), METH_VARARGS,
-      "Searches the datasource for a referral" },
+      "Searches the datasource for a referral.\n"
+      "This method takes the following arguments:\n"
+      "Name name: The name of the RRsets to find\n"
+      "RRClass rrclass: The class of the RRsets to find\n"
+      "List result: The results are added to this list\n"
+      "int flags: Contains result flags after this function completes\n"
+      "Name zonename: The name of the zone\n\n"
+      "Returns DataSrc.SUCCESS on success, error value otherwise\n"
+    },
     { "find_previous_name", reinterpret_cast<PyCFunction>(DataSrc_findPreviousName), METH_VARARGS,
-      "Searches the datasource for the previous name. Returns (result_code, previous_name) tuple. "
-      "If result_code is not DataSrc.SUCCESS, previous_name will be None." },
+      "Searches the datasource for the previous name.\n"
+      "This method takes the following arguments:\n"
+      "Name name: The name of the RRsets to find\n"
+      "Name zonename: The name of the zone\n\n"
+      "Returns (result_code, previous_name) tuple.\n"
+      "If result_code is not DataSrc.SUCCESS, previous_name will be None."
+    },
     { "find_covering_nsec3", reinterpret_cast<PyCFunction>(DataSrc_findCoveringNSEC3), METH_VARARGS,
-      "Searches the datasource for the covering NSEC3 rrset." },
+      "Searches the datasource for the covering NSEC3 rrset.\n"
+      "This method takes the following arguments:\n"
+      "Name zonename: The name of the zone\n"
+      "str hash: The nsec3 hash\n"
+      "List result: The results are added to this list\n"
+      "\n"
+      "Returns\n"
+    },
     { "start_transaction", reinterpret_cast<PyCFunction>(DataSrc_startTransaction), METH_VARARGS,
-      "Start a transaction" },
+      "Start a transaction.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The transaction to start\n"
+      "create_zone: (True of False), create the zone if it does not exist yet.\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "commit_transaction", reinterpret_cast<PyCFunction>(DataSrc_commitTransaction), METH_VARARGS,
-      "Commit a transaction" },
+      "Commit a transaction.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The transaction to commit\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "rollback_transaction", reinterpret_cast<PyCFunction>(DataSrc_rollbackTransaction), METH_VARARGS,
-      "Roll back a transaction" },
+      "Roll back a transaction.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The transaction to roll back\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "add_rrset", reinterpret_cast<PyCFunction>(DataSrc_addRRset), METH_VARARGS,
-      "Add an RRset" },
+      "Add an RRset.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "RRset rrset: the RRset to add\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "del_rrset", reinterpret_cast<PyCFunction>(DataSrc_delRRset), METH_VARARGS,
-      "Delete an RRset" },
+      "Delete an RRset.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "RRset rrset: the RRset to delete\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "del_zone", reinterpret_cast<PyCFunction>(DataSrc_delZone), METH_VARARGS,
-      "Delete an entire zone" },
+      "Delete the entire zone associated with this transaction.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "replace_zone", reinterpret_cast<PyCFunction>(DataSrc_replaceZone), METH_VARARGS,
-      "Replace an entire zone" },
+      "Replace an entire zone.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "List or Iterator: The second argument can be either a List\n"
+      "                  containing RRset objects, or an iterator\n"
+      "                  function that yields RRset objects.\n"
+      "arg1: optional argument that is passed on to the iterator\n"
+      "      function\n"
+      "arg2: optional argument that is passed on to the iterator\n"
+      "      function\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { "have_rrset", reinterpret_cast<PyCFunction>(DataSrc_haveRRset), METH_VARARGS,
-      "Checks if the given RRset exists" },
+      "Checks if the given RRset exists (within a transaction).\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "RRset rrset: The rrset to look for."
+      "\n"
+      "If the rrset has type ANY, all types are searched\n"
+      "If the rrset has class ANY, all classes are searched\n"
+      "If the rrset has no Rdata fields, any rrsets with the matching\n"
+      "name, type and class are searched\n"
+      "If the rrset does have Rdata field, the function checks if the\n"
+      "rrset found in the data source is equal to the entire rrset.\n"
+      "\n"
+      "Returns True if the rrset is present, False if not.\n"
+    },
     { "update_check_prerequisite", reinterpret_cast<PyCFunction>(DataSrc_updateCheckPrerequisite), METH_VARARGS,
-      "Checks the given DNS Update prerequisite" },
+      "Checks the given DNS Update prerequisite.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "RRset rrset: The rrset that defines the prerequisite."
+      "\n"
+      "Returns Rcode as specified in RFC2136\n"
+    },
     { "do_ixfr", reinterpret_cast<PyCFunction>(DataSrc_doIXFR), METH_VARARGS,
-      "Perform an IXFR with the given List of RRsets as IXFR input" },
+      "Perform an IXFR with the given List of RRsets as IXFR input.\n"
+      "This method takes the following arguments:\n"
+      "DataSrcTransaction transaction: The current transaction\n"
+      "List answer_section: The answer section from the query response\n"
+      "\n"
+      "Returns DataSrc.W_SUCCESS on success. An error value otherwise\n"
+    },
     { NULL, NULL, 0, NULL }
 };
 
@@ -648,7 +773,7 @@
         isc::dns::RRsetList result_list;
         isc::datasrc::DataSrc::Result result =
                 self->datasrc->findExactRRset(n, c, t, result_list,
-                                         flags, &zone_name);
+                                              flags, &zone_name);
 
         BOOST_FOREACH(isc::dns::RRsetPtr rrs, result_list) {
             PyObject *rrset_obj = PyRRset_FromRRset(*rrs);




More information about the bind10-changes mailing list