line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
5
|
|
|
5
|
|
26
|
use utf8; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
24
|
|
2
|
|
|
|
|
|
|
package Etcd3::KV::Put; |
3
|
|
|
|
|
|
|
|
4
|
5
|
|
|
5
|
|
155
|
use strict; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
75
|
|
5
|
5
|
|
|
5
|
|
19
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
89
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
20
|
use Moo; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
24
|
|
8
|
5
|
|
|
5
|
|
1477
|
use Types::Standard qw(Str Int Bool HashRef ArrayRef); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
28
|
|
9
|
5
|
|
|
5
|
|
4399
|
use MIME::Base64; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
229
|
|
10
|
5
|
|
|
5
|
|
24
|
use JSON; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
31
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
with 'Etcd3::Role::Actions'; |
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
605
|
use namespace::clean; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
29
|
|
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 NAME |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
Etcd3::Put |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=cut |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our $VERSION = '0.006'; |
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
|
5
|
|
|
5
|
|
2334
|
coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
251
|
|
91
|
|
|
|
|
|
|
); |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
1; |