Permalink
Browse files

Add setters to ClientConfig

  • Loading branch information...
1 parent 3d53851 commit 662d6ae3576c000d63413d3e0ed4013e4f5d81c3 @readams readams committed Jun 18, 2009
Showing with 65 additions and 16 deletions.
  1. +41 −5 clients/cpp/include/voldemort/ClientConfig.h
  2. +24 −11 clients/cpp/src/ClientConfig.cpp
@@ -68,13 +68,29 @@ class ClientConfig
int getMaxConnectionsPerNode();
/**
- * Get the maximum number of allowed connections per node
+ * Set the maximum number of allowed connections per node
+ *
+ * @param val the value
+ * @return a pointer to this object useful for chaining
+ */
+ ClientConfig* setMaxConnectionsPerNode(int val);
+
+ /**
+ * Get the maximum number of allowed connections total
*
* @return the value
*/
int getMaxTotalConnections();
/**
+ * Set the maximum number of allowed connections total
+ *
+ * @param val the value
+ * @return a pointer to this object useful for chaining
+ */
+ ClientConfig* setMaxTotalConnections(int val);
+
+ /**
* Get the number of milliseconds to wait for a connection to
* start before timing out.
*
@@ -83,6 +99,15 @@ class ClientConfig
long getConnectionTimeoutMs();
/**
+ * Set the number of milliseconds to wait for a connection to
+ * start before timing out.
+ *
+ * @param val the value
+ * @return a pointer to this object useful for chaining
+ */
+ ClientConfig* setConnectionTimeoutMs(long val);
+
+ /**
* Get the number of milliseconds to wait for on reading or
* writing to a socket before timing out.
*
@@ -91,19 +116,30 @@ class ClientConfig
long getSocketTimeoutMs();
/**
- * Get the maximum number of client threads
+ * Set the number of milliseconds to wait for on reading or
+ * writing to a socket before timing out.
*
- * @return the value
+ * @param val the value
+ * @return a pointer to this object useful for chaining
*/
- int getMaxThreads();
+ ClientConfig* setSocketTimeoutMs(long val);
/**
* Get the number of milliseconds a node will be banned before we
* try again to connect to it following a failure.
*
* @return the value
*/
- int getNodeBannageMs();
+ long getNodeBannageMs();
+
+ /**
+ * Set the number of milliseconds a node will be banned before we
+ * try again to connect to it following a failure.
+ *
+ * @param val the value
+ * @return a pointer to this object useful for chaining
+ */
+ ClientConfig* setNodeBannageMs(long val);
private:
/** Internal implementation details for ClientConfig */
@@ -25,9 +25,6 @@ class ClientConfigImpl {
public:
int maxConnectionsPerNode;
int maxTotalConnections;
- // int maxThreads;
- // int maxQueuedRequests;
- // long threadIdleMs;
long connectionTimeoutMs;
long socketTimeoutMs;
long routingTimeoutMs;
@@ -39,9 +36,6 @@ ClientConfig::ClientConfig() {
pimpl_ = new ClientConfigImpl();
pimpl_->maxConnectionsPerNode = 0;
pimpl_->maxTotalConnections = 500;
- // pimpl_->maxThreads = 5;
- // pimpl_->maxQueuedRequests = 500;
- // pimpl_->threadIdleMs = 100000;
pimpl_->connectionTimeoutMs = 500;
pimpl_->socketTimeoutMs = 5000;
pimpl_->routingTimeoutMs = 15000;
@@ -70,26 +64,45 @@ int ClientConfig::getMaxConnectionsPerNode() {
return pimpl_->maxConnectionsPerNode;
}
+ClientConfig* ClientConfig::setMaxConnectionsPerNode(int val) {
+ pimpl_->maxConnectionsPerNode = val;
+ return this;
+}
+
int ClientConfig::getMaxTotalConnections() {
return pimpl_->maxTotalConnections;
}
+ClientConfig* ClientConfig::setMaxTotalConnections(int val) {
+ pimpl_->maxTotalConnections = val;
+ return this;
+}
+
long ClientConfig::getConnectionTimeoutMs() {
return pimpl_->connectionTimeoutMs;
}
+ClientConfig* ClientConfig::setConnectionTimeoutMs(long val) {
+ pimpl_->connectionTimeoutMs = val;
+ return this;
+}
+
long ClientConfig::getSocketTimeoutMs() {
return pimpl_->socketTimeoutMs;
}
-#if 0
-int ClientConfig::getMaxThreads() {
- return pimpl_->maxThreads;
+ClientConfig* ClientConfig::setSocketTimeoutMs(long val) {
+ pimpl_->socketTimeoutMs = val;
+ return this;
}
-#endif
-int ClientConfig::getNodeBannageMs() {
+long ClientConfig::getNodeBannageMs() {
return pimpl_->nodeBannageMs;
}
+ClientConfig* ClientConfig::setNodeBannageMs(long val) {
+ pimpl_->nodeBannageMs = val;
+ return this;
+}
+
} /* namespace Voldemort */

0 comments on commit 662d6ae

Please sign in to comment.