This is an automated email from the ASF dual-hosted git repository. jbarrett pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/geode-native.git
The following commit(s) were added to refs/heads/develop by this push: new d3a6e50 GEODE-4188: Moves headers and templates internal. (#182) d3a6e50 is described below commit d3a6e500c15678ce139bb34e6ad304a077d20af4 Author: Jacob Barrett <jbarr...@pivotal.io> AuthorDate: Tue Jan 9 09:51:04 2018 -0800 GEODE-4188: Moves headers and templates internal. (#182) - Moves chrono::duration extensions internal. - Moves functional extensions internal. --- cppcache/include/geode/AttributesFactory.hpp | 2 +- cppcache/include/geode/Cacheable.hpp | 2 +- cppcache/include/geode/CacheableKey.hpp | 5 +- cppcache/include/geode/Exception.hpp | 9 +- cppcache/include/geode/Pool.hpp | 2 +- cppcache/include/geode/PoolFactory.hpp | 2 +- cppcache/include/geode/Properties.hpp | 7 +- cppcache/include/geode/RegionAttributes.hpp | 2 +- cppcache/include/geode/RegionFactory.hpp | 2 +- .../geode/{util => internal}/chrono/duration.hpp | 10 +- .../geode/{util => internal}/functional.hpp | 4 +- cppcache/integration-test/CacheHelper.cpp | 6 +- .../testThinClientLRUExpiration.cpp | 4 +- .../testXmlCacheCreationWithPools.cpp | 4 +- cppcache/src/CacheXmlParser.cpp | 35 +++--- cppcache/src/CacheableEnum.cpp | 2 +- cppcache/src/CacheableObjectPartList.hpp | 6 +- cppcache/src/ClientMetadataService.hpp | 3 +- cppcache/src/ClientProxyMembershipID.hpp | 2 +- cppcache/src/EventIdMap.hpp | 3 +- cppcache/src/ExpiryTaskManager.hpp | 9 +- .../Cacheable.hpp => src/HashMapOfException.hpp} | 27 +++-- cppcache/src/PdxTypeRegistry.hpp | 2 +- cppcache/src/RegionInternal.hpp | 1 + cppcache/src/SystemProperties.cpp | 30 +++--- cppcache/src/TcpConn.cpp | 10 +- cppcache/src/TcpSslConn.cpp | 8 +- cppcache/src/ThinClientRegion.hpp | 2 +- cppcache/src/TombstoneList.hpp | 2 +- .../src/{util/chrono => internal}/duration.cpp | 6 +- cppcache/src/util/chrono/duration_bounds.hpp | 1 + cppcache/src/util/functional.cpp | 4 +- cppcache/src/util/functional.hpp | 118 --------------------- cppcache/test/CacheableStringEqualityTest.cpp | 2 +- cppcache/test/util/chrono/durationTest.cpp | 3 +- cppcache/test/util/functionalTests.cpp | 4 +- tests/cpp/fwklib/FrameworkTest.cpp | 7 +- tests/cpp/fwklib/FwkObjects.hpp | 26 +++-- tests/cpp/fwklib/RegionHelper.hpp | 4 +- 39 files changed, 138 insertions(+), 240 deletions(-) diff --git a/cppcache/include/geode/AttributesFactory.hpp b/cppcache/include/geode/AttributesFactory.hpp index 4d1f550..c8142e7 100644 --- a/cppcache/include/geode/AttributesFactory.hpp +++ b/cppcache/include/geode/AttributesFactory.hpp @@ -33,7 +33,7 @@ #include "RegionAttributes.hpp" #include "DiskPolicyType.hpp" #include "Pool.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" /** * @file diff --git a/cppcache/include/geode/Cacheable.hpp b/cppcache/include/geode/Cacheable.hpp index 450bfb8..aa4554c 100644 --- a/cppcache/include/geode/Cacheable.hpp +++ b/cppcache/include/geode/Cacheable.hpp @@ -26,7 +26,7 @@ #include "geode_globals.hpp" #include "Serializable.hpp" -#include "util/functional.hpp" +#include "internal/functional.hpp" namespace apache { namespace geode { diff --git a/cppcache/include/geode/CacheableKey.hpp b/cppcache/include/geode/CacheableKey.hpp index dd6d535..bcbeea9 100644 --- a/cppcache/include/geode/CacheableKey.hpp +++ b/cppcache/include/geode/CacheableKey.hpp @@ -26,7 +26,7 @@ #include "geode_globals.hpp" #include "Cacheable.hpp" -#include "util/functional.hpp" +#include "internal/functional.hpp" /** * @file @@ -103,6 +103,8 @@ class CPPCACHE_EXPORT CacheableKey : public Cacheable { void operator=(const CacheableKey& other); }; +using namespace apache::geode::client::internal; + typedef std::unordered_map<std::shared_ptr<CacheableKey>, std::shared_ptr<Cacheable>, dereference_hash<std::shared_ptr<CacheableKey>>, @@ -114,6 +116,7 @@ typedef std::unordered_set<std::shared_ptr<CacheableKey>, dereference_equal_to<std::shared_ptr<CacheableKey>>> HashSetOfCacheableKey; + } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/Exception.hpp b/cppcache/include/geode/Exception.hpp index 7891f07..2804f8c 100644 --- a/cppcache/include/geode/Exception.hpp +++ b/cppcache/include/geode/Exception.hpp @@ -25,7 +25,7 @@ #include <unordered_map> #include "geode_globals.hpp" -#include "util/functional.hpp" +#include "internal/functional.hpp" /** * @file @@ -84,13 +84,6 @@ class CPPCACHE_EXPORT Exception : public std::exception { #pragma warning(pop) -class CacheableKey; -typedef std::unordered_map<std::shared_ptr<CacheableKey>, - std::shared_ptr<Exception>, - dereference_hash<std::shared_ptr<CacheableKey>>, - dereference_equal_to<std::shared_ptr<CacheableKey>>> - HashMapOfException; - } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/include/geode/Pool.hpp b/cppcache/include/geode/Pool.hpp index 5f7c1d0..cae5956 100644 --- a/cppcache/include/geode/Pool.hpp +++ b/cppcache/include/geode/Pool.hpp @@ -29,7 +29,7 @@ #include "CacheableBuiltins.hpp" #include "geode_base.hpp" #include "geode_globals.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" /** * @file diff --git a/cppcache/include/geode/PoolFactory.hpp b/cppcache/include/geode/PoolFactory.hpp index 4daa109..03cb4c1 100644 --- a/cppcache/include/geode/PoolFactory.hpp +++ b/cppcache/include/geode/PoolFactory.hpp @@ -23,7 +23,7 @@ #include <chrono> #include "geode_globals.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" #include "Pool.hpp" /** diff --git a/cppcache/include/geode/Properties.hpp b/cppcache/include/geode/Properties.hpp index 1445690..54f8765 100644 --- a/cppcache/include/geode/Properties.hpp +++ b/cppcache/include/geode/Properties.hpp @@ -30,12 +30,14 @@ #include "geode_globals.hpp" #include "Serializable.hpp" #include "Cacheable.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" namespace apache { namespace geode { namespace client { +using namespace apache::geode::internal::chrono::duration; + class DataInput; class DataOutput; class CacheableKey; @@ -47,7 +49,6 @@ class CacheableString; * the property; value, the value of the property. * */ - class CPPCACHE_EXPORT Properties : public Serializable { public: class Visitor { @@ -97,7 +98,7 @@ class CPPCACHE_EXPORT Properties : public Serializable { template <class _Rep, class _Period> void insert(std::string key, const std::chrono::duration<_Rep, _Period>& value) { - insert(key, util::chrono::duration::to_string(value)); + insert(key, to_string(value)); } /** diff --git a/cppcache/include/geode/RegionAttributes.hpp b/cppcache/include/geode/RegionAttributes.hpp index 53fbf8b..38fa23a 100644 --- a/cppcache/include/geode/RegionAttributes.hpp +++ b/cppcache/include/geode/RegionAttributes.hpp @@ -36,7 +36,7 @@ #include "Serializable.hpp" #include "DiskPolicyType.hpp" #include "PersistenceManager.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" namespace apache { namespace geode { diff --git a/cppcache/include/geode/RegionFactory.hpp b/cppcache/include/geode/RegionFactory.hpp index 74d4da9..e5e4628 100644 --- a/cppcache/include/geode/RegionFactory.hpp +++ b/cppcache/include/geode/RegionFactory.hpp @@ -24,7 +24,7 @@ #include "geode_globals.hpp" #include "AttributesFactory.hpp" -#include "util/chrono/duration.hpp" +#include "internal/chrono/duration.hpp" /** * @file diff --git a/cppcache/include/geode/util/chrono/duration.hpp b/cppcache/include/geode/internal/chrono/duration.hpp similarity index 96% rename from cppcache/include/geode/util/chrono/duration.hpp rename to cppcache/include/geode/internal/chrono/duration.hpp index a97d029..519d48b 100644 --- a/cppcache/include/geode/util/chrono/duration.hpp +++ b/cppcache/include/geode/internal/chrono/duration.hpp @@ -17,8 +17,8 @@ #pragma once -#ifndef GEODE_UTIL_CHRONO_DURATION_H_ -#define GEODE_UTIL_CHRONO_DURATION_H_ +#ifndef GEODE_INTERNAL_CHRONO_DURATION_H_ +#define GEODE_INTERNAL_CHRONO_DURATION_H_ #include <chrono> #include <iosfwd> @@ -29,7 +29,7 @@ namespace apache { namespace geode { -namespace util { +namespace internal { namespace chrono { namespace duration { @@ -158,8 +158,8 @@ inline std::string to_string( } // namespace duration } // namespace chrono -} // namespace util +} // namespace internal } // namespace geode } // namespace apache -#endif /* GEODE_UTIL_CHRONO_DURATION_H_ */ +#endif /* GEODE_INTERNAL_CHRONO_DURATION_H_ */ diff --git a/cppcache/include/geode/util/functional.hpp b/cppcache/include/geode/internal/functional.hpp similarity index 98% rename from cppcache/include/geode/util/functional.hpp rename to cppcache/include/geode/internal/functional.hpp index f5a3436..0c4a7ab 100644 --- a/cppcache/include/geode/util/functional.hpp +++ b/cppcache/include/geode/internal/functional.hpp @@ -27,11 +27,10 @@ #include <codecvt> #include <locale> -//#include "string.hpp" - namespace apache { namespace geode { namespace client { +namespace internal { template <class _T> struct dereference_hash; @@ -108,6 +107,7 @@ struct geode_hash<std::string> { int32_t operator()(const std::string& val); }; +} // namespace internal } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/integration-test/CacheHelper.cpp b/cppcache/integration-test/CacheHelper.cpp index 1fb9bf9..6072b9b 100644 --- a/cppcache/integration-test/CacheHelper.cpp +++ b/cppcache/integration-test/CacheHelper.cpp @@ -26,7 +26,7 @@ #include <geode/SystemProperties.hpp> #include <geode/PoolManager.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "CacheRegionHelper.hpp" #include "DistributedSystemImpl.hpp" @@ -62,7 +62,7 @@ #endif using namespace apache::geode::client; -using namespace apache::geode::util::chrono::duration; +using namespace apache::geode::internal::chrono::duration; extern ClientCleanup gClientCleanup; @@ -501,7 +501,7 @@ std::shared_ptr<Pool> CacheHelper::createPool2( } void CacheHelper::logPoolAttributes(std::shared_ptr<Pool>& pool) { - using namespace apache::geode::util::chrono::duration; + using namespace apache::geode::internal::chrono::duration; LOG("logPoolAttributes() entered"); LOGINFO("CPPTEST: Pool attributes for pool %s are as follows" + pool->getName()); diff --git a/cppcache/integration-test/testThinClientLRUExpiration.cpp b/cppcache/integration-test/testThinClientLRUExpiration.cpp index 969a7a5..6ec8299 100644 --- a/cppcache/integration-test/testThinClientLRUExpiration.cpp +++ b/cppcache/integration-test/testThinClientLRUExpiration.cpp @@ -22,7 +22,7 @@ #include <ace/OS.h> #include <ace/High_Res_Timer.h> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #define ROOT_NAME "testThinClientLRUExpiration" #define ROOT_SCOPE DISTRIBUTED_ACK @@ -33,7 +33,7 @@ using namespace apache::geode::client; using namespace test; -using namespace apache::geode::util::chrono::duration; +using namespace apache::geode::internal::chrono::duration; #define CLIENT1 s1p1 #define CLIENT2 s1p2 diff --git a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp index c494e35..967a29c 100644 --- a/cppcache/integration-test/testXmlCacheCreationWithPools.cpp +++ b/cppcache/integration-test/testXmlCacheCreationWithPools.cpp @@ -21,7 +21,7 @@ #include "fw_dunit.hpp" -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #define CLIENT1 s1p1 #define CLIENT2 s1p2 @@ -84,7 +84,7 @@ bool checkPoolAttribs(std::shared_ptr<Pool> pool, SLIST& locators, int subscriptionAckInterval, int subscriptionRedundancy, int statisticInterval, int threadLocalConnections, bool prSingleHopEnabled, int updateLocatorListInterval) { - using namespace apache::geode::util::chrono::duration; + using namespace apache::geode::internal::chrono::duration; char logmsg[500] = {0}; diff --git a/cppcache/src/CacheXmlParser.cpp b/cppcache/src/CacheXmlParser.cpp index 859ab60..ce17882 100644 --- a/cppcache/src/CacheXmlParser.cpp +++ b/cppcache/src/CacheXmlParser.cpp @@ -17,7 +17,7 @@ #include <chrono> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include <geode/PoolManager.hpp> #include <geode/PoolFactory.hpp> @@ -40,7 +40,6 @@ namespace impl { void* getFactoryFunc(const std::string& lib, const std::string& funcName); } // namespace impl - namespace { using namespace apache::geode::client::impl; @@ -636,10 +635,11 @@ void CacheXmlParser::endPool() { void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name, const char* value) { + using namespace apache::geode::internal::chrono::duration; + if (strcmp(name, FREE_CONNECTION_TIMEOUT) == 0) { factory->setFreeConnectionTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, MULTIUSER_SECURE_MODE) == 0) { if (ACE_OS::strcasecmp(value, "true") == 0) { factory->setMultiuserAuthentication(true); @@ -648,28 +648,23 @@ void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name, } } else if (strcmp(name, IDLE_TIMEOUT) == 0) { factory->setIdleTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, LOAD_CONDITIONING_INTERVAL) == 0) { factory->setLoadConditioningInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, MAX_CONNECTIONS) == 0) { factory->setMaxConnections(atoi(value)); } else if (strcmp(name, MIN_CONNECTIONS) == 0) { factory->setMinConnections(atoi(value)); } else if (strcmp(name, PING_INTERVAL) == 0) { factory->setPingInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, UPDATE_LOCATOR_LIST_INTERVAL) == 0) { factory->setUpdateLocatorListInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, READ_TIMEOUT) == 0) { factory->setReadTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, RETRY_ATTEMPTS) == 0) { factory->setRetryAttempts(atoi(value)); } else if (strcmp(name, SERVER_GROUP) == 0) { @@ -678,12 +673,10 @@ void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name, factory->setSocketBufferSize(atoi(value)); } else if (strcmp(name, STATISTIC_INTERVAL) == 0) { factory->setStatisticInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, SUBSCRIPTION_ACK_INTERVAL) == 0) { factory->setSubscriptionAckInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, SUBSCRIPTION_ENABLED) == 0) { if (ACE_OS::strcasecmp(value, "true") == 0) { factory->setSubscriptionEnabled(true); @@ -692,8 +685,7 @@ void CacheXmlParser::setPoolInfo(PoolFactory* factory, const char* name, } } else if (strcmp(name, SUBSCRIPTION_MTT) == 0) { factory->setSubscriptionMessageTrackingTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>( - std::string(value))); + from_string<std::chrono::milliseconds>(std::string(value))); } else if (strcmp(name, SUBSCRIPTION_REDUNDANCY) == 0) { factory->setSubscriptionRedundancy(atoi(value)); } else if (strcmp(name, THREAD_LOCAL_CONNECTIONS) == 0) { @@ -1078,8 +1070,7 @@ void CacheXmlParser::startExpirationAttributes(const xmlChar** atts) { "XML:Value for attribute <timeout> needs to be specified"; throw CacheXmlException(s.c_str()); } - timeOutSeconds = - util::chrono::duration::from_string<std::chrono::seconds>(timeOut); + timeOutSeconds = from_string<std::chrono::seconds>(timeOut); } else if (strcmp(ACTION, (char*)atts[i]) == 0) { i++; char* action = (char*)atts[i]; diff --git a/cppcache/src/CacheableEnum.cpp b/cppcache/src/CacheableEnum.cpp index 79785fa..c72a22b 100644 --- a/cppcache/src/CacheableEnum.cpp +++ b/cppcache/src/CacheableEnum.cpp @@ -16,13 +16,13 @@ */ #include <geode/CacheableEnum.hpp> +#include <geode/internal/functional.hpp> #include "Utils.hpp" #include "PdxHelper.hpp" #include "GeodeTypeIdsImpl.hpp" #include "EnumInfo.hpp" #include "CacheRegionHelper.hpp" -#include "util/functional.hpp" namespace apache { namespace geode { diff --git a/cppcache/src/CacheableObjectPartList.hpp b/cppcache/src/CacheableObjectPartList.hpp index bd57052..a79b91b 100644 --- a/cppcache/src/CacheableObjectPartList.hpp +++ b/cppcache/src/CacheableObjectPartList.hpp @@ -20,13 +20,15 @@ #ifndef GEODE_CACHEABLEOBJECTPARTLIST_H_ #define GEODE_CACHEABLEOBJECTPARTLIST_H_ +#include <vector> + #include <geode/geode_globals.hpp> #include <geode/DataOutput.hpp> #include <geode/DataInput.hpp> #include <geode/Cacheable.hpp> -#include "MapWithLock.hpp" -#include <vector> +#include "MapWithLock.hpp" +#include "HashMapOfException.hpp" /** @file */ diff --git a/cppcache/src/ClientMetadataService.hpp b/cppcache/src/ClientMetadataService.hpp index e714863..fd4d45f 100644 --- a/cppcache/src/ClientMetadataService.hpp +++ b/cppcache/src/ClientMetadataService.hpp @@ -26,10 +26,10 @@ #include <ace/Task.h> -#include <memory> #include <geode/CacheableKey.hpp> #include <geode/Cacheable.hpp> #include <geode/Region.hpp> +#include <geode/internal/functional.hpp> #include "ClientMetadata.hpp" #include "ServerLocation.hpp" @@ -37,7 +37,6 @@ #include "Queue.hpp" #include "DistributedSystemImpl.hpp" #include "NonCopyable.hpp" -#include "util/functional.hpp" namespace apache { namespace geode { diff --git a/cppcache/src/ClientProxyMembershipID.hpp b/cppcache/src/ClientProxyMembershipID.hpp index 99346f4..a15d974 100644 --- a/cppcache/src/ClientProxyMembershipID.hpp +++ b/cppcache/src/ClientProxyMembershipID.hpp @@ -26,7 +26,7 @@ #include <geode/geode_globals.hpp> #include <geode/DataOutput.hpp> -#include <geode/util/functional.hpp> +#include <geode/internal/functional.hpp> #include "GeodeTypeIdsImpl.hpp" #include "DSMemberForVersionStamp.hpp" diff --git a/cppcache/src/EventIdMap.hpp b/cppcache/src/EventIdMap.hpp index bd26ff3..6a1525a 100644 --- a/cppcache/src/EventIdMap.hpp +++ b/cppcache/src/EventIdMap.hpp @@ -31,9 +31,10 @@ #include <ace/Recursive_Thread_Mutex.h> #include <ace/Guard_T.h> +#include <geode/internal/functional.hpp> + #include "EventId.hpp" #include "EventSource.hpp" -#include "util/functional.hpp" namespace apache { namespace geode { diff --git a/cppcache/src/ExpiryTaskManager.hpp b/cppcache/src/ExpiryTaskManager.hpp index 6c16aee..84cf4f5 100644 --- a/cppcache/src/ExpiryTaskManager.hpp +++ b/cppcache/src/ExpiryTaskManager.hpp @@ -27,7 +27,7 @@ #include <ace/Timer_Heap.h> #include <geode/geode_globals.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "ReadWriteLock.hpp" #include "util/Log.hpp" @@ -39,6 +39,9 @@ namespace apache { namespace geode { namespace client { + +using namespace apache::geode::internal::chrono::duration; + /** * @class ExpiryTaskManager ExpiryTaskManager.hpp * @@ -246,8 +249,8 @@ class CPPCACHE_EXPORT ExpiryTaskManager : public ACE_Task_Base { bool cancelExistingTask = false) { LOGFINER( "ExpiryTaskManager: expTime %s, interval %s, cancelExistingTask %d", - util::chrono::duration::to_string(expTime).c_str(), - util::chrono::duration::to_string(interval).c_str(), + to_string(expTime).c_str(), + to_string(interval).c_str(), cancelExistingTask); if (cancelExistingTask) { m_reactor->cancel_timer(handler, 1); diff --git a/cppcache/include/geode/Cacheable.hpp b/cppcache/src/HashMapOfException.hpp similarity index 65% copy from cppcache/include/geode/Cacheable.hpp copy to cppcache/src/HashMapOfException.hpp index 450bfb8..ed1aa44 100644 --- a/cppcache/include/geode/Cacheable.hpp +++ b/cppcache/src/HashMapOfException.hpp @@ -17,31 +17,30 @@ #pragma once -#ifndef GEODE_CACHEABLE_H_ -#define GEODE_CACHEABLE_H_ +#ifndef GEODE_HASHMAPOFEXCEPTION_H_ +#define GEODE_HASHMAPOFEXCEPTION_H_ -#include <memory> #include <unordered_map> -#include <unordered_set> +#include <memory> -#include "geode_globals.hpp" -#include "Serializable.hpp" -#include "util/functional.hpp" +#include <geode/internal/functional.hpp> namespace apache { namespace geode { namespace client { -typedef Serializable Cacheable; +class CacheableKey; +class Exception; -template <typename TVALUE> -inline std::shared_ptr<Cacheable> createValue( - const std::shared_ptr<TVALUE>& value) { - return std::dynamic_pointer_cast<Cacheable>(value); -} +using namespace apache::geode::client::internal; +typedef std::unordered_map<std::shared_ptr<CacheableKey>, + std::shared_ptr<Exception>, + dereference_hash<std::shared_ptr<CacheableKey>>, + dereference_equal_to<std::shared_ptr<CacheableKey>>> + HashMapOfException; } // namespace client } // namespace geode } // namespace apache -#endif // GEODE_CACHEABLE_H_ +#endif // GEODE_HASHMAPOFEXCEPTION_H_ diff --git a/cppcache/src/PdxTypeRegistry.hpp b/cppcache/src/PdxTypeRegistry.hpp index 7548deb..30957e5 100644 --- a/cppcache/src/PdxTypeRegistry.hpp +++ b/cppcache/src/PdxTypeRegistry.hpp @@ -28,6 +28,7 @@ #include <geode/PdxSerializable.hpp> #include <geode/Cache.hpp> +#include <geode/internal/functional.hpp> #include "PdxRemotePreservedData.hpp" #include "ReadWriteLock.hpp" @@ -35,7 +36,6 @@ #include "EnumInfo.hpp" #include "PreservedDataExpiryHandler.hpp" #include "ExpiryTaskManager.hpp" -#include "util/functional.hpp" namespace apache { namespace geode { diff --git a/cppcache/src/RegionInternal.hpp b/cppcache/src/RegionInternal.hpp index 29014cb..efd4993 100644 --- a/cppcache/src/RegionInternal.hpp +++ b/cppcache/src/RegionInternal.hpp @@ -28,6 +28,7 @@ #include "RegionStats.hpp" #include "EventId.hpp" +#include "HashMapOfException.hpp" namespace apache { namespace geode { diff --git a/cppcache/src/SystemProperties.cpp b/cppcache/src/SystemProperties.cpp index 31ad640..96c9662 100644 --- a/cppcache/src/SystemProperties.cpp +++ b/cppcache/src/SystemProperties.cpp @@ -23,7 +23,7 @@ #include <ace/DLL.h> #include <geode/geode_globals.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include <geode/SystemProperties.hpp> #include <geode/ExceptionTypes.hpp> #include <geode/CacheableKey.hpp> @@ -270,9 +270,9 @@ template <class _Rep, class _Period> void SystemProperties::parseDurationProperty( const std::string& property, const std::string& value, std::chrono::duration<_Rep, _Period>& duration) { + using namespace apache::geode::internal::chrono::duration; try { - duration = util::chrono::duration::from_string< - std::chrono::duration<_Rep, _Period>>(value); + duration = from_string<std::chrono::duration<_Rep, _Period>>(value); } catch (std::invalid_argument&) { throwError(("SystemProperties: non-duration " + property + "=" + value)); } @@ -383,6 +383,8 @@ void SystemProperties::processProperty(const std::string& property, } void SystemProperties::logSettings() { + using namespace apache::geode::internal::chrono::duration; + // *** PLEASE ADD IN ALPHABETICAL ORDER - USER VISIBLE *** std::string settings = "Geode Native Client System Properties:"; @@ -397,7 +399,7 @@ void SystemProperties::logSettings() { settings += autoReadyForEvents() ? "true" : "false"; settings += "\n bucket-wait-timeout = "; - settings += util::chrono::duration::to_string(bucketWaitTimeout()); + settings += to_string(bucketWaitTimeout()); settings += "\n cache-xml-file = "; settings += cacheXMLFile(); @@ -406,13 +408,13 @@ void SystemProperties::logSettings() { settings += conflateEvents(); settings += "\n connect-timeout = "; - settings += util::chrono::duration::to_string(connectTimeout()); + settings += to_string(connectTimeout()); settings += "\n connection-pool-size = "; settings += std::to_string(javaConnectionPoolSize()); settings += "\n connect-wait-timeout = "; - settings += util::chrono::duration::to_string(connectWaitTimeout()); + settings += to_string(connectWaitTimeout()); settings += "\n disable-chunk-handler-thread = "; settings += disableChunkHandlerThread() ? "true" : "false"; @@ -424,7 +426,7 @@ void SystemProperties::logSettings() { settings += durableClientId(); settings += "\n durable-timeout = "; - settings += util::chrono::duration::to_string(durableTimeout()); + settings += to_string(durableTimeout()); // *** PLEASE ADD IN ALPHABETICAL ORDER - USER VISIBLE *** @@ -459,10 +461,10 @@ void SystemProperties::logSettings() { settings += std::to_string(maxSocketBufferSize()); settings += "\n notify-ack-interval = "; - settings += util::chrono::duration::to_string(notifyAckInterval()); + settings += to_string(notifyAckInterval()); settings += "\n notify-dupcheck-life = "; - settings += util::chrono::duration::to_string(notifyDupCheckLife()); + settings += to_string(notifyDupCheckLife()); settings += "\n on-client-disconnect-clear-pdxType-Ids = "; settings += onClientDisconnectClearPdxTypeIds() ? "true" : "false"; @@ -470,10 +472,10 @@ void SystemProperties::logSettings() { // *** PLEASE ADD IN ALPHABETICAL ORDER - USER VISIBLE *** settings += "\n ping-interval = "; - settings += util::chrono::duration::to_string(pingInterval()); + settings += to_string(pingInterval()); settings += "\n redundancy-monitor-interval = "; - settings += util::chrono::duration::to_string(redundancyMonitorInterval()); + settings += to_string(redundancyMonitorInterval()); settings += "\n security-client-dhalgo = "; settings += securityClientDhAlgo(); @@ -497,13 +499,13 @@ void SystemProperties::logSettings() { settings += statisticsEnabled() ? "true" : "false"; settings += "\n statistic-sample-rate = "; - settings += util::chrono::duration::to_string(statisticsSampleInterval()); + settings += to_string(statisticsSampleInterval()); settings += "\n suspended-tx-timeout = "; - settings += util::chrono::duration::to_string(suspendedTxTimeout()); + settings += to_string(suspendedTxTimeout()); settings += "\n tombstone-timeout = "; - settings += util::chrono::duration::to_string(tombstoneTimeout()); + settings += to_string(tombstoneTimeout()); // *** PLEASE ADD IN ALPHABETICAL ORDER - USER VISIBLE *** diff --git a/cppcache/src/TcpConn.cpp b/cppcache/src/TcpConn.cpp index 7e683c3..d694c20 100644 --- a/cppcache/src/TcpConn.cpp +++ b/cppcache/src/TcpConn.cpp @@ -25,7 +25,7 @@ #include <geode/DistributedSystem.hpp> #include <geode/SystemProperties.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "TcpConn.hpp" #include "CacheImpl.hpp" @@ -162,6 +162,8 @@ void TcpConn::listen(const char *ipaddr, void TcpConn::listen(ACE_INET_Addr addr, std::chrono::microseconds waitSeconds) { + using namespace apache::geode::internal::chrono::duration; + GF_DEV_ASSERT(m_io != nullptr); ACE_SOCK_Acceptor listener(addr, 1); @@ -178,7 +180,7 @@ void TcpConn::listen(ACE_INET_Addr addr, if (lastError == ETIME || lastError == ETIMEDOUT) { throw TimeoutException( "TcpConn::listen Attempt to listen timed out after " + - util::chrono::duration::to_string(waitSeconds) + "."); + to_string(waitSeconds) + "."); } ACE_OS::snprintf(msg, 256, "TcpConn::listen failed with errno: %d: %s", lastError, ACE_OS::strerror(lastError)); @@ -203,6 +205,8 @@ void TcpConn::connect(const char *ipaddr, } void TcpConn::connect() { + using namespace apache::geode::internal::chrono::duration; + GF_DEV_ASSERT(m_io != nullptr); ACE_INET_Addr ipaddr = m_addr; @@ -230,7 +234,7 @@ void TcpConn::connect() { GF_SAFE_DELETE(m_io); throw TimeoutException( "TcpConn::connect Attempt to connect timed out after" + - util::chrono::duration::to_string(waitMicroSeconds) + "."); + to_string(waitMicroSeconds) + "."); } ACE_OS::snprintf(msg, 256, "TcpConn::connect failed with errno: %d: %s", lastError, ACE_OS::strerror(lastError)); diff --git a/cppcache/src/TcpSslConn.cpp b/cppcache/src/TcpSslConn.cpp index e8dc56c..5d214b1 100644 --- a/cppcache/src/TcpSslConn.cpp +++ b/cppcache/src/TcpSslConn.cpp @@ -55,6 +55,8 @@ void TcpSslConn::createSocket(ACE_SOCKET sock) { void TcpSslConn::listen(ACE_INET_Addr addr, std::chrono::microseconds waitSeconds) { + using namespace apache::geode::internal::chrono::duration; + GF_DEV_ASSERT(m_ssl != nullptr); int32_t retVal = m_ssl->listen(addr, waitSeconds); @@ -65,7 +67,7 @@ void TcpSslConn::listen(ACE_INET_Addr addr, if (lastError == ETIME || lastError == ETIMEDOUT) { throw TimeoutException( "TcpSslConn::listen Attempt to listen timed out after" + - util::chrono::duration::to_string(waitSeconds) + "."); + to_string(waitSeconds) + "."); } // sprintf( msg, "TcpSslConn::listen failed with errno: %d: %s", lastError, // ACE_OS::strerror(lastError) ); @@ -76,6 +78,8 @@ void TcpSslConn::listen(ACE_INET_Addr addr, } void TcpSslConn::connect() { + using namespace apache::geode::internal::chrono::duration; + GF_DEV_ASSERT(m_ssl != nullptr); ACE_OS::signal(SIGPIPE, SIG_IGN); // Ignore broken pipe @@ -97,7 +101,7 @@ void TcpSslConn::connect() { GF_SAFE_DELETE(m_ssl); throw TimeoutException( "TcpSslConn::connect Attempt to connect timed out after " + - util::chrono::duration::to_string(waitMicroSeconds) + "."); + to_string(waitMicroSeconds) + "."); } ACE_OS::snprintf(msg, 256, "TcpSslConn::connect failed with errno: %d: %s", lastError, ACE_OS::strerror(lastError)); diff --git a/cppcache/src/ThinClientRegion.hpp b/cppcache/src/ThinClientRegion.hpp index cdea10c..d454e18 100644 --- a/cppcache/src/ThinClientRegion.hpp +++ b/cppcache/src/ThinClientRegion.hpp @@ -34,7 +34,7 @@ #include "TcrChunkedContext.hpp" #include "CacheableObjectPartList.hpp" #include "ClientMetadataService.hpp" -#include "util/functional.hpp" +#include <geode/internal/functional.hpp> /** * @file */ diff --git a/cppcache/src/TombstoneList.hpp b/cppcache/src/TombstoneList.hpp index 774e6d5..79bbe64 100644 --- a/cppcache/src/TombstoneList.hpp +++ b/cppcache/src/TombstoneList.hpp @@ -30,7 +30,7 @@ #include <geode/CacheableBuiltins.hpp> #include "MapEntry.hpp" -#include "util/functional.hpp" +#include <geode/internal/functional.hpp> namespace apache { namespace geode { diff --git a/cppcache/src/util/chrono/duration.cpp b/cppcache/src/internal/duration.cpp similarity index 93% rename from cppcache/src/util/chrono/duration.cpp rename to cppcache/src/internal/duration.cpp index c2424a7..ef001bf 100644 --- a/cppcache/src/util/chrono/duration.cpp +++ b/cppcache/src/internal/duration.cpp @@ -15,11 +15,11 @@ * limitations under the License. */ -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> namespace apache { namespace geode { -namespace util { +namespace internal { namespace chrono { namespace duration { @@ -32,6 +32,6 @@ constexpr char const* _suffix<std::nano>::value; } // namespace duration } // namespace chrono -} // namespace util +} // namespace internal } // namespace geode } // namespace apache diff --git a/cppcache/src/util/chrono/duration_bounds.hpp b/cppcache/src/util/chrono/duration_bounds.hpp index 38f2730..17d87a2 100644 --- a/cppcache/src/util/chrono/duration_bounds.hpp +++ b/cppcache/src/util/chrono/duration_bounds.hpp @@ -32,6 +32,7 @@ namespace chrono { namespace duration { using namespace apache::geode::client; +using namespace apache::geode::internal::chrono::duration; template <class LimitRep, class LimitPeriod, LimitRep lower = std::numeric_limits<LimitRep>::lowest(), diff --git a/cppcache/src/util/functional.cpp b/cppcache/src/util/functional.cpp index 15dbad2..76aca54 100644 --- a/cppcache/src/util/functional.cpp +++ b/cppcache/src/util/functional.cpp @@ -19,19 +19,21 @@ #include <codecvt> #include <locale> -#include <geode/util/functional.hpp> +#include <geode/internal/functional.hpp> #include "string.hpp" namespace apache { namespace geode { namespace client { +namespace internal { int32_t geode_hash<std::string>::operator()(const std::string& val) { // TODO string optimize without conversion to UTF-16 return geode_hash<std::u16string>{}(to_utf16(val)); } +} // namespace internal } // namespace client } // namespace geode } // namespace apache diff --git a/cppcache/src/util/functional.hpp b/cppcache/src/util/functional.hpp deleted file mode 100644 index e5fee78..0000000 --- a/cppcache/src/util/functional.hpp +++ /dev/null @@ -1,118 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#pragma once - -#ifndef GEODE_UTIL_FUNCTIONAL_H_ -#define GEODE_UTIL_FUNCTIONAL_H_ - -#include <functional> -#include <memory> -#include <type_traits> -#include <string> -#include <codecvt> -#include <locale> - -#include "string.hpp" - -namespace apache { -namespace geode { -namespace client { - -template <class _T> -struct dereference_hash; - -template <class _T> -struct dereference_hash<std::shared_ptr<_T>> - : public std::unary_function<std::shared_ptr<_T>, size_t> { - size_t operator()(const std::shared_ptr<_T>& val) const { - return std::hash<_T>{}(*val); - } -}; - -template <class _T> -struct dereference_hash<_T*> : public std::unary_function<_T*, size_t> { - typedef _T* argument_type; - size_t operator()(const argument_type& val) const { - return std::hash<_T>{}(*val); - } -}; - -template <class _T> -struct dereference_equal_to; - -template <class _T> -struct dereference_equal_to<std::shared_ptr<_T>> - : public std::binary_function<std::shared_ptr<_T>, std::shared_ptr<_T>, - bool> { - constexpr bool operator()(const std::shared_ptr<_T>& lhs, - const std::shared_ptr<_T>& rhs) const { - return std::equal_to<_T>{}(*lhs, *rhs); - } -}; - -template <class _T> -struct dereference_equal_to<_T*> : std::equal_to<_T*> { - typedef _T* first_argument_type; - typedef _T* second_argument_type; - constexpr bool operator()(const first_argument_type& lhs, - const second_argument_type& rhs) const { - return std::equal_to<_T>{}(*lhs, *rhs); - } -}; - -/** - * Hashes based on the same algorithm used in the Geode server. - * - * @tparam _T class type to hash. - */ -template <class _T> -struct geode_hash { - typedef _T argument_type; - int32_t operator()(const argument_type& val); -}; - -/** - * Hashes like java.lang.String - */ -template <> -struct geode_hash<std::u16string> { - inline int32_t operator()(const std::u16string& val) { - int32_t hash = 0; - for (auto&& c : val) { - hash = 31 * hash + c; - } - return hash; - } -}; - -/** - * Hashes like java.lang.String - */ -template <> -struct geode_hash<std::string> { - inline int32_t operator()(const std::string& val) { - // TODO string optimize without conversion to UTF-16 - return geode_hash<std::u16string>{}(to_utf16(val)); - } -}; - -} // namespace client -} // namespace geode -} // namespace apache - -#endif // GEODE_UTIL_FUNCTIONAL_H_ diff --git a/cppcache/test/CacheableStringEqualityTest.cpp b/cppcache/test/CacheableStringEqualityTest.cpp index ad71d7f..7f3ef7b 100644 --- a/cppcache/test/CacheableStringEqualityTest.cpp +++ b/cppcache/test/CacheableStringEqualityTest.cpp @@ -22,7 +22,7 @@ #include <unordered_map> #include <geode/CacheableString.hpp> -#include <geode/util/functional.hpp> +#include <geode/internal/functional.hpp> using namespace apache::geode::client; diff --git a/cppcache/test/util/chrono/durationTest.cpp b/cppcache/test/util/chrono/durationTest.cpp index 9565a85..262d212 100644 --- a/cppcache/test/util/chrono/durationTest.cpp +++ b/cppcache/test/util/chrono/durationTest.cpp @@ -20,10 +20,11 @@ #include <gtest/gtest.h> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "util/chrono/duration_bounds.hpp" +using namespace apache::geode::internal::chrono::duration; using namespace apache::geode::util::chrono::duration; TEST(util_chrono_durationTest, ceil) { diff --git a/cppcache/test/util/functionalTests.cpp b/cppcache/test/util/functionalTests.cpp index cc2ad34..410ccbc 100644 --- a/cppcache/test/util/functionalTests.cpp +++ b/cppcache/test/util/functionalTests.cpp @@ -19,9 +19,9 @@ #include <gtest/gtest.h> -#include <geode/util/functional.hpp> +#include <geode/internal/functional.hpp> -using namespace apache::geode::client; +using namespace apache::geode::client::internal; TEST(string, geode_hash) { auto&& hash = geode_hash<std::string>{}; diff --git a/tests/cpp/fwklib/FrameworkTest.cpp b/tests/cpp/fwklib/FrameworkTest.cpp index 0d80f8a..1f5ab2d 100644 --- a/tests/cpp/fwklib/FrameworkTest.cpp +++ b/tests/cpp/fwklib/FrameworkTest.cpp @@ -17,7 +17,7 @@ #include <geode/AttributesFactory.hpp> #include <geode/PoolFactory.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "fwklib/FrameworkTest.hpp" #include "fwklib/TestClient.hpp" @@ -479,7 +479,7 @@ void FrameworkTest::setTestScheme() { } std::string FrameworkTest::poolAttributesToString(std::shared_ptr<Pool>& pool) { - using namespace apache::geode::util::chrono::duration; + using namespace apache::geode::internal::chrono::duration; std::string sString; sString += "\npoolName: "; @@ -511,7 +511,8 @@ std::string FrameworkTest::poolAttributesToString(std::shared_ptr<Pool>& pool) { sString += "\nServerGroup: "; sString += pool->getServerGroup(); sString += "\nIdleTimeout: "; - sString += util::chrono::duration::to_string(pool->getIdleTimeout()); + sString += apache::geode::internal::chrono::duration::to_string( + pool->getIdleTimeout()); sString += "\nPingInterval: "; sString += to_string(pool->getPingInterval()); sString += "\nThreadLocalConnections: "; diff --git a/tests/cpp/fwklib/FwkObjects.hpp b/tests/cpp/fwklib/FwkObjects.hpp index 9b188ad..e8afcbe 100644 --- a/tests/cpp/fwklib/FwkObjects.hpp +++ b/tests/cpp/fwklib/FwkObjects.hpp @@ -35,7 +35,7 @@ #include <geode/RegionAttributes.hpp> #include <geode/AttributesFactory.hpp> #include <geode/PoolManager.hpp> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "fwklib/FwkStrCvt.hpp" #include "fwklib/FwkLog.hpp" @@ -502,12 +502,14 @@ class FwkPool { void setFreeConnectionTimeout(std::string val) { m_poolFactory->setFreeConnectionTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setLoadConditioningInterval(std::string val) { m_poolFactory->setLoadConditioningInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setSocketBufferSize(std::string val) { @@ -516,7 +518,8 @@ class FwkPool { void setReadTimeout(std::string val) { m_poolFactory->setReadTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setMinConnections(std::string val) { @@ -529,7 +532,8 @@ class FwkPool { void setIdleTimeout(std::string val) { m_poolFactory->setIdleTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setRetryAttempts(std::string val) { @@ -538,12 +542,14 @@ class FwkPool { void setPingInterval(std::string val) { m_poolFactory->setPingInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setStatisticInterval(std::string val) { m_poolFactory->setStatisticInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setServerGroup(std::string val) { @@ -560,12 +566,14 @@ class FwkPool { void setSubscriptionMessageTrackingTimeout(std::string val) { m_poolFactory->setSubscriptionMessageTrackingTimeout( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setSubscriptionAckInterval(std::string val) { m_poolFactory->setSubscriptionAckInterval( - util::chrono::duration::from_string<std::chrono::milliseconds>(val)); + apache::geode::internal::chrono::duration::from_string< + std::chrono::milliseconds>(val)); } void setThreadLocalConnections(std::string val) { diff --git a/tests/cpp/fwklib/RegionHelper.hpp b/tests/cpp/fwklib/RegionHelper.hpp index 58f1886..9f4cad9 100644 --- a/tests/cpp/fwklib/RegionHelper.hpp +++ b/tests/cpp/fwklib/RegionHelper.hpp @@ -24,7 +24,7 @@ #include <string> #include <map> -#include <geode/util/chrono/duration.hpp> +#include <geode/internal/chrono/duration.hpp> #include "fwklib/FrameworkTest.hpp" #include "fwklib/FwkObjects.hpp" @@ -36,7 +36,7 @@ namespace geode { namespace client { namespace testframework { -using namespace apache::geode::util::chrono::duration; +using namespace apache::geode::internal::chrono::duration; // ---------------------------------------------------------------------------- -- To stop receiving notification emails like this one, please contact ['"commits@geode.apache.org" <commits@geode.apache.org>'].