You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by bb...@apache.org on 2020/12/18 19:15:14 UTC

[geode-native] branch develop updated: Revert "GEODE-8702: Add StringPrefixPartitionResolver (#692)" - This breaks the build on RHEL7, so reverting and reopening the PR until it can be resolved

This is an automated email from the ASF dual-hosted git repository.

bbender 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 f632e30  Revert "GEODE-8702: Add StringPrefixPartitionResolver (#692)" - This breaks the build on RHEL7, so reverting and reopening the PR until it can be resolved
f632e30 is described below

commit f632e307a45310f4f18c9ef7e8d6c8809b72e194
Author: Blake Bender <bb...@vmware.com>
AuthorDate: Fri Dec 18 11:14:14 2020 -0800

    Revert "GEODE-8702: Add StringPrefixPartitionResolver (#692)"
    - This breaks the build on RHEL7, so reverting and reopening the PR until it can be resolved
    
    This reverts commit 34de4ce963b2ea4ae9955827cbce07e33b0c62e8.
---
 .../geode/StringPrefixPartitionResolver.hpp        | 68 ----------------------
 cppcache/src/StringPrefixPartitionResolver.cpp     | 63 --------------------
 cppcache/test/CMakeLists.txt                       |  1 -
 .../test/StringPrefixPartitionResolverTest.cpp     | 68 ----------------------
 4 files changed, 200 deletions(-)

diff --git a/cppcache/include/geode/StringPrefixPartitionResolver.hpp b/cppcache/include/geode/StringPrefixPartitionResolver.hpp
deleted file mode 100644
index d1fb0de..0000000
--- a/cppcache/include/geode/StringPrefixPartitionResolver.hpp
+++ /dev/null
@@ -1,68 +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_STRINGPREFIXPARTITIONRESOLVER_H_
-#define GEODE_STRINGPREFIXPARTITIONRESOLVER_H_
-
-#include "PartitionResolver.hpp"
-
-namespace apache {
-namespace geode {
-namespace client {
-
-class CacheableKey;
-class EntryEvent;
-
-/**
- * This class implements a partition resolver which routing object is
- * the prefix of a given key.
- * Delimiter is set by default to '|', still can be changed.
- * @note If prefix is not found in the key an IllegalArgumentException is thrown
- *
- * Examples:
- *  - Given key "key-1|timestamp", with delimiter '|', the routing object would
- *    be "key-1"
- *  - Given "key-1#DELIM#timestamp", with delimiter '|', then an exception is
- *    thrown.
- */
-class APACHE_GEODE_EXPORT StringPrefixPartitionResolver
-    : public PartitionResolver {
- public:
-  StringPrefixPartitionResolver();
-  explicit StringPrefixPartitionResolver(std::string delimiter);
-
-  StringPrefixPartitionResolver(const StringPrefixPartitionResolver&) = delete;
-
-  ~StringPrefixPartitionResolver() override = default;
-
-  void operator=(const StringPrefixPartitionResolver&) = delete;
-
-  const std::string& getName() override;
-
-  std::shared_ptr<CacheableKey> getRoutingObject(
-      const EntryEvent& opDetails) override;
-
- protected:
-  std::string delimiter_;
-};
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
-
-#endif  // GEODE_STRINGPREFIXPARTITIONRESOLVER_H_
diff --git a/cppcache/src/StringPrefixPartitionResolver.cpp b/cppcache/src/StringPrefixPartitionResolver.cpp
deleted file mode 100644
index 5a34883..0000000
--- a/cppcache/src/StringPrefixPartitionResolver.cpp
+++ /dev/null
@@ -1,63 +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.
- */
-
-#include <geode/CacheableKey.hpp>
-#include <geode/EntryEvent.hpp>
-#include <geode/StringPrefixPartitionResolver.hpp>
-
-namespace {
-const char* const DEFAULT_DELIMITER = "|";
-}
-
-namespace apache {
-namespace geode {
-namespace client {
-
-StringPrefixPartitionResolver::StringPrefixPartitionResolver()
-    : StringPrefixPartitionResolver(DEFAULT_DELIMITER) {}
-
-StringPrefixPartitionResolver::StringPrefixPartitionResolver(
-    std::string delimiter)
-    : PartitionResolver(), delimiter_(std::move(delimiter)) {}
-
-const std::string& StringPrefixPartitionResolver::getName() {
-  static std::string name = "StringPrefixPartitionResolver";
-  return name;
-}
-
-std::shared_ptr<CacheableKey> StringPrefixPartitionResolver::getRoutingObject(
-    const EntryEvent& event) {
-  auto&& key = event.getKey();
-  if (key == nullptr) {
-    return {};
-  }
-
-  auto key_str = key->toString();
-  auto pos = key_str.find(delimiter_);
-
-  if (pos == std::string::npos) {
-    throw IllegalArgumentException("The key \"" + key_str +
-                                   "\" does not contains the \"" + delimiter_ +
-                                   "\" delimiter.");
-  }
-
-  return CacheableKey::create(key_str.substr(0, pos));
-}
-
-}  // namespace client
-}  // namespace geode
-}  // namespace apache
diff --git a/cppcache/test/CMakeLists.txt b/cppcache/test/CMakeLists.txt
index d821e32..2fee415 100644
--- a/cppcache/test/CMakeLists.txt
+++ b/cppcache/test/CMakeLists.txt
@@ -48,7 +48,6 @@ add_executable(apache-geode_unittests
   QueueConnectionRequestTest.cpp
   RegionAttributesFactoryTest.cpp
   SerializableCreateTests.cpp
-  StringPrefixPartitionResolverTest.cpp
   StructSetTest.cpp
   TcrMessageTest.cpp
   ThreadPoolTest.cpp
diff --git a/cppcache/test/StringPrefixPartitionResolverTest.cpp b/cppcache/test/StringPrefixPartitionResolverTest.cpp
deleted file mode 100644
index 45ca65e..0000000
--- a/cppcache/test/StringPrefixPartitionResolverTest.cpp
+++ /dev/null
@@ -1,68 +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.
- */
-
-#include <gtest/gtest.h>
-
-#include <geode/CacheableKey.hpp>
-#include <geode/EntryEvent.hpp>
-#include <geode/StringPrefixPartitionResolver.hpp>
-
-using apache::geode::client::CacheableKey;
-using apache::geode::client::EntryEvent;
-using apache::geode::client::IllegalArgumentException;
-using apache::geode::client::StringPrefixPartitionResolver;
-
-TEST(StringPrefixPartitionResolverTest, testGetName) {
-  EXPECT_EQ(StringPrefixPartitionResolver{}.getName(),
-            "StringPrefixPartitionResolver");
-}
-
-TEST(StringPrefixPartitionResolverTest, testWithNullKey) {
-  StringPrefixPartitionResolver pr;
-  EntryEvent event{nullptr, nullptr, nullptr, nullptr, nullptr, false};
-
-  auto key = pr.getRoutingObject(event);
-  EXPECT_FALSE(key);
-}
-
-TEST(StringPrefixPartitionResolverTest, testWithDefaultDelimiter) {
-  StringPrefixPartitionResolver pr;
-  auto key = CacheableKey::create("prefix|suffix");
-  EntryEvent event{nullptr, key, nullptr, nullptr, nullptr, false};
-
-  key = pr.getRoutingObject(event);
-  EXPECT_TRUE(key);
-  EXPECT_EQ(key->toString(), "prefix");
-}
-
-TEST(StringPrefixPartitionResolverTest, testWithCustomDelimiter) {
-  StringPrefixPartitionResolver pr{"$#"};
-  auto key = CacheableKey::create("prefix$#suffix");
-  EntryEvent event{nullptr, key, nullptr, nullptr, nullptr, false};
-
-  key = pr.getRoutingObject(event);
-  EXPECT_TRUE(key);
-  EXPECT_EQ(key->toString(), "prefix");
-}
-
-TEST(StringPrefixPartitionResolverTest, testNoDelimiterFound) {
-  StringPrefixPartitionResolver pr;
-  auto key = CacheableKey::create("prefix-suffix");
-  EntryEvent event{nullptr, key, nullptr, nullptr, nullptr, false};
-
-  EXPECT_THROW(pr.getRoutingObject(event), IllegalArgumentException);
-}