]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
updated examples and models
authorRazvan Becheriu <ravan@isc.org>
Mon, 11 Mar 2019 10:18:25 +0000 (12:18 +0200)
committerTomek Mrugalski <tomasz@isc.org>
Thu, 21 Mar 2019 08:42:25 +0000 (09:42 +0100)
doc/examples/kea4/cassandra.json
doc/examples/kea6/cassandra.json
doc/guide/dhcp4-srv.xml
src/lib/cql/cql_connection.h
src/lib/dhcpsrv/cql_host_data_source.h
src/lib/dhcpsrv/cql_lease_mgr.h
src/lib/yang/translator_database.cc
src/lib/yang/translator_database.h
src/share/yang/modules/kea-dhcp-types@2018-11-20.yang

index e26c79a352ec0c1e3feb429a44dc33b6a360de82..a7595d56b6d83e665937229bfa7f5f93c5a89ecd 100644 (file)
 
       // This parameter enables/disables Nagle's algorithm on connections.
       // The default is true.
-      "tcp-nodelay": true
+      "tcp-nodelay": true,
+
+      // This parameter configures consistency level. The default is "quorum".
+      "consistency": "quorum",
+
+      // This parameter configures serial consistency level which manages
+      // lightweight transaction isolation. The default is "serial".
+      "serial-consistency": "serial"
   },
 
 // Addresses will be assigned with a lifetime of 4000 seconds.
index 27331059135c123afd06b01a07218d1dbd2a0947..bf7c2f2c85fd1d3991beb09a7564c513329ae021 100644 (file)
 
       // This parameter enables/disables Nagle's algorithm on connections.
       // The default is true.
-      "tcp-nodelay": true
+      "tcp-nodelay": true,
+
+      // This parameter configures consistency level. The default is "quorum".
+      "consistency": "quorum",
+
+      // This parameter configures serial consistency level which manages
+      // lightweight transaction isolation. The default is "serial".
+      "serial-consistency": "serial"
   },
 
 // Addresses will be assigned with preferred and valid lifetimes
index bbc95f75c02f5327c8b5f336a47635a8795e20fc..da26f488cdca20f6561ef66fb2dd3e7ddb195780 100644 (file)
@@ -595,6 +595,17 @@ The default value for Cassandra is 2000 ms.
         algorithm on connections. The default is true.
       </simpara></listitem>
 
+      <listitem><simpara>
+        <command>consistency</command> - configures consistency level.
+        The default is "quorum".
+      </simpara></listitem>
+
+      <listitem><simpara>
+        <command>serial-consistency</command> - configures serial consistency
+        level which manages lightweight transaction isolation. The default is
+        "serial".
+      </simpara></listitem>
+
     </itemizedlist>
   </para>
 
index cd526a6b364fb2df1eb23efac95e4eab43e41ac1..cf92be9b6f1df71f7544a159debf223202f99318 100644 (file)
@@ -147,6 +147,8 @@ public:
     /// values specified in parentheses):
     /// - keyspace: name of the database to which to connect (keatest)
     /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1)
+    /// - consistency: consistency level (quorum)
+    /// - serial-consistency: serial consistency level (serial)
     /// - port: The TCP port to use (9042)
     /// - user - credentials to use when connecting (no username)
     /// - password - credentials to use when connecting (no password)
index c9f5a18512963ab66840d7980ecc895b472c967b..cac22825f5829d2877bc0811935091c30db04f57 100644 (file)
@@ -57,18 +57,21 @@ class CqlHostDataSource : public BaseHostDataSource {
 public:
     /// @brief Constructor
     ///
-    /// Uses the following keywords in the parameters passed to it to connect
-    /// to the database:
-    /// - keyspace
-    /// - host
-    /// - user
-    /// - password
-    /// - contact-points
-    /// - reconnect-wait-time
-    /// - connect-timeout
-    /// - request-timeout
-    /// - tcp-keepalive
-    /// - tcp-nodelay
+    /// Uses the following keywords in the parameters passed to it to
+    /// connect to the Cassandra cluster (if omitted, defaults specified in
+    /// parentheses):
+    /// - keyspace: name of the database to which to connect (keatest)
+    /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1)
+    /// - consistency: consistency level (quorum)
+    /// - serial-consistency: serial consistency level (serial)
+    /// - port: The TCP port to use (9042)
+    /// - user - credentials to use when connecting (no username)
+    /// - password - credentials to use when connecting (no password)
+    /// - reconnect-wait-time 2000
+    /// - connect-timeout 5000
+    /// - request-timeout 12000
+    /// - tcp-keepalive no
+    /// - tcp-nodelay no
     ///
     /// For details regarding those paraemters, see
     /// @ref isc::db::CqlConnection::openDatabase.
