EV-Etcd
view release on metacpan or search on metacpan
lib/EV/Etcd.pm view on Meta::CPAN
True if more keys exist beyond the returned C<kvs> (C<limit> truncated the
result).
=item header
Cluster response header (see L</ERROR HANDLING>).
=back
=head2 delete
$client->delete($key, $callback);
$client->delete($key, \%opts, $callback);
Delete key(s) from etcd.
Options:
=over 4
=item prefix
If true, deletes all keys with the given prefix.
=item range_end
End of the key range to delete.
=item prev_kv
If true, returns the deleted key-value pairs in the response.
=back
The callback receives C<($response, $error)>. Response keys: C<header>,
C<deleted> (count of keys deleted), plus C<prev_kvs> (array of kv hashrefs)
when the C<prev_kv> option is set.
=head1 WATCH SERVICE
=head2 watch
my $watch = $client->watch($key, $callback);
my $watch = $client->watch($key, \%opts, $callback);
Create a watch on a key or key range. Returns an EV::Etcd::Watch object.
The callback is invoked with C<($response, $error)> for each watch message.
Response keys:
=over 4
=item events
Array reference of event hashrefs (C<type> = "PUT" or "DELETE", C<kv>, and
optionally C<prev_kv> when the C<prev_kv> option is set).
=item watch_id
Server-assigned watch identifier. Note that etcd assigns a fresh id for
each Watch stream, so this value can change if the watch transparently
reconnects.
=item created
True on the first message after the watch is established.
=item header
Cluster response header.
=back
Server-side cancellation (including compaction-induced) is delivered through
the I<error> callback path, not as a success response â C<$err->{source}>
will be C<"watch"> and C<$err->{message}> will contain the server's reason
(typically including the compact revision when relevant).
Options:
=over 4
=item prefix
If true, watches all keys with the given prefix.
=item range_end
End of the key range to watch.
=item start_revision
Revision to start watching from. If not specified, watches from the
current revision. Use this to resume watching after a reconnect.
=item prev_kv
If true, the response will include the previous key-value pair for
UPDATE and DELETE events.
=item progress_notify
If true, the server will periodically send progress notifications
even when there are no events, allowing the client to know the
current revision.
=item watch_id
Optional explicit watch ID. If not specified, the server assigns one.
=item auto_reconnect
If true, the watch will automatically reconnect after a connection failure,
resuming from the last seen revision. Default is true. This is useful for
long-running watches that should survive network interruptions.
my $watch = $client->watch('/my/key', {
auto_reconnect => 1,
progress_notify => 1, # Helps track revision even during inactivity
}, sub {
my ($event, $err) = @_;
( run in 0.691 second using v1.01-cache-2.11-cpan-7fcb06a456a )