-
Notifications
You must be signed in to change notification settings - Fork 5.5k
filter: add HazelcastHttpCache #10536
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from 23 commits
Commits
Show all changes
35 commits
Select commit
Hold shift + click to select a range
3ff732d
Add HazelcastHttpCache
enozcan c39db10
Secure body key uniqueness and set defaults.
enozcan f359a8e
Use Envoy's random for versioning.
enozcan d6f2568
Handle all connection failures. Use parameterized test for common ones.
enozcan 8630701
Add local cache to use during tests.
enozcan 2232761
Add plugin doc and fix spell check.
enozcan 8ca71fc
Fix code format & clean up.
enozcan a3a1af4
Fix clang_tidy errors.
enozcan 31c0b3c
Apply upstream changes
enozcan cabb409
Disable PartitionAware for body entries.
enozcan fc5c3ee
Merge branch 'master' into hazelcast_http_cache
enozcan 7334709
Fix format and revert LookupRequest changes back.
enozcan 839c418
Add serialization tests.
enozcan 2576ebc
Move remote calls to cache accessors.
enozcan fde9e19
Change key serialization from UTF to byte array.
enozcan 104f8e0
Update plugin doc.
enozcan 1f152b5
Fix asan errors other than bitswap.
enozcan 3ebb754
Add header eviction listener.
enozcan 7665fa0
Allow overriding cached responses.
enozcan c2801f4
Add Bits.h patch for ubsan fix.
enozcan 9172525
Fix clang warns.
enozcan bb9ce1e
Cover remote calls over offline client.
enozcan ce6651b
tsan fix
enozcan 8e3129a
Address reviews.
enozcan 570e362
Use max_body_bytes from CacheConfig.
enozcan 66a1f01
Use core.SocketAddress for member address.
enozcan 0acc4d1
Fix format.
enozcan d3b0cf5
Fix Windows lib name.
enozcan d40185f
Merge branch 'master' into hazelcast_http_cache
enozcan eb50942
Fix format.
enozcan 7413c54
Remove accessor cast and move logs to accessor.
enozcan a1167a1
Pass accessor via cache::start
enozcan 639bfbb
Revert back to unit64 max body bytes.
enozcan ab2f3fd
Add tests.
enozcan 49ca85b
Add Windows build defines.
enozcan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| --- CMakeLists.txt 2020-02-27 11:35:35.000000000 +0300 | ||
| +++ CMakeLists.txt 2020-02-27 11:37:15.000000000 +0300 | ||
| @@ -14,6 +14,7 @@ | ||
| # limitations under the License. | ||
| # | ||
| cmake_minimum_required (VERSION 2.6.4) | ||
| +set(CMAKE_CXX_COMPILER_WORKS 1) | ||
| project (HazelcastClient) | ||
|
|
||
| # FLAGS | ||
| @@ -279,3 +280,9 @@ | ||
| ADD_SUBDIRECTORY(examples) | ||
| message(STATUS "Configured to build the examples.") | ||
| ENDIF(HZ_BUILD_EXAMPLES) | ||
| +INSTALL(TARGETS ${HZ_LIB_NAME} DESTINATION lib) | ||
| +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/hazelcast/generated-sources/include/hazelcast DESTINATION include FILES_MATCHING PATTERN "*.h") | ||
| +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/hazelcast/include/hazelcast DESTINATION include FILES_MATCHING PATTERN "*.h" PATTERN "*.inl") | ||
| +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/external/release_include/boost DESTINATION include FILES_MATCHING PATTERN "*.hpp" PATTERN "*.h") | ||
| +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/external/release_include/easylogging++ DESTINATION include FILES_MATCHING PATTERN "*.h") | ||
| +INSTALL(DIRECTORY ${PROJECT_SOURCE_DIR}/external/include/asio/asio/include/asio DESTINATION include FILES_MATCHING PATTERN "*.hpp") | ||
|
|
||
| --- hazelcast/include/hazelcast/util/Bits.h 2020-01-28 11:42:05.000000000 +0300 | ||
| +++ hazelcast/include/hazelcast/util/Bits.h 2020-05-22 23:11:16.000000000 +0300 | ||
| @@ -26,6 +26,7 @@ | ||
| #endif | ||
|
|
||
| #include <stdint.h> | ||
| +#include <string.h> // This patch fixes asan build for Envoy Http Cache. | ||
|
|
||
| #if defined(linux) || defined(__linux__) || defined (__GLIBC__) || defined(__GNU__) | ||
|
|
||
| @@ -124,7 +125,7 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_2(source, target); | ||
| #else | ||
| - *(static_cast<uint16_t *>(target)) = *(static_cast<const uint16_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint16_t)); | ||
| #endif | ||
| } | ||
|
|
||
| @@ -136,7 +137,7 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_4(source, target); | ||
| #else | ||
| - *(static_cast<uint32_t *>(target)) = *(static_cast<const uint32_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint32_t)); | ||
| #endif | ||
| } | ||
|
|
||
| @@ -148,7 +149,7 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_8(source, target); | ||
| #else | ||
| - *(static_cast<uint64_t *>(target)) = *(static_cast<const uint64_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint64_t)); | ||
| #endif | ||
| } | ||
|
|
||
| @@ -170,7 +171,7 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_2(source, target); | ||
| #else | ||
| - *(static_cast<uint16_t *>(target)) = *(static_cast<const uint16_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint16_t)); | ||
| #endif | ||
| } | ||
|
|
||
| @@ -182,7 +183,7 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_4(source, target); | ||
| #else | ||
| - *(static_cast<uint32_t *>(target)) = *(static_cast<const uint32_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint32_t)); | ||
| #endif | ||
| } | ||
|
|
||
| @@ -194,13 +195,15 @@ | ||
| #ifdef HZ_BIG_ENDIAN | ||
| swap_8(source, target); | ||
| #else | ||
| - *(static_cast<uint64_t *>(target)) = *(static_cast<const uint64_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint64_t)); | ||
| #endif | ||
| } | ||
|
|
||
| inline static int32_t readIntB(std::vector<byte> &buffer, unsigned long pos) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - return *((int32_t *) (&buffer[0] + pos)); | ||
| + int32_t result; | ||
| + memcpy(&result, (&buffer[0] + pos), sizeof(int32_t)); | ||
| + return result; | ||
| #else | ||
| int32_t result; | ||
| swap_4(&(buffer[0]) + pos, &result); | ||
| @@ -215,7 +218,7 @@ | ||
| */ | ||
| inline static void bigEndianToNative2(const void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint16_t *>(target)) = *(static_cast<const uint16_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint16_t)); | ||
| #else | ||
| swap_2(source, target); | ||
| #endif | ||
| @@ -227,7 +230,7 @@ | ||
| */ | ||
| inline static void bigEndianToNative4(const void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint32_t *>(target)) = *(static_cast<const uint32_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint32_t)); | ||
| #else | ||
| swap_4(source, target); | ||
| #endif | ||
| @@ -239,7 +242,7 @@ | ||
| */ | ||
| inline static void bigEndianToNative8(const void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint64_t *>(target)) = *(static_cast<const uint64_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint64_t)); | ||
| #else | ||
| swap_8(source, target); | ||
| #endif | ||
| @@ -251,7 +254,7 @@ | ||
| */ | ||
| inline static void nativeToBigEndian2(void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint16_t *>(target)) = *(static_cast<const uint16_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint16_t)); | ||
| #else | ||
| swap_2(source, target); | ||
|
|
||
| @@ -264,7 +267,7 @@ | ||
| */ | ||
| inline static void nativeToBigEndian4(const void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint32_t *>(target)) = *(static_cast<const uint32_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint32_t)); | ||
| #else | ||
| swap_4(source, target); | ||
| #endif | ||
| @@ -276,7 +279,7 @@ | ||
| */ | ||
| inline static void nativeToBigEndian8(void *source, void *target) { | ||
| #ifdef HZ_BIG_ENDIAN | ||
| - *(static_cast<uint64_t *>(target)) = *(static_cast<const uint64_t *>(source)); | ||
| + memcpy(target, source, sizeof(uint64_t)); | ||
| #else | ||
| swap_8(source, target); | ||
| #endif | ||
| @@ -286,25 +289,32 @@ | ||
|
|
||
| private : | ||
| inline static void swap_2(const void *orig, void* target) { | ||
| - *reinterpret_cast<uint16_t *> (target) = | ||
| - bswap16 (*reinterpret_cast<uint16_t const *> (orig)); | ||
| + uint16_t raw; | ||
| + memcpy(&raw, orig, sizeof(uint16_t)); | ||
| + uint16_t swapped = bswap16(raw); | ||
| + memcpy(target, &swapped, sizeof(uint16_t)); | ||
| } | ||
|
|
||
| inline static void swapInplace4(void *orig) { | ||
| - uint32_t value = * reinterpret_cast<const uint32_t*> (orig); | ||
| + uint32_t value; | ||
| + memcpy(&value, orig, sizeof(uint32_t)); | ||
| swap_4(&value, orig); | ||
| } | ||
|
|
||
| inline static void swap_4 (const void* orig, void* target) | ||
| { | ||
| - *reinterpret_cast<uint32_t *> (target) = | ||
| - bswap32 (*reinterpret_cast<uint32_t const *> (orig)); | ||
| + uint32_t raw; | ||
| + memcpy(&raw, orig, sizeof(uint32_t)); | ||
| + uint32_t swapped = bswap32(raw); | ||
| + memcpy(target, &swapped, sizeof(uint32_t)); | ||
| } | ||
|
|
||
| inline static void swap_8 (const void* orig, void* target) | ||
| { | ||
| - *reinterpret_cast<uint64_t *> (target) = | ||
| - bswap64 (*reinterpret_cast<uint64_t const *> (orig)); | ||
| + uint64_t raw; | ||
| + memcpy(&raw, orig, sizeof(uint64_t)); | ||
| + uint64_t swapped = bswap64(raw); | ||
| + memcpy(target, &swapped, sizeof(uint64_t)); | ||
| } | ||
| }; | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to update submodules before building the external dependency?