line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package ArangoDB2::Replication; |
2
|
|
|
|
|
|
|
|
3
|
21
|
|
|
21
|
|
85
|
use strict; |
|
21
|
|
|
|
|
27
|
|
|
21
|
|
|
|
|
675
|
|
4
|
21
|
|
|
21
|
|
89
|
use warnings; |
|
21
|
|
|
|
|
35
|
|
|
21
|
|
|
|
|
581
|
|
5
|
|
|
|
|
|
|
|
6
|
21
|
|
|
|
|
1382
|
use base qw( |
7
|
|
|
|
|
|
|
ArangoDB2::Base |
8
|
21
|
|
|
21
|
|
91
|
); |
|
21
|
|
|
|
|
33
|
|
9
|
|
|
|
|
|
|
|
10
|
21
|
|
|
21
|
|
94
|
use Data::Dumper; |
|
21
|
|
|
|
|
28
|
|
|
21
|
|
|
|
|
886
|
|
11
|
21
|
|
|
21
|
|
81
|
use JSON::XS; |
|
21
|
|
|
|
|
28
|
|
|
21
|
|
|
|
|
15430
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $JSON = JSON::XS->new->utf8; |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
############### |
18
|
|
|
|
|
|
|
# API METHODS # |
19
|
|
|
|
|
|
|
############### |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# applierConfig |
22
|
|
|
|
|
|
|
# |
23
|
|
|
|
|
|
|
# GET /_api/replication/applier-config |
24
|
|
|
|
|
|
|
# PUT /_api/replication/applier-config |
25
|
|
|
|
|
|
|
sub applierConfig |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
28
|
|
|
|
|
|
|
# process args |
29
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['configuration']); |
30
|
|
|
|
|
|
|
# build path |
31
|
0
|
|
|
|
|
|
my $path = $self->api_path('replication', 'applier-config'); |
32
|
|
|
|
|
|
|
# make request |
33
|
0
|
0
|
|
|
|
|
return $args->{configuration} |
34
|
|
|
|
|
|
|
? $self->arango->http->put($path, $args) |
35
|
|
|
|
|
|
|
: $self->arango->http->get($path); |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# applierStart |
39
|
|
|
|
|
|
|
# |
40
|
|
|
|
|
|
|
# PUT /_api/replication/applier-start |
41
|
|
|
|
|
|
|
sub applierStart |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
44
|
|
|
|
|
|
|
# process args |
45
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['from']); |
46
|
|
|
|
|
|
|
# make request |
47
|
0
|
|
|
|
|
|
return $self->arango->http->put( |
48
|
|
|
|
|
|
|
$self->api_path('replication', 'applier-start'), |
49
|
|
|
|
|
|
|
$args, |
50
|
|
|
|
|
|
|
); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
# applierState |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# GET /_api/replication/applier-state |
56
|
|
|
|
|
|
|
sub applierState |
57
|
|
|
|
|
|
|
{ |
58
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
59
|
|
|
|
|
|
|
# make request |
60
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
61
|
|
|
|
|
|
|
$self->api_path('replication', 'applier-state'), |
62
|
|
|
|
|
|
|
); |
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
# applierStop |
66
|
|
|
|
|
|
|
# |
67
|
|
|
|
|
|
|
# PUT /_api/replication/applier-stop |
68
|
|
|
|
|
|
|
sub applierStop |
69
|
|
|
|
|
|
|
{ |
70
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
71
|
|
|
|
|
|
|
# make request |
72
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
73
|
|
|
|
|
|
|
$self->api_path('replication', 'applier-stop'), |
74
|
|
|
|
|
|
|
); |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
# clusterInventory |
78
|
|
|
|
|
|
|
# |
79
|
|
|
|
|
|
|
# GET /_api/replication/clusterInventory |
80
|
|
|
|
|
|
|
sub clusterInventory |
81
|
|
|
|
|
|
|
{ |
82
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
83
|
|
|
|
|
|
|
# process args |
84
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['includeSystem']); |
85
|
|
|
|
|
|
|
# make request |
86
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
87
|
|
|
|
|
|
|
$self->api_path('replication', 'clusterInventory'), |
88
|
|
|
|
|
|
|
$args, |
89
|
|
|
|
|
|
|
); |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
# dump |
93
|
|
|
|
|
|
|
# |
94
|
|
|
|
|
|
|
# GET /_api/replication/dump |
95
|
|
|
|
|
|
|
sub dump |
96
|
|
|
|
|
|
|
{ |
97
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
98
|
|
|
|
|
|
|
# process args |
99
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['chunkSize', 'collection', 'from', 'ticks', 'to']); |
100
|
|
|
|
|
|
|
# make request |
101
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
102
|
|
|
|
|
|
|
$self->api_path('replication', 'dump'), |
103
|
|
|
|
|
|
|
$args, |
104
|
|
|
|
|
|
|
); |
105
|
|
|
|
|
|
|
} |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
# inventory |
108
|
|
|
|
|
|
|
# |
109
|
|
|
|
|
|
|
# GET /_api/replication/inventory |
110
|
|
|
|
|
|
|
sub inventory |
111
|
|
|
|
|
|
|
{ |
112
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
113
|
|
|
|
|
|
|
# process args |
114
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['includeSystem']); |
115
|
|
|
|
|
|
|
# make request |
116
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
117
|
|
|
|
|
|
|
$self->api_path('replication', 'inventory'), |
118
|
|
|
|
|
|
|
$args, |
119
|
|
|
|
|
|
|
); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
# loggerFollow |
123
|
|
|
|
|
|
|
# |
124
|
|
|
|
|
|
|
# GET /_api/replication/loggerFollow |
125
|
|
|
|
|
|
|
sub loggerFollow |
126
|
|
|
|
|
|
|
{ |
127
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
128
|
|
|
|
|
|
|
# process args |
129
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['chunkSize', 'from', 'to']); |
130
|
|
|
|
|
|
|
# make request |
131
|
0
|
0
|
|
|
|
|
my $res = $self->arango->http->get( |
132
|
|
|
|
|
|
|
$self->api_path('replication', 'logger-follow'), |
133
|
|
|
|
|
|
|
$args, |
134
|
|
|
|
|
|
|
1, # get raw response |
135
|
|
|
|
|
|
|
) or return; |
136
|
|
|
|
|
|
|
# build our own response |
137
|
0
|
|
|
|
|
|
my $ret = {}; |
138
|
|
|
|
|
|
|
# response is newline separated JSON log entries |
139
|
0
|
|
|
|
|
|
$ret->{log} = [ map { $JSON->decode($_) } split(/\n/, $res->content) ]; |
|
0
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
# get response header values |
142
|
0
|
|
|
|
|
|
$ret->{replication}->{active} = $res->header('x-arango-replication-active'); |
143
|
0
|
|
|
|
|
|
$ret->{replication}->{checkmore} = $res->header('x-arango-replication-checkmore'); |
144
|
0
|
|
|
|
|
|
$ret->{replication}->{lastincluded} = $res->header('x-arango-replication-lastincluded'); |
145
|
0
|
|
|
|
|
|
$ret->{replication}->{lasttick} = $res->header('x-arango-replication-lasttick'); |
146
|
|
|
|
|
|
|
|
147
|
0
|
|
|
|
|
|
return $ret; |
148
|
|
|
|
|
|
|
} |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
# loggerState |
151
|
|
|
|
|
|
|
# |
152
|
|
|
|
|
|
|
# GET /_api/replication/loggerState |
153
|
|
|
|
|
|
|
sub loggerState |
154
|
|
|
|
|
|
|
{ |
155
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
156
|
|
|
|
|
|
|
# make request |
157
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
158
|
|
|
|
|
|
|
$self->api_path('replication', 'logger-state'), |
159
|
|
|
|
|
|
|
); |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
# serverId |
163
|
|
|
|
|
|
|
# |
164
|
|
|
|
|
|
|
# GET /_api/replication/server-id |
165
|
|
|
|
|
|
|
sub serverId |
166
|
|
|
|
|
|
|
{ |
167
|
0
|
|
|
0
|
1
|
|
my($self) = @_; |
168
|
|
|
|
|
|
|
# make request |
169
|
0
|
|
|
|
|
|
return $self->arango->http->get( |
170
|
|
|
|
|
|
|
$self->api_path('replication', 'server-id'), |
171
|
|
|
|
|
|
|
); |
172
|
|
|
|
|
|
|
} |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
# sync |
175
|
|
|
|
|
|
|
# |
176
|
|
|
|
|
|
|
# PUT /_api/replication/sync |
177
|
|
|
|
|
|
|
sub sync |
178
|
|
|
|
|
|
|
{ |
179
|
0
|
|
|
0
|
1
|
|
my($self, $args) = @_; |
180
|
|
|
|
|
|
|
# process args |
181
|
0
|
|
|
|
|
|
$args = $self->_build_args($args, ['configuration']); |
182
|
|
|
|
|
|
|
# make request |
183
|
0
|
|
|
|
|
|
return $self->arango->http->put( |
184
|
|
|
|
|
|
|
$self->api_path('replication', 'sync'), |
185
|
|
|
|
|
|
|
$args, |
186
|
|
|
|
|
|
|
); |
187
|
|
|
|
|
|
|
} |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
#################### |
191
|
|
|
|
|
|
|
# PROPERTY METHODS # |
192
|
|
|
|
|
|
|
#################### |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
# chunkSize |
195
|
|
|
|
|
|
|
# |
196
|
|
|
|
|
|
|
# get/set chunkSize |
197
|
0
|
|
|
0
|
1
|
|
sub chunkSize { shift->_get_set('chunkSize', @_) } |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
# collection |
200
|
|
|
|
|
|
|
# |
201
|
|
|
|
|
|
|
# get/set collection |
202
|
0
|
|
|
0
|
1
|
|
sub collection { shift->_get_set_name('collection', @_) } |
203
|
|
|
|
|
|
|
|
204
|
|
|
|
|
|
|
# configuration |
205
|
|
|
|
|
|
|
# |
206
|
|
|
|
|
|
|
# get/set configuration |
207
|
0
|
|
|
0
|
1
|
|
sub configuration { shift->_get_set('configuration', @_) } |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
# from |
210
|
|
|
|
|
|
|
# |
211
|
|
|
|
|
|
|
# get/set from |
212
|
0
|
|
|
0
|
1
|
|
sub from { shift->_get_set('from', @_) } |
213
|
|
|
|
|
|
|
|
214
|
|
|
|
|
|
|
# includeSystem |
215
|
|
|
|
|
|
|
# |
216
|
|
|
|
|
|
|
# get/set includeSystem |
217
|
0
|
|
|
0
|
1
|
|
sub includeSystem { shift->_get_set('includeSystem', @_) } |
218
|
|
|
|
|
|
|
|
219
|
|
|
|
|
|
|
# ticks |
220
|
|
|
|
|
|
|
# |
221
|
|
|
|
|
|
|
# get/set ticks |
222
|
0
|
|
|
0
|
1
|
|
sub ticks { shift->_get_set_bool('ticks', @_) } |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
# |
225
|
|
|
|
|
|
|
# |
226
|
|
|
|
|
|
|
# get/set |
227
|
0
|
|
|
0
|
1
|
|
sub to { shift->_get_set('', @_) } |
228
|
|
|
|
|
|
|
|
229
|
|
|
|
|
|
|
|
230
|
|
|
|
|
|
|
1; |
231
|
|
|
|
|
|
|
|
232
|
|
|
|
|
|
|
__END__ |