groonga-command 1.1.2 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -0
- data/doc/text/news.md +15 -0
- data/lib/groonga/command.rb +10 -0
- data/lib/groonga/command/base.rb +15 -0
- data/lib/groonga/command/column-copy.rb +67 -0
- data/lib/groonga/command/io-flush.rb +51 -0
- data/lib/groonga/command/log-level.rb +43 -0
- data/lib/groonga/command/log-put.rb +51 -0
- data/lib/groonga/command/logical-range-filter.rb +1 -1
- data/lib/groonga/command/logical-select.rb +186 -0
- data/lib/groonga/command/logical-shard-list.rb +43 -0
- data/lib/groonga/command/logical-table-remove.rb +83 -0
- data/lib/groonga/command/object-exist.rb +43 -0
- data/lib/groonga/command/select.rb +1 -1
- data/lib/groonga/command/table-list.rb +43 -0
- data/lib/groonga/command/thread-limit.rb +43 -0
- data/lib/groonga/command/version.rb +1 -1
- data/test/command/test-column-copy.rb +76 -0
- data/test/command/test-io-flush.rb +67 -0
- data/test/command/test-log-level.rb +46 -0
- data/test/command/test-log-put.rb +56 -0
- data/test/command/test-logical-select.rb +209 -0
- data/test/command/test-logical-shard-list.rb +46 -0
- data/test/command/test-logical-table-remove.rb +89 -0
- data/test/command/test-object-exist.rb +43 -0
- data/test/command/test-table-list.rb +43 -0
- data/test/command/test-thread-limit.rb +43 -0
- metadata +54 -24
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `logical_shard_list` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.3
|
24
|
+
class LogicalShardList < Base
|
25
|
+
Command.register("logical_shard_list", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:logical_table,
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String] `logical_table` parameter value.
|
36
|
+
#
|
37
|
+
# @since 1.1.3
|
38
|
+
def logical_table
|
39
|
+
self[:logical_table]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `logical_table_remove` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.3
|
24
|
+
class LogicalTableRemove < Base
|
25
|
+
Command.register("logical_table_remove", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:logical_table,
|
31
|
+
:shard_key,
|
32
|
+
:min,
|
33
|
+
:min_border,
|
34
|
+
:max,
|
35
|
+
:max_border,
|
36
|
+
]
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# @return [String] `logical_table` parameter value.
|
41
|
+
#
|
42
|
+
# @since 1.1.3
|
43
|
+
def logical_table
|
44
|
+
self[:logical_table]
|
45
|
+
end
|
46
|
+
|
47
|
+
# @return [String] `shard_key` parameter value.
|
48
|
+
#
|
49
|
+
# @since 1.1.3
|
50
|
+
def shard_key
|
51
|
+
self[:shard_key]
|
52
|
+
end
|
53
|
+
|
54
|
+
# @return [String] `min` parameter value.
|
55
|
+
#
|
56
|
+
# @since 1.1.3
|
57
|
+
def min
|
58
|
+
self[:min]
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [String] `min_border` parameter value.
|
62
|
+
#
|
63
|
+
# @since 1.1.3
|
64
|
+
def min_border
|
65
|
+
self[:min_border]
|
66
|
+
end
|
67
|
+
|
68
|
+
# @return [String] `max` parameter value.
|
69
|
+
#
|
70
|
+
# @since 1.1.3
|
71
|
+
def max
|
72
|
+
self[:max]
|
73
|
+
end
|
74
|
+
|
75
|
+
# @return [String] `max_border` parameter value.
|
76
|
+
#
|
77
|
+
# @since 1.1.3
|
78
|
+
def max_border
|
79
|
+
self[:max_border]
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `object_exist` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.3
|
24
|
+
class ObjectExist < Base
|
25
|
+
Command.register("object_exist", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:name,
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String] `name` parameter value.
|
36
|
+
#
|
37
|
+
# @since 1.1.3
|
38
|
+
def name
|
39
|
+
self[:name]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `table_list` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.3
|
24
|
+
class TableList < Base
|
25
|
+
Command.register("table_list", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:prefix,
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String] `prefix` parameter value.
|
36
|
+
#
|
37
|
+
# @since 1.1.3
|
38
|
+
def prefix
|
39
|
+
self[:prefix]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
require "groonga/command/base"
|
18
|
+
|
19
|
+
module Groonga
|
20
|
+
module Command
|
21
|
+
# A command class that represents `thread_limit` command.
|
22
|
+
#
|
23
|
+
# @since 1.1.3
|
24
|
+
class ThreadLimit < Base
|
25
|
+
Command.register("thread_limit", self)
|
26
|
+
|
27
|
+
class << self
|
28
|
+
def parameter_names
|
29
|
+
[
|
30
|
+
:max,
|
31
|
+
]
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [Integer] `max` parameter value.
|
36
|
+
#
|
37
|
+
# @since 1.1.3
|
38
|
+
def max
|
39
|
+
integer_value(:max)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,76 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class ColumnCopyCommandTest < Test::Unit::TestCase
|
18
|
+
private
|
19
|
+
def column_copy_command(pair_arguments={}, ordered_arguments=[])
|
20
|
+
Groonga::Command::ColumnCopy.new("column_copy",
|
21
|
+
pair_arguments,
|
22
|
+
ordered_arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
class ConstructorTest < self
|
26
|
+
def test_ordered_arguments
|
27
|
+
from_table = "Users"
|
28
|
+
from_name = "age_text"
|
29
|
+
to_table = "TypesUsers"
|
30
|
+
to_name = "age_uint8"
|
31
|
+
|
32
|
+
command = column_copy_command({},
|
33
|
+
[
|
34
|
+
from_table,
|
35
|
+
from_name,
|
36
|
+
to_table,
|
37
|
+
to_name,
|
38
|
+
])
|
39
|
+
assert_equal({
|
40
|
+
:from_table => from_table,
|
41
|
+
:from_name => from_name,
|
42
|
+
:to_table => to_table,
|
43
|
+
:to_name => to_name,
|
44
|
+
},
|
45
|
+
command.arguments)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class FromTableTest < self
|
50
|
+
def test_reader
|
51
|
+
command = column_copy_command(:from_table => "Users")
|
52
|
+
assert_equal("Users", command.from_table)
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
class FromNameTest < self
|
57
|
+
def test_reader
|
58
|
+
command = column_copy_command(:from_name => "age_text")
|
59
|
+
assert_equal("age_text", command.from_name)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class ToTableTest < self
|
64
|
+
def test_reader
|
65
|
+
command = column_copy_command(:to_table => "TypedUsers")
|
66
|
+
assert_equal("TypedUsers", command.to_table)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
class ToNameTest < self
|
71
|
+
def test_reader
|
72
|
+
command = column_copy_command(:to_name => "age_uint8")
|
73
|
+
assert_equal("age_uint8", command.to_name)
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
@@ -0,0 +1,67 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class IOFlushCommandTest < Test::Unit::TestCase
|
18
|
+
private
|
19
|
+
def io_flush_command(pair_arguments={}, ordered_arguments=[])
|
20
|
+
Groonga::Command::IOFlush.new("io_flush",
|
21
|
+
pair_arguments,
|
22
|
+
ordered_arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
class ConstructorTest < self
|
26
|
+
def test_ordered_arguments
|
27
|
+
target_name = "Users"
|
28
|
+
recursive = "no"
|
29
|
+
|
30
|
+
ordered_arguments = [
|
31
|
+
target_name,
|
32
|
+
recursive,
|
33
|
+
]
|
34
|
+
command = io_flush_command({}, ordered_arguments)
|
35
|
+
assert_equal({
|
36
|
+
:target_name => target_name,
|
37
|
+
:recursive => recursive,
|
38
|
+
},
|
39
|
+
command.arguments)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
class TargetNameTest < self
|
44
|
+
def test_reader
|
45
|
+
command = io_flush_command(:target_name => "Users")
|
46
|
+
assert_equal("Users", command.target_name)
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
class RecursiveTest < self
|
51
|
+
class ReaderTest < self
|
52
|
+
def test_default
|
53
|
+
command = io_flush_command
|
54
|
+
assert do
|
55
|
+
command.recursive?
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_no
|
60
|
+
command = io_flush_command(:recursive => "no")
|
61
|
+
assert do
|
62
|
+
not command.recursive?
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# Copyright (C) 2015 Kouhei Sutou <kou@clear-code.com>
|
2
|
+
#
|
3
|
+
# This library is free software; you can redistribute it and/or
|
4
|
+
# modify it under the terms of the GNU Lesser General Public
|
5
|
+
# License as published by the Free Software Foundation; either
|
6
|
+
# version 2.1 of the License, or (at your option) any later version.
|
7
|
+
#
|
8
|
+
# This library is distributed in the hope that it will be useful,
|
9
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
10
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
11
|
+
# Lesser General Public License for more details.
|
12
|
+
#
|
13
|
+
# You should have received a copy of the GNU Lesser General Public
|
14
|
+
# License along with this library; if not, write to the Free Software
|
15
|
+
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
16
|
+
|
17
|
+
class LogLevelCommandTest < Test::Unit::TestCase
|
18
|
+
private
|
19
|
+
def log_level_command(pair_arguments={}, ordered_arguments=[])
|
20
|
+
Groonga::Command::LogLevel.new("log_level",
|
21
|
+
pair_arguments,
|
22
|
+
ordered_arguments)
|
23
|
+
end
|
24
|
+
|
25
|
+
class ConstructorTest < self
|
26
|
+
def test_ordered_arguments
|
27
|
+
level = "debug"
|
28
|
+
|
29
|
+
ordered_arguments = [
|
30
|
+
level,
|
31
|
+
]
|
32
|
+
command = log_level_command({}, ordered_arguments)
|
33
|
+
assert_equal({
|
34
|
+
:level => level,
|
35
|
+
},
|
36
|
+
command.arguments)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
class LevelTest < self
|
41
|
+
def test_reader
|
42
|
+
command = log_level_command(:level => "debug")
|
43
|
+
assert_equal("debug", command.level)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|