index 9292bfe0e92bc5cb5315ee617f0517d74b549c0f..f8b8450a9022739e87b9734e28faee89f732d595 100644 (file)
@@ -46,16 +46,18 @@ public:
     /// Uses the following keywords in the parameters passed to it to
     /// connect to the Cassandra cluster (if omitted, defaults specified in
     /// parentheses):
-    /// - name - Name of the keyspace to to connect to ("keatest")
-    /// - contact-points - IP addresses to connect ("127.0.0.1")
-    /// - user - Username under which to connect (empty)
-    /// - password - Password for "user" on the database (empty)
-    /// - port - TCP port (9042)
-    /// - reconnect-wait-time (2000)
-    /// - connect-timeout (5000)
-    /// - request-timeout (12000)
-    /// - tcp-keepalive (no)
-    /// - tcp-nodelay (no)
+    /// - keyspace: name of the database to which to connect (keatest)
+    /// - contact-points: IP addresses of the nodes to connect to (127.0.0.1)
+    /// - consistency: consistency level (quorum)
+    /// - serial-consistency: serial consistency level (serial)
+    /// - port: The TCP port to use (9042)
+    /// - user - credentials to use when connecting (no username)
+    /// - password - credentials to use when connecting (no password)
+    /// - reconnect-wait-time 2000
+    /// - connect-timeout 5000
+    /// - request-timeout 12000
+    /// - tcp-keepalive no
+    /// - tcp-nodelay no
     ///
     /// Finally, all the CQL commands are pre-compiled.
     ///
index cea73f9454a64042cc36ce985fde504b413f67b0..9bdabee61b960853048de4e90eea507527a280ee 100644 (file)
@@ -95,6 +95,14 @@ TranslatorDatabase::getDatabaseKea(const string& xpath) {
     if (keyspace) {
         result->set("keyspace", keyspace);
     }
+    ConstElementPtr consistency = getItem(xpath + "/consistency");
+    if (consistency) {
+        result->set("consistency", consistency);
+    }
+    ConstElementPtr serial_consistency = getItem(xpath + "/serial-consistency");
+    if (serial_consistency) {
+        result->set("serial-consistency", serial_consistency);
+    }
     ConstElementPtr max_reconnect = getItem(xpath + "/max-reconnect-tries");
     if (max_reconnect) {
         result->set("max-reconnect-tries", max_reconnect);
@@ -201,6 +209,14 @@ TranslatorDatabase::setDatabaseKea(const string& xpath,
     if (keyspace) {
         setItem(xpath + "/keyspace", keyspace, SR_STRING_T);
     }
+    ConstElementPtr consistency = elem->get("consistency");
+    if (consistency) {
+        setItem(xpath + "/consistency", consistency, SR_STRING_T);
+    }
+    ConstElementPtr serial_consistency = elem->get("serial-consistency");
+    if (serial_consistency) {
+        setItem(xpath + "/serial-consistency", serial_consistency, SR_STRING_T);
+    }
     ConstElementPtr max_reconnect = elem->get("max-reconnect-tries");
     if (max_reconnect) {
         setItem(xpath + "/max-reconnect-tries", max_reconnect, SR_UINT32_T);
index 228cbbb2a6fe8bd6318dde196f1ff2c542078a69..e3e4138b96d17c2f28018bea208e0ba4540c11d3 100644 (file)
@@ -30,6 +30,8 @@ namespace yang {
 ///     "connect-timeout": <connect timeout>,
 ///     "contact-points": <contact points>,
 ///     "keyspace": <keyspace>,
+///     "consistency": <consistency>,
+///     "serial-consistency": <serial-consistency>,
 ///     "max-reconnect-tries": <maximum reconnect tries>,
 ///     "reconnect-wait-time": <reconnect wait time>,
 ///     "request-timeout": <request timeout>,
@@ -56,6 +58,8 @@ namespace yang {
 ///    +--rw connect-timeout?      uint32
 ///    +--rw contact-points?       string
 ///    +--rw keyspace?             string
+///    +--rw consistency?          string
+///    +--rw serial-consistency?   string
 ///    +--rw max-reconnect-tries?  uint32
 ///    +--rw reconnect-wait-time?  uint32
 ///    +--rw request-timeout?      uint32
index 2bfc96f8e8e3d13f16c749e4cc35bf2ae7244de8..cfcf7696dd1c48f4efbd63af58fcabac8983f7c8 100644 (file)
@@ -145,6 +145,15 @@ module kea-dhcp-types {
       description "Cassandra database keyspace (this is Cassandra's equivalent
                    of a database name).";
     }
+    leaf consistency {
+      type string;
+      description "Consistency level.";
+    }
+    leaf serial-consistency {
+      type string;
+      description "Serial consistency level which manages lightweight
+                   transaction isolation.";
+    }
     leaf max-reconnect-tries {
       type uint32;
       description "Maximum of recovery attempts before exit.";