From ac8f79fae2bb428e89b4d34b8d4bd4240d02b610 Mon Sep 17 00:00:00 2001 From: Michael Fero Date: Wed, 2 Mar 2016 09:37:51 -0500 Subject: [PATCH] Updating documentation for filtering policies --- include/cassandra.h | 26 +++++++++++------------ topics/configuration/README.md | 38 +++++++++++++++++++++++++++++++++- 2 files changed, 49 insertions(+), 15 deletions(-) diff --git a/include/cassandra.h b/include/cassandra.h index 3e3f2cdce..aa257dd0c 100644 --- a/include/cassandra.h +++ b/include/cassandra.h @@ -1236,13 +1236,13 @@ cass_cluster_set_latency_aware_routing_settings(CassCluster* cluster, * be ignored and a connection will not be established. This policy is useful * for ensuring that the driver will only connect to a predefined set of hosts. * - * Examples: "127.0.0.1" "127.0.0.1,127.0.0.2", "server1.domain.com" + * Examples: "127.0.0.1" "127.0.0.1,127.0.0.2" * * @public @memberof CassCluster * * @param[in] cluster - * @param[in] hosts A comma delimited list of addresses or names. An empty - * string will clear the whitelist hosts. The string is copied into the cluster + * @param[in] hosts A comma delimited list of addresses. An empty string will + * clear the whitelist hosts. The string is copied into the cluster * configuration; the memory pointed to by this parameter can be freed after * this call. */ @@ -1278,13 +1278,13 @@ cass_cluster_set_whitelist_filtering_n(CassCluster* cluster, * be ignored and a connection will not be established. This policy is useful * for ensuring that the driver will not connect to a predefined set of hosts. * - * Examples: "127.0.0.1" "127.0.0.1,127.0.0.2", "server1.domain.com" + * Examples: "127.0.0.1" "127.0.0.1,127.0.0.2" * * @public @memberof CassCluster * * @param[in] cluster - * @param[in] hosts A comma delimited list of addresses or names. An empty - * string will clear the blacklist hosts. The string is copied into the cluster + * @param[in] hosts A comma delimited list of addresses. An empty string will + * clear the blacklist hosts. The string is copied into the cluster * configuration; the memory pointed to by this parameter can be freed after * this call. */ @@ -1318,10 +1318,9 @@ cass_cluster_set_blacklist_filtering_n(CassCluster* cluster, * @public @memberof CassCluster * * @param[in] cluster - * @param[in] dcs A comma delimited list of dcs. An empty - * string will clear the whitelist dcs. The string is copied into the cluster - * configuration; the memory pointed to by this parameter can be freed after - * this call. + * @param[in] dcs A comma delimited list of dcs. An empty string will clear the + * whitelist dcs. The string is copied into the cluster configuration; the + * memory pointed to by this parameter can be freed after this call. */ CASS_EXPORT void cass_cluster_set_whitelist_dc_filtering(CassCluster* cluster, @@ -1353,10 +1352,9 @@ cass_cluster_set_whitelist_dc_filtering_n(CassCluster* cluster, * @public @memberof CassCluster * * @param[in] cluster - * @param[in] dcs A comma delimited list of dcs. An empty - * string will clear the blacklist dcs. The string is copied into the cluster - * configuration; the memory pointed to by this parameter can be freed after - * this call. + * @param[in] dcs A comma delimited list of dcs. An empty string will clear the + * blacklist dcs. The string is copied into the cluster configuration; the + * memory pointed to by this parameter can be freed after this call. */ CASS_EXPORT void cass_cluster_set_blacklist_dc_filtering(CassCluster* cluster, diff --git a/topics/configuration/README.md b/topics/configuration/README.md index c0231ab47..b4b0dd995 100644 --- a/topics/configuration/README.md +++ b/topics/configuration/README.md @@ -96,7 +96,9 @@ cass_cluster_set_latency_aware_routing_settings(cluster, min_measured); ``` -### Whitelist Filtering +### Filtering + +#### Whitelist This policy ensures that only hosts from the provided whitelist filter will ever be used. Any host that is not contained within the whitelist will be @@ -117,6 +119,40 @@ cass_cluster_set_whitelist_filtering(cluster, cass_cluster_set_whitelist_filtering(cluster, ""); ``` +#### Blacklist + +This policy is the inverse of the whitelist policy where hosts provided in the +blacklist filter will be ignored and a connection will not be established. + +```c +/* Set the list of predefined hosts the driver is NOT allowed to connect to */ +cass_cluster_set_blacklist_filtering(cluster, + "127.0.0.1, 127.0.0.3, 127.0.0.5"); + +/* The blacklist can be cleared (and disabled) by using an empty string */ +cass_cluster_set_blacklist_filtering(cluster, ""); +``` + +#### Datacenter + +Filtering can also be performed on all hosts in a datacenter or multiple +datacenters when using the whitelist/blacklist datacenter filtering polices. + +```c +/* Set the list of predefined datacenters the driver is allowed to connect to */ +cass_cluster_set_whitelist_filtering(cluster, "dc2, dc4"); + +/* The datacenter whitelist can be cleared/disabled by using an empty string */ +cass_cluster_set_whitelist_filtering(cluster, ""); +``` + +```c +/* Set the list of predefined datacenters the driver is NOT allowed to connect to */ +cass_cluster_set_blacklist_dc_filtering(cluster, "dc2, dc4"); + +/* The datacenter blacklist can be cleared/disabled by using an empty string */ +cass_cluster_set_blacklist_dc_filtering(cluster, ""); +``` ### Connection Heartbeats