line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
2313
|
use utf8; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
31
|
|
2
|
|
|
|
|
|
|
package Etcd3::KV; |
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
176
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
105
|
|
5
|
5
|
|
|
5
|
|
24
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
135
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=encoding utf8 |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=cut |
10
|
5
|
|
|
5
|
|
23
|
use Moo::Role; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
33
|
|
11
|
5
|
|
|
5
|
|
1659
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
5
|
|
|
|
|
48
|
|
|
5
|
|
|
|
|
30
|
|
12
|
5
|
|
|
5
|
|
6279
|
use Etcd3::KV::Put; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
163
|
|
13
|
5
|
|
|
5
|
|
1900
|
use Etcd3::KV::Range; |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
253
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
16
|
5
|
|
|
5
|
|
45
|
use namespace::clean; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
28
|
|
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=head1 NAME |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
Etcd3::KV |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
=cut |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our $VERSION = '0.007'; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head1 DESCRIPTION |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Key Value role providing easy access to Put and Range classes |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=cut |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head1 PUBLIC METHODS |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=head2 range |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
Range gets the keys in the range from the key-value store. |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$etcd->range({key =>'test0', range_end => 'test100'}) |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub range { |
43
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
44
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
45
|
0
|
0
|
|
|
|
|
my $range = Etcd3::KV::Range->new( |
46
|
|
|
|
|
|
|
%$self, |
47
|
|
|
|
|
|
|
endpoint => '/kv/range', |
48
|
|
|
|
|
|
|
etcd => $self, |
49
|
|
|
|
|
|
|
cb => $cb, |
50
|
|
|
|
|
|
|
( $options ? %$options : () ), |
51
|
|
|
|
|
|
|
); |
52
|
0
|
|
|
|
|
|
$range->request; |
53
|
0
|
|
|
|
|
|
return $range; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head2 put |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
Put puts the given key into the key-value store. A put request increments |
59
|
|
|
|
|
|
|
the revision of the key-value store and generates one event in the event |
60
|
|
|
|
|
|
|
history. |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
$etcd->range({key =>'test0', range_end => 'test100'}) |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=cut |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub put { |
67
|
0
|
|
|
0
|
1
|
|
my ( $self, $options ) = @_; |
68
|
0
|
0
|
|
|
|
|
my $cb = pop if ref $_[-1] eq 'CODE'; |
69
|
0
|
0
|
|
|
|
|
my $range = Etcd3::KV::Put->new( |
70
|
|
|
|
|
|
|
%$self, |
71
|
|
|
|
|
|
|
endpoint => '/kv/put', |
72
|
|
|
|
|
|
|
etcd => $self, |
73
|
|
|
|
|
|
|
cb => $cb, |
74
|
|
|
|
|
|
|
( $options ? %$options : () ), |
75
|
|
|
|
|
|
|
); |
76
|
0
|
|
|
|
|
|
$range->request; |
77
|
0
|
|
|
|
|
|
return $range; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
1; |