refactor: Optimize table.go
This commit is contained in:
parent
99725f9e0a
commit
8d239aeebc
File diff suppressed because it is too large
Load Diff
|
@ -3,7 +3,6 @@
|
|||
"summary": "TairHash, Insert a field into the TairHash specified by the key",
|
||||
"complexity": "O(1)",
|
||||
"group": "TairHash",
|
||||
"container": "TairHash",
|
||||
"function": "exhsetCommand",
|
||||
"key_specs": [
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"summary": "TairString, Set the value of a key",
|
||||
"complexity": "O(1)",
|
||||
"group": "TairString",
|
||||
"container": "TairString",
|
||||
"function": "exsetCommand",
|
||||
"key_specs": [
|
||||
{
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
"summary": "TairZset, Adds all the specified members with the specified (multi)scores to the tairzset stored at key",
|
||||
"complexity": "O(N)",
|
||||
"group": "TairZset",
|
||||
"container": "TairZset",
|
||||
"function": "exzaddCommand",
|
||||
"key_specs": [
|
||||
{
|
||||
|
|
|
@ -51,6 +51,188 @@ for group, cmds in j["table"].items():
|
|||
fp.write('},\n')
|
||||
fp.write('},\n')
|
||||
fp.write('},\n')
|
||||
fp.write("""
|
||||
"BF.ADD": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.CARD": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.EXISTS": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.INFO": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.INSERT": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.LOADCHUNK": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.MADD": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.MEXISTS": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.RESERVE": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
"BF.SCANDUMP": {
|
||||
"BLOOM FILTER",
|
||||
[]keySpec{
|
||||
{
|
||||
"index",
|
||||
1,
|
||||
"",
|
||||
0,
|
||||
"range",
|
||||
0,
|
||||
1,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
},
|
||||
},
|
||||
},
|
||||
""")
|
||||
fp.write('}\n')
|
||||
fp.close()
|
||||
os.system("go fmt table.go")
|
||||
|
|
|
@ -5,33 +5,33 @@ commands_dir = "./commands"
|
|||
files = os.listdir(commands_dir)
|
||||
table = {}
|
||||
container = set()
|
||||
files = sorted(files)
|
||||
for file in files:
|
||||
j = json.load(open(f"{commands_dir}/{file}"))
|
||||
cmd_name = list(j.keys())[0]
|
||||
j = j[cmd_name]
|
||||
content = json.load(open(f"{commands_dir}/{file}"))
|
||||
for cmd_name, j in content.items():
|
||||
print(cmd_name)
|
||||
if cmd_name in ("SORT", "SORT_RO", "MIGRATE"):
|
||||
continue
|
||||
|
||||
print(cmd_name)
|
||||
if cmd_name in ("SORT", "SORT_RO", "MIGRATE"):
|
||||
continue
|
||||
group = j["group"]
|
||||
key_specs = []
|
||||
if "key_specs" in j:
|
||||
for key_spec in j["key_specs"]:
|
||||
begin_search = key_spec["begin_search"]
|
||||
find_keys = key_spec["find_keys"]
|
||||
key_specs.append({
|
||||
"begin_search": begin_search,
|
||||
"find_keys": find_keys
|
||||
})
|
||||
if "container" in j:
|
||||
cmd_name = j["container"] + "-" + cmd_name
|
||||
container.add(j["container"])
|
||||
|
||||
group = j["group"]
|
||||
key_specs = []
|
||||
if "key_specs" in j:
|
||||
for key_spec in j["key_specs"]:
|
||||
begin_search = key_spec["begin_search"]
|
||||
find_keys = key_spec["find_keys"]
|
||||
key_specs.append({
|
||||
"begin_search": begin_search,
|
||||
"find_keys": find_keys
|
||||
})
|
||||
if "container" in j:
|
||||
cmd_name = j["container"] + "-" + cmd_name
|
||||
container.add(j["container"])
|
||||
|
||||
if group not in table:
|
||||
table[group] = {}
|
||||
table[group][cmd_name] = key_specs
|
||||
if group not in table:
|
||||
table[group] = {}
|
||||
table[group][cmd_name] = key_specs
|
||||
|
||||
container = sorted(container)
|
||||
with open("table.json", "w") as f:
|
||||
json.dump({
|
||||
"table": table,
|
||||
|
|
5263
scripts/table.json
5263
scripts/table.json
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue