You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/10/09 04:24:17 UTC

[GitHub] [incubator-kvrocks] PragmaTwice commented on a diff in pull request #966: Move TCL test integration/slotimport to Go case

PragmaTwice commented on code in PR #966:
URL: https://github.com/apache/incubator-kvrocks/pull/966#discussion_r990730768


##########
tests/gocase/util/slot.go:
##########
@@ -0,0 +1,852 @@
+/*
+ * 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 util
+
+func GetKeyWithSlotNum(slotNum int) string {
+	return slotTable[slotNum]
+}
+
+// A table of the shortest possible alphanumeric string that is mapped by
+// redis's crc16 to any given redis cluster slot.
+//
+// The array indexes are slot numbers, so that given a desired slot, this string is guaranteed
+// to make redis cluster route a request to the shard holding this slot
+var slotTable = [...]string{

Review Comment:
   Could some comments be added to explain how this table was generated?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@kvrocks.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org