Etcd3
view release on metacpan or search on metacpan
lib/Etcd3/Lease.pm view on Meta::CPAN
=head1 PUBLIC METHODS
=head2 grant
LeaseGrant creates a lease which expires if the server does not receive a keepAlive within
a given time to live period. All keys attached to the lease will be expired and deleted if
the lease expires. Each expired key generates a delete event in the event history.
$etcd->lease({ name =>'foo' password => 'bar' })->grant
=cut
sub grant {
my $self = shift;
$self->{endpoint} = '/lease/grant';
confess 'TTL and ID are required for ' . __PACKAGE__ . '->grant'
unless ($self->{ID} && $self->{TTL});
$self->request;
return $self;
}
=head2 revoke
LeaseRevoke revokes a lease. All keys attached to the lease will expire and be deleted.
$etcd->lease({{ ID => 7587821338341002662 })->revoke
=cut
sub revoke {
my $self = shift;
$self->{endpoint} = '/kv/lease/revoke';
confess 'ID is required for ' . __PACKAGE__ . '->revoke'
unless $self->{ID};
$self->request;
return $self;
}
=head2 ttl
LeaseTimeToLive retrieves lease information.
$etcd->lease({{ ID => 7587821338341002662, keys => 1 })->ttl
=cut
sub ttl {
my $self = shift;
$self->{endpoint} = '/kv/lease/timetolive';
confess 'ID is required for ' . __PACKAGE__ . '->ttl'
unless $self->{ID};
$self->request;
return $self;
}
=head2 keepalive
LeaseKeepAlive keeps the lease alive by streaming keep alive requests from the client
to the server and streaming keep alive responses from the server to the client."
$etcd->lease({{ ID => 7587821338341002662 })->keepalive
=cut
sub keepalive {
my $self = shift;
$self->{endpoint} = '/lease/keepalive';
confess 'ID is required for ' . __PACKAGE__ . '->keepalive'
unless $self->{ID};
$self->request;
return $self;
}
1;
( run in 1.270 second using v1.01-cache-2.11-cpan-437f7b0c052 )