-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TODO: * Documentation.
- Loading branch information
Showing
16 changed files
with
242 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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 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 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,28 @@ | ||
module Groonga | ||
module Sharding | ||
class LogicalShardListCommand < Command | ||
register("logical_shard_list", | ||
[ | ||
"logical_table", | ||
]) | ||
|
||
def run_body(input) | ||
enumerator = LogicalEnumerator.new("logical_shard_list", | ||
input, | ||
:require_shard_key => false) | ||
shard_names = enumerator.collect do |current_shard, shard_range| | ||
current_shard.table_name | ||
end | ||
|
||
writer.array("shards", shard_names.size) do | ||
shard_names.each do |shard_name| | ||
writer.map("shard", 1) do | ||
writer.write("name") | ||
writer.write(shard_name) | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains 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 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,6 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150806 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[[0,0.0,0.0],[{"name":"Logs_20150806"}]] |
This file contains 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,7 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
table_create Logs_20150806 TABLE_NO_KEY | ||
|
||
logical_shard_list Logs |
47 changes: 47 additions & 0 deletions
47
test/command/suite/sharding/logical_shard_list/days.expected
This file contains 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,47 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150201 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150202 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150227 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150301 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150302 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150130 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150131 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
{ | ||
"name": "Logs_20150130" | ||
}, | ||
{ | ||
"name": "Logs_20150131" | ||
}, | ||
{ | ||
"name": "Logs_20150201" | ||
}, | ||
{ | ||
"name": "Logs_20150202" | ||
}, | ||
{ | ||
"name": "Logs_20150227" | ||
}, | ||
{ | ||
"name": "Logs_20150301" | ||
}, | ||
{ | ||
"name": "Logs_20150302" | ||
} | ||
] | ||
] |
This file contains 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,13 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
table_create Logs_20150201 TABLE_NO_KEY | ||
table_create Logs_20150202 TABLE_NO_KEY | ||
table_create Logs_20150227 TABLE_NO_KEY | ||
table_create Logs_20150301 TABLE_NO_KEY | ||
table_create Logs_20150302 TABLE_NO_KEY | ||
table_create Logs_20150130 TABLE_NO_KEY | ||
table_create Logs_20150131 TABLE_NO_KEY | ||
|
||
logical_shard_list Logs |
6 changes: 6 additions & 0 deletions
6
test/command/suite/sharding/logical_shard_list/month.expected
This file contains 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,6 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201508 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[[0,0.0,0.0],[{"name":"Logs_201508"}]] |
This file contains 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,7 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
table_create Logs_201508 TABLE_NO_KEY | ||
|
||
logical_shard_list Logs |
32 changes: 32 additions & 0 deletions
32
test/command/suite/sharding/logical_shard_list/months.expected
This file contains 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,32 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201501 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201412 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201512 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201401 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
{ | ||
"name": "Logs_201401" | ||
}, | ||
{ | ||
"name": "Logs_201412" | ||
}, | ||
{ | ||
"name": "Logs_201501" | ||
}, | ||
{ | ||
"name": "Logs_201512" | ||
} | ||
] | ||
] |
10 changes: 10 additions & 0 deletions
10
test/command/suite/sharding/logical_shard_list/months.test
This file contains 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,10 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
table_create Logs_201501 TABLE_NO_KEY | ||
table_create Logs_201412 TABLE_NO_KEY | ||
table_create Logs_201512 TABLE_NO_KEY | ||
table_create Logs_201401 TABLE_NO_KEY | ||
|
||
logical_shard_list Logs |
52 changes: 52 additions & 0 deletions
52
test/command/suite/sharding/logical_shard_list/months_days.expected
This file contains 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,52 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201502 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150227 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150204 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150130 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150203 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150302 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_201503 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
table_create Logs_20150131 TABLE_NO_KEY | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[ | ||
[ | ||
0, | ||
0.0, | ||
0.0 | ||
], | ||
[ | ||
{ | ||
"name": "Logs_20150130" | ||
}, | ||
{ | ||
"name": "Logs_20150131" | ||
}, | ||
{ | ||
"name": "Logs_201502" | ||
}, | ||
{ | ||
"name": "Logs_20150203" | ||
}, | ||
{ | ||
"name": "Logs_20150204" | ||
}, | ||
{ | ||
"name": "Logs_20150227" | ||
}, | ||
{ | ||
"name": "Logs_201503" | ||
}, | ||
{ | ||
"name": "Logs_20150302" | ||
} | ||
] | ||
] |
14 changes: 14 additions & 0 deletions
14
test/command/suite/sharding/logical_shard_list/months_days.test
This file contains 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,14 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
table_create Logs_201502 TABLE_NO_KEY | ||
table_create Logs_20150227 TABLE_NO_KEY | ||
table_create Logs_20150204 TABLE_NO_KEY | ||
table_create Logs_20150130 TABLE_NO_KEY | ||
table_create Logs_20150203 TABLE_NO_KEY | ||
table_create Logs_20150302 TABLE_NO_KEY | ||
table_create Logs_201503 TABLE_NO_KEY | ||
table_create Logs_20150131 TABLE_NO_KEY | ||
|
||
logical_shard_list Logs |
4 changes: 4 additions & 0 deletions
4
test/command/suite/sharding/logical_shard_list/nonexistent.expected
This file contains 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,4 @@ | ||
register sharding | ||
[[0,0.0,0.0],true] | ||
logical_shard_list Logs | ||
[[0,0.0,0.0],[]] |
5 changes: 5 additions & 0 deletions
5
test/command/suite/sharding/logical_shard_list/nonexistent.test
This file contains 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,5 @@ | ||
#@on-error omit | ||
register sharding | ||
#@on-error default | ||
|
||
logical_shard_list Logs |