| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
4
|
|
|
4
|
|
13
|
use utf8; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
17
|
|
|
2
|
|
|
|
|
|
|
package Etcd3::DeleteRange; |
|
3
|
|
|
|
|
|
|
|
|
4
|
4
|
|
|
4
|
|
120
|
use strict; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
65
|
|
|
5
|
4
|
|
|
4
|
|
10
|
use warnings; |
|
|
4
|
|
|
|
|
7
|
|
|
|
4
|
|
|
|
|
68
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
4
|
|
|
4
|
|
12
|
use Moo; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
12
|
|
|
8
|
4
|
|
|
4
|
|
727
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
|
4
|
|
|
|
|
6
|
|
|
|
4
|
|
|
|
|
20
|
|
|
9
|
4
|
|
|
4
|
|
2101
|
use MIME::Base64; |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
148
|
|
|
10
|
4
|
|
|
4
|
|
14
|
use JSON; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
18
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
|
13
|
|
|
|
|
|
|
|
|
14
|
4
|
|
|
4
|
|
331
|
use namespace::clean; |
|
|
4
|
|
|
|
|
4
|
|
|
|
4
|
|
|
|
|
22
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Etcd3::DeleteRange |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.005'; |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
DeleteRange deletes the given range from the key-value store. A delete request increments the |
|
27
|
|
|
|
|
|
|
revision of the key-value store and generates a delete event in the event history for every |
|
28
|
|
|
|
|
|
|
deleted key. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 endpoint |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
has endpoint => ( |
|
35
|
|
|
|
|
|
|
is => 'ro', |
|
36
|
|
|
|
|
|
|
isa => Str, |
|
37
|
|
|
|
|
|
|
default => '/kv/deleterange' |
|
38
|
|
|
|
|
|
|
); |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=head2 key |
|
41
|
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
key is the first key to delete in the range. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=cut |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
has key => ( |
|
47
|
|
|
|
|
|
|
is => 'ro', |
|
48
|
|
|
|
|
|
|
isa => Str, |
|
49
|
|
|
|
|
|
|
required => 1, |
|
50
|
|
|
|
|
|
|
coerce => sub { return encode_base64( $_[0], '' ) } |
|
51
|
|
|
|
|
|
|
); |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 range_end |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
range_end is the key following the last key to delete for the range [key, range_end). If range_end |
|
56
|
|
|
|
|
|
|
is not given, the range is defined to contain only the key argument. If range_end is '\0', the range |
|
57
|
|
|
|
|
|
|
is all keys greater than or equal to the key argument. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has range_end => ( |
|
62
|
|
|
|
|
|
|
is => 'ro', |
|
63
|
|
|
|
|
|
|
isa => Str, |
|
64
|
|
|
|
|
|
|
coerce => sub { return encode_base64( $_[0], '' ) } |
|
65
|
|
|
|
|
|
|
); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head2 prev_key |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
If prev_kv is set, etcd gets the previous key-value pairs before deleting it. The previous key-value |
|
70
|
|
|
|
|
|
|
pairs will be returned in the delete response. |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
has prev_key => ( |
|
75
|
|
|
|
|
|
|
is => 'ro', |
|
76
|
|
|
|
|
|
|
isa => Bool, |
|
77
|
4
|
|
|
4
|
|
1468
|
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } |
|
|
4
|
|
|
|
|
5
|
|
|
|
4
|
|
|
|
|
747
|
|
|
78
|
|
|
|
|
|
|
); |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 json_args |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
arguments that will be sent to the api |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
has json_args => ( is => 'lazy', ); |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
sub _build_json_args { |
|
89
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
|
90
|
0
|
|
|
|
|
|
my $args; |
|
91
|
0
|
|
|
|
|
|
for my $key ( keys %{$self} ) { |
|
|
0
|
|
|
|
|
|
|
|
92
|
0
|
0
|
|
|
|
|
unless ( $key =~ /(?:_client|args|endpoint)$/ ) { |
|
93
|
0
|
|
|
|
|
|
$args->{$key} = $self->{$key}; |
|
94
|
|
|
|
|
|
|
} |
|
95
|
|
|
|
|
|
|
} |
|
96
|
0
|
|
|
|
|
|
return to_json($args); |
|
97
|
|
|
|
|
|
|
} |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head2 init |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
sub init { |
|
104
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
105
|
0
|
|
|
|
|
|
$self->json_args; |
|
106
|
0
|
|
|
|
|
|
return $self; |
|
107
|
|
|
|
|
|
|
} |
|
108
|
|
|
|
|
|
|
1; |