line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# Copyright (C) 2021-2022 Horimoto Yasuhiro |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
# This program is free software: you can redistribute it and/or modify |
4
|
|
|
|
|
|
|
# it under the terms of the GNU General Public License as published by |
5
|
|
|
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or |
6
|
|
|
|
|
|
|
# (at your option) any later version. |
7
|
|
|
|
|
|
|
# |
8
|
|
|
|
|
|
|
# This program 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 |
11
|
|
|
|
|
|
|
# GNU General Public License for more details. |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# You should have received a copy of the GNU General Public License |
14
|
|
|
|
|
|
|
# along with this program. If not, see . |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
package Groonga::HTTP; |
17
|
|
|
|
|
|
|
|
18
|
1
|
|
|
1
|
|
1050
|
use LWP::UserAgent; |
|
1
|
|
|
|
|
37261
|
|
|
1
|
|
|
|
|
29
|
|
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
348
|
use Groonga::ResultSet; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
21
|
1
|
|
|
1
|
|
323
|
use Groonga::HTTP::Client; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
323
|
use Groonga::Commands::Delete; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
24
|
1
|
|
|
1
|
|
307
|
use Groonga::Commands::Load; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
25
|
1
|
|
|
1
|
|
308
|
use Groonga::Commands::Status; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
26
|
1
|
|
|
1
|
|
305
|
use Groonga::Commands::Select; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
30
|
1
|
|
|
1
|
|
3
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
248
|
|
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
our $VERSION = "1.09"; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
my $host = '127.0.0.1'; |
35
|
|
|
|
|
|
|
my $port = 10041; |
36
|
|
|
|
|
|
|
my $groonga_http_client = undef; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
39
|
0
|
|
|
0
|
0
|
|
my ($class, %args) = @_; |
40
|
0
|
|
|
|
|
|
my $self = {%args}; |
41
|
|
|
|
|
|
|
|
42
|
0
|
0
|
|
|
|
|
if ($self->{host}) { |
43
|
0
|
|
|
|
|
|
$host = $self->{host}; |
44
|
|
|
|
|
|
|
} |
45
|
0
|
0
|
|
|
|
|
if ($self->{port}) { |
46
|
0
|
|
|
|
|
|
$port = $self->{port}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$groonga_http_client = |
50
|
0
|
|
|
|
|
|
Groonga::HTTP::Client->new(host => $host, port => $port); |
51
|
0
|
|
|
|
|
|
return bless $self, $class; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub status { |
55
|
0
|
|
|
0
|
0
|
|
my $status = |
56
|
|
|
|
|
|
|
Groonga::Commands::Status->new(client => $groonga_http_client); |
57
|
0
|
|
|
|
|
|
return $status->execute; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub select { |
61
|
0
|
|
|
0
|
0
|
|
my ($client, %args) = @_; |
62
|
0
|
|
|
|
|
|
my $select = |
63
|
|
|
|
|
|
|
Groonga::Commands::Select->new( |
64
|
|
|
|
|
|
|
client => $groonga_http_client, |
65
|
|
|
|
|
|
|
%args |
66
|
|
|
|
|
|
|
); |
67
|
0
|
|
|
|
|
|
return $select->execute; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub load { |
71
|
0
|
|
|
0
|
0
|
|
my ($client, %args) = @_; |
72
|
0
|
|
|
|
|
|
my $load = |
73
|
|
|
|
|
|
|
Groonga::Commands::Load->new( |
74
|
|
|
|
|
|
|
client => $groonga_http_client, |
75
|
|
|
|
|
|
|
%args |
76
|
|
|
|
|
|
|
); |
77
|
0
|
|
|
|
|
|
return $load->execute; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub delete { |
81
|
0
|
|
|
0
|
0
|
|
my ($client, %args) = @_; |
82
|
0
|
|
|
|
|
|
my $delete = |
83
|
|
|
|
|
|
|
Groonga::Commands::Delete->new( |
84
|
|
|
|
|
|
|
client => $groonga_http_client, |
85
|
|
|
|
|
|
|
%args |
86
|
|
|
|
|
|
|
); |
87
|
0
|
|
|
|
|
|
return $delete->execute; |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
1; |
91
|
|
|
|
|
|
|
__END__ |