line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
9
|
|
|
9
|
|
80
|
use utf8; |
|
9
|
|
|
|
|
18
|
|
|
9
|
|
|
|
|
40
|
|
2
|
|
|
|
|
|
|
package Net::Etcd::KV::Put; |
3
|
|
|
|
|
|
|
|
4
|
9
|
|
|
9
|
|
274
|
use strict; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
127
|
|
5
|
9
|
|
|
9
|
|
31
|
use warnings; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
160
|
|
6
|
|
|
|
|
|
|
|
7
|
9
|
|
|
9
|
|
43
|
use Moo; |
|
9
|
|
|
|
|
15
|
|
|
9
|
|
|
|
|
41
|
|
8
|
9
|
|
|
9
|
|
2219
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
41
|
|
9
|
9
|
|
|
9
|
|
6340
|
use MIME::Base64; |
|
9
|
|
|
|
|
14
|
|
|
9
|
|
|
|
|
358
|
|
10
|
9
|
|
|
9
|
|
40
|
use JSON; |
|
9
|
|
|
|
|
16
|
|
|
9
|
|
|
|
|
57
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Net::Etcd::Role::Actions'; |
13
|
|
|
|
|
|
|
|
14
|
9
|
|
|
9
|
|
940
|
use namespace::clean; |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
53
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Net::Etcd::Put |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.022'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Put puts the given key into the key-value store. A put request increments |
27
|
|
|
|
|
|
|
the revision of the key-value store and generates one event in the event |
28
|
|
|
|
|
|
|
history. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 ACCESSORS |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 endpoint |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
=cut |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has endpoint => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
isa => Str, |
39
|
|
|
|
|
|
|
default => '/kv/put' |
40
|
|
|
|
|
|
|
); |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head2 key |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
key is the key, in bytes, to put into the key-value store. |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
has key => ( |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
isa => Str, |
51
|
|
|
|
|
|
|
required => 1, |
52
|
|
|
|
|
|
|
coerce => sub { return encode_base64( $_[0], '' ) }, |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head2 value |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
value is the value, in bytes, to associate with the key in the key-value store. |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=cut |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
has value => ( |
62
|
|
|
|
|
|
|
is => 'ro', |
63
|
|
|
|
|
|
|
isa => Str, |
64
|
|
|
|
|
|
|
required => 1, |
65
|
|
|
|
|
|
|
coerce => sub { return encode_base64( $_[0], '' ) }, |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
=head2 lease |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
lease is the lease ID to associate with the key in the key-value store. A lease |
71
|
|
|
|
|
|
|
value of 0 indicates no lease. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
has lease => ( |
76
|
|
|
|
|
|
|
is => 'ro', |
77
|
|
|
|
|
|
|
isa => Int, |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 prev_kv |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
If prev_kv is set, etcd gets the previous key-value pair before changing it. |
83
|
|
|
|
|
|
|
The previous key-value pair will be returned in the put response. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=cut |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
has prev_kv => ( |
88
|
|
|
|
|
|
|
is => 'ro', |
89
|
|
|
|
|
|
|
isa => Bool, |
90
|
9
|
|
|
9
|
|
3864
|
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } |
|
9
|
|
|
|
|
13
|
|
|
9
|
|
|
|
|
797
|
|
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |