| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
9
|
|
|
9
|
|
52
|
use utf8; |
|
|
9
|
|
|
|
|
14
|
|
|
|
9
|
|
|
|
|
38
|
|
|
2
|
|
|
|
|
|
|
package Net::Etcd::Maintenance; |
|
3
|
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
272
|
use strict; |
|
|
9
|
|
|
|
|
39
|
|
|
|
9
|
|
|
|
|
139
|
|
|
5
|
9
|
|
|
9
|
|
34
|
use warnings; |
|
|
9
|
|
|
|
|
13
|
|
|
|
9
|
|
|
|
|
186
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding utf8 |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
|
10
|
|
|
|
|
|
|
|
|
11
|
9
|
|
|
9
|
|
38
|
use Moo; |
|
|
9
|
|
|
|
|
20
|
|
|
|
9
|
|
|
|
|
53
|
|
|
12
|
9
|
|
|
9
|
|
2242
|
use Types::Standard qw(Str); |
|
|
9
|
|
|
|
|
22
|
|
|
|
9
|
|
|
|
|
58
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
with 'Net::Etcd::Role::Actions'; |
|
15
|
9
|
|
|
9
|
|
3416
|
use namespace::clean; |
|
|
9
|
|
|
|
|
14
|
|
|
|
9
|
|
|
|
|
42
|
|
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 NAME |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
Net::Etcd::Maintenance |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
our $VERSION = '0.022'; |
|
24
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# defrag member's backend database |
|
27
|
|
|
|
|
|
|
$defrag = $etcd->maintenance()->defragment; |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# check status |
|
30
|
|
|
|
|
|
|
$status = $etcd->maintenance()->status; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# member version |
|
33
|
|
|
|
|
|
|
$status = $etcd->version; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
Provides support for maintenance related actions. |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=cut |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head1 ACCESSORS |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=head2 endpoint |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=cut |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has endpoint => ( |
|
48
|
|
|
|
|
|
|
is => 'rwp', |
|
49
|
|
|
|
|
|
|
isa => Str, |
|
50
|
|
|
|
|
|
|
); |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 snapshot |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Snapshot sends a snapshot of the entire backend from a member over a stream to a client. |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub snapshot { |
|
61
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
|
62
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
|
63
|
0
|
|
|
|
|
|
$self->{endpoint} = '/maintenance/snapshot'; |
|
64
|
0
|
|
|
|
|
|
$self->{json_args} = '{}'; |
|
65
|
0
|
|
|
|
|
|
$self->request; |
|
66
|
0
|
|
|
|
|
|
return $self; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 status |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Status gets the status of the member. |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub status { |
|
76
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
|
77
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
|
78
|
0
|
|
|
|
|
|
$self->{endpoint} = '/maintenance/status'; |
|
79
|
0
|
|
|
|
|
|
$self->{json_args} = '{}'; |
|
80
|
0
|
|
|
|
|
|
$self->request; |
|
81
|
0
|
|
|
|
|
|
return $self; |
|
82
|
|
|
|
|
|
|
} |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head2 defragment |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Defragment defragments a member's backend database to recover storage space. |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=cut |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub defragment { |
|
91
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
|
92
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
|
93
|
0
|
|
|
|
|
|
$self->{endpoint} = '/maintenance/defragment'; |
|
94
|
0
|
|
|
|
|
|
$self->{json_args} = '{}'; |
|
95
|
0
|
|
|
|
|
|
$self->request; |
|
96
|
0
|
|
|
|
|
|
return $self; |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 version |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
Returns the member version. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |
|
104
|
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub version { |
|
106
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
|
107
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
|
108
|
0
|
|
|
|
|
|
my $status = $self->status; |
|
109
|
0
|
0
|
|
|
|
|
if ( $status->is_success ) { |
|
110
|
0
|
|
|
|
|
|
return $status->content->{version}; |
|
111
|
|
|
|
|
|
|
} |
|
112
|
0
|
|
|
|
|
|
return; |
|
113
|
|
|
|
|
|
|
} |
|
114
|
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
1; |