Etcd/Maintenance.pm

filter: Statementstmt 47.8% 22 / 46 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 60.0% 6 / 10 Podpod 100% 4 / 4 totaltotal 45.7% 32 / 70 CC 6 SCAR 16.5
CC
6
Cov
39%
version
12.0
snapshot
6.0
status
6.0
CRAP 5.2
« Etcd/Auth/RolePermission.pm ↑ Summary Etcd/Lease.pm »
1 9 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 package Net::Etcd::Maintenance;
3  
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 =encoding utf8
8  
9 =cut
10  
11 9 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 9 ▶use Types::Standard qw(Str);
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 9 with 'Net::Etcd::Role::Actions';
15 9 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 =head1 NAME
18  
19 Net::Etcd::Maintenance
20  
21 =cut
22  
23 9 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 9 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 0 ▶sub snapshot {
Subroutine snapshot: not called CC=2 SCAR=17.9
Pod documented
61 0 my ( $self, $options ) = @_;
62 0 ▶ my $cb = pop if ref $_[-1] eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[-1] eq "CODE" 0 0 0
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 0 ▶sub status {
Subroutine status: not called CC=2 SCAR=17.9
Pod documented
76 0 my ( $self, $options ) = @_;
77 0 ▶ my $cb = pop if ref $_[-1] eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[-1] eq "CODE" 0 0 0
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 0 ▶sub defragment {
Subroutine defragment: not called CC=2 SCAR=17.9
Pod documented
91 0 my ( $self, $options ) = @_;
92 0 ▶ my $cb = pop if ref $_[-1] eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[-1] eq "CODE" 0 0 0
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 0 ▶sub version {
Subroutine version: not called CC=3 SCAR=24.8
Pod documented
106 0 my ( $self, $options ) = @_;
107 0 ▶ my $cb = pop if ref $_[-1] eq 'CODE';
Branch: 1 branch
BranchTrueFalseTotal
if ref $_[-1] eq "CODE" 0 0 0
108 0 my $status = $self->status;
109 0 ▶ if ( $status->is_success ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($status->is_success) 0 0 0
110 0 return $status->content->{version};
111 }
112 0 return;
113 }
114  
115 9 1;
« Etcd/Auth/RolePermission.pm ↑ Summary Etcd/Lease.pm »