| 1 | 9 | ▶ | use utf8; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 2 | package Net::Etcd::KV::DeleteRange; | ||||||||||
| 3 | |||||||||||
| 4 | 9 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 9 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 9 | ▶ | use Moo; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 9 | ▶ | use Types::Standard qw(Str Int Bool HashRef ArrayRef); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | 9 | ▶ | use MIME::Base64; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 10 | 9 | ▶ | use JSON; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 11 | |||||||||||
| 12 | 9 | with 'Net::Etcd::Role::Actions'; | |||||||||
| 13 | |||||||||||
| 14 | 9 | ▶ | use namespace::clean; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | =head1 NAME | ||||||||||
| 17 | |||||||||||
| 18 | Net::Etcd::DeleteRange | ||||||||||
| 19 | |||||||||||
| 20 | =cut | ||||||||||
| 21 | |||||||||||
| 22 | 9 | our $VERSION = '0.022'; | |||||||||
| 23 | |||||||||||
| 24 | =head1 DESCRIPTION | ||||||||||
| 25 | |||||||||||
| 26 | DeleteRange deletes the given range from the key-value store. A | ||||||||||
| 27 | delete request increments the revision of the key-value store and | ||||||||||
| 28 | generates a delete event in the event history for every deleted key. | ||||||||||
| 29 | |||||||||||
| 30 | =head1 ACCESSORS | ||||||||||
| 31 | |||||||||||
| 32 | =head2 endpoint | ||||||||||
| 33 | |||||||||||
| 34 | =cut | ||||||||||
| 35 | |||||||||||
| 36 | 9 | has endpoint => ( | |||||||||
| 37 | is => 'ro', | ||||||||||
| 38 | isa => Str, | ||||||||||
| 39 | default => '/kv/deleterange' | ||||||||||
| 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 | 0 | ▶ | coerce => sub { return encode_base64( $_[0], '' ) }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 53 | 9 | ); | |||||||||
| 54 | |||||||||||
| 55 | =head2 prev_kv | ||||||||||
| 56 | |||||||||||
| 57 | If prev_kv is set, etcd gets the previous key-value pair before changing it. | ||||||||||
| 58 | The previous key-value pair will be returned in the put response. | ||||||||||
| 59 | |||||||||||
| 60 | =cut | ||||||||||
| 61 | |||||||||||
| 62 | has prev_kv => ( | ||||||||||
| 63 | is => 'ro', | ||||||||||
| 64 | isa => Bool, | ||||||||||
| 65 | 0 | ▶ | coerce => sub { no strict 'refs'; return $_[0] ? JSON::true : JSON::false } | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=1.2
Subroutine
__ANON__: not called CC=2 SCAR=9.2
Branch: 1 branch
| |||||||||||
| 66 | 9 | ); | |||||||||
| 67 | |||||||||||
| 68 | =head2 range_end | ||||||||||
| 69 | |||||||||||
| 70 | range_end is the upper bound on the requested range [key, range_end). If range_end is '\0', | ||||||||||
| 71 | the range is all keys >= key. If the range_end is one bit larger than the given key, then | ||||||||||
| 72 | the range requests get the all keys with the prefix (the given key). If both key and | ||||||||||
| 73 | range_end are '\0', then range requests returns all keys. the key is encoded with base64. | ||||||||||
| 74 | type bytes. NOTE: If range_end is not given, the request only looks up key. | ||||||||||
| 75 | |||||||||||
| 76 | =cut | ||||||||||
| 77 | |||||||||||
| 78 | has range_end => ( | ||||||||||
| 79 | is => 'ro', | ||||||||||
| 80 | isa => Str, | ||||||||||
| 81 | 0 | ▶ | coerce => sub { return encode_base64( $_[0], '' ) } | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 82 | 9 | ); | |||||||||
| 83 | |||||||||||
| 84 | 9 | 1; | |||||||||