Github user ggreen commented on a diff in the pull request: https://github.com/apache/geode/pull/404#discussion_r104974260 --- Diff: geode-core/src/main/java/org/apache/geode/redis/internal/executor/hash/HashInterpreter.java --- @@ -0,0 +1,126 @@ +/* + * 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. + */ +package org.apache.geode.redis.internal.executor.hash; + +import java.util.Map; + +import org.apache.geode.cache.Region; +import org.apache.geode.redis.GeodeRedisServer; +import org.apache.geode.redis.internal.ByteArrayWrapper; +import org.apache.geode.redis.internal.Coder; +import org.apache.geode.redis.internal.ExecutionHandlerContext; +import org.apache.geode.redis.internal.RedisDataType; + +/** + * Utility class for interpreting and processing Redis Hash data structure + * + * + */ +public class HashInterpreter { + + /** + * <pre> + * The region:key separator. + * + * REGION_KEY_SEPERATOR = ":" + * + * See Hash section of <a href= + "https://redis.io/topics/data-types">https://redis.io/topics/data-types#Hashes</a> + * </pre> + */ + public static final String REGION_KEY_SEPERATOR = ":"; + + /** + * The default hash region name REGION_HASH_REGION = Coder.stringToByteArrayWrapper("ReDiS_HASH") + */ + public static final ByteArrayWrapper REGION_HASH_REGION = + Coder.stringToByteArrayWrapper(GeodeRedisServer.HASH_REGION); + + /** + * Return the region presenting the hash + * + * @param key the raw Redis command key that may contain the region:key formation + * @param context the exception handler context + * @return the region were the command's data will be processed + */ + @SuppressWarnings("unchecked") + public static Region<ByteArrayWrapper, Map<ByteArrayWrapper, ByteArrayWrapper>> getRegion( --- End diff -- @galen-pivotal: I really like the idea of a single region. The less the number of regions, then the less overhead, but for now I just limited the change to using the Redis_Hash region. This same region will be used for HASH data types of objects and non-objects. This pull request was originally based on an attempt to get some Spring Data Redis example code to work with the GemFire Redis adaptor. Also, @wwilliams-pivotal and @hiteshk25: I believe I incorporated your observations. I also tried to improve the integration tests for the hash related commands. Please review my latest commit, and let me know if any additional changes are needed as a pre-requisite for accepting this pull request.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---