Skip to content

Commit

Permalink
Merge pull request #12 from hexfusion/maint
Browse files Browse the repository at this point in the history
Bump version for release.
  • Loading branch information
hexfusion committed Jun 16, 2017
2 parents 590124a + 0f406bc commit d1274f1
Show file tree
Hide file tree
Showing 22 changed files with 350 additions and 25 deletions.
3 changes: 3 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
Revision history for Net::Etcd
0.010
[ ENHANCEMENTS ]
* Add intial support for snapshot

0.009
[ ENHANCEMENTS ]
Expand Down
2 changes: 2 additions & 0 deletions MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ lib/Net/Etcd/Lease.pm
lib/Net/Etcd/Maintenance.pm
lib/Net/Etcd/Role/Actions.pm
lib/Net/Etcd/KV.pm
lib/Net/Etcd/KV/Compare.pm
lib/Net/Etcd/KV/MultiOp.pm
lib/Net/Etcd/KV/Put.pm
lib/Net/Etcd/KV/Range.pm
lib/Net/Etcd/KV/Txn.pm
Expand Down
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ PUBLIC METHODS
lease
Returns a Net::Etcd::Lease object.

maintenance
Returns a Net::Etcd::Maintenance object.

user
Returns a Net::Etcd::User object.

Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,10 @@ Returns a [Net::Etcd::Auth](https://metacpan.org/pod/Net::Etcd::Auth) object.

Returns a [Net::Etcd::Lease](https://metacpan.org/pod/Net::Etcd::Lease) object.

## maintenance

Returns a [Net::Etcd::Maintenance](https://metacpan.org/pod/Net::Etcd::Maintenance) object.

## user

Returns a [Net::Etcd::User](https://metacpan.org/pod/Net::Etcd::User) object.
Expand Down
14 changes: 13 additions & 1 deletion lib/Net/Etcd.pm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Net::Etcd
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 SYNOPSIS
Expand Down Expand Up @@ -308,6 +308,18 @@ Returns a L<Net::Etcd::KV::Txn> object.
=cut

=head2 op
Returns a L<Net::Etcd::KV::Op> object.
=cut

=head2 compare
Returns a L<Net::Etcd::KV::Compare> object.
=cut

=head2 configuration
Initialize configuration checks to see it etcd is installed locally.
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Etcd/Auth.pm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Net::Etcd::Auth
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Etcd/Auth/Role.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Net::Etcd::Auth::Role
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Etcd/Config.pm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Net::Etcd::Config
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 ACCESSORS
Expand Down
38 changes: 34 additions & 4 deletions lib/Net/Etcd/KV.pm
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ use Moo::Role;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use Net::Etcd::KV::Put;
use Net::Etcd::KV::Range;
use Net::Etcd::KV::Txn;
use Net::Etcd::KV::Op;
use Net::Etcd::KV::Compare;

with 'Net::Etcd::Role::Actions';
use namespace::clean;
Expand All @@ -21,7 +24,7 @@ Net::Etcd::KV
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 DESCRIPTION
Expand Down Expand Up @@ -71,7 +74,7 @@ sub put {
cb => $cb,
( $options ? %$options : () ),
);
$put->request;
$put->request unless $put->hold;
return $put;
}

Expand All @@ -94,8 +97,35 @@ sub txn {
cb => $cb,
( $options ? %$options : () ),
);
$txn->request;
return $txn;
return $txn->create;
}

=head2 op
=cut

sub op {
my ( $self, $options ) = @_;
my $cb = pop if ref $_[-1] eq 'CODE';
my $op = Net::Etcd::KV::Op->new(
%$self,
( $options ? %$options : () ),
);
return $op->create;
}

=head2 compare
=cut

sub compare {
my ( $self, $options ) = @_;
my $cb = pop if ref $_[-1] eq 'CODE';
my $cmp = Net::Etcd::KV::Compare->new(
%$self,
( $options ? %$options : () ),
);
return $cmp;
}

1;
104 changes: 104 additions & 0 deletions lib/Net/Etcd/KV/Compare.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
use utf8;
package Net::Etcd::KV::Compare;

use strict;
use warnings;

use Moo;
use Types::Standard qw(Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use Data::Dumper;
use JSON;

with 'Net::Etcd::Role::Actions';

use namespace::clean;

=head1 NAME
Net::Etcd::KV::Compare
=cut

our $VERSION = '0.009';

=head1 DESCRIPTION
Op
=head1 ACCESSORS
=head2 result
result is logical comparison operation for this comparison.
=cut

has result => (
is => 'ro',
);

=head2 target
target is the key-value field to inspect for the comparison.
=cut

has target => (
is => 'ro',
);

=head2 key
key is the subject key for the comparison operation.
=cut

has key => (
is => 'ro',
coerce => sub { return encode_base64( $_[0], '' ) },
);


=head2 version
version is the version of the given key
=cut

has version => (
is => 'ro',
);

=head2 create_revision
create_revision is the creation revision of the given key
=cut

has create_revision => (
is => 'ro',
);

=head2 mod_revision
mod_revision is the last modified revision of the given key.
=cut

has mod_revision => (
is => 'ro',
);

=head2 value
value is the value of the given key, in bytes.
=cut

has value => (
is => 'ro',
);

1;
73 changes: 73 additions & 0 deletions lib/Net/Etcd/KV/Op.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
use utf8;
package Net::Etcd::KV::Op;

use strict;
use warnings;

use Moo;
use Types::Standard qw(InstanceOf Str Int Bool HashRef ArrayRef);
use MIME::Base64;
use Data::Dumper;
use JSON;

with 'Net::Etcd::Role::Actions';

use namespace::clean;

=head1 NAME
Net::Etcd::KV::Op
=cut

our $VERSION = '0.010';

=head1 DESCRIPTION
Op
=head1 ACCESSORS
=head2 request_range
=cut

has request_range => (
is => 'ro',
);

=head2 request_put
=cut

has request_put => (
is => 'ro',
);

=head2 request_delete_range
=cut

has request_delete_range => (
is => 'ro',
);

=head2 create
create op
=cut

sub create {
my $self = shift;
my @op;
my $put = $self->request_put;
my $range = $self->request_range;
my $delete_range = $self->request_delete_range;
push @op, '{"RequestPut":' . $put->json_args . '}' if defined $put;
push @op, '{"RequestRange":' . $range->json_args . '}' if defined $range;
push @op, '{"RequestDeleteRange":' . $delete_range->json_args . '}' if defined $delete_range;
return @op;
}

1;
2 changes: 1 addition & 1 deletion lib/Net/Etcd/KV/Put.pm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Net::Etcd::Put
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 DESCRIPTION
Expand Down
2 changes: 1 addition & 1 deletion lib/Net/Etcd/KV/Range.pm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Net::Etcd::Range
=cut

our $VERSION = '0.009';
our $VERSION = '0.010';

=head1 DESCRIPTION
Expand Down
Loading

0 comments on commit d1274f1

Please sign in to comment.