line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
3
|
|
|
3
|
|
12
|
use utf8; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
17
|
|
2
|
|
|
|
|
|
|
package Etcd3::DeleteRange; |
3
|
|
|
|
|
|
|
|
4
|
3
|
|
|
3
|
|
97
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
46
|
|
5
|
3
|
|
|
3
|
|
9
|
use warnings; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
60
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
9
|
use Moo; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
13
|
|
8
|
3
|
|
|
3
|
|
607
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
21
|
|
9
|
3
|
|
|
3
|
|
1724
|
use MIME::Base64; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
137
|
|
10
|
3
|
|
|
3
|
|
12
|
use JSON; |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
17
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
306
|
use namespace::clean; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
20
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Etcd3::DeleteRange |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.001'; |
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
|
3
|
|
|
3
|
|
979
|
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } |
|
3
|
|
|
|
|
3
|
|
|
3
|
|
|
|
|
626
|
|
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; |