Brackup
view release on metacpan or search on metacpan
lib/Brackup/Target/Riak.pm view on Meta::CPAN
my $obj = $self->_load(backup => $name) or return;
$output_file ||= "$name.brackup";
open(my $out, ">$output_file") or die "Failed to open $output_file: $!\n";
my $outv = syswrite($out, $obj->data);
die "download/write error" unless $outv == do { use bytes; length $obj->data };
close $out;
return 1;
}
sub delete_backup {
my ($self, $name) = @_;
my $obj = $self->_load(backup => $name) or return;
$obj->delete;
}
sub chunkpath {
my ($self, $dig) = @_;
return $dig;
}
sub size {
my ($self, $dig) = @_;
my $obj = $self->_load(chunk => $dig) or return 0;
return $obj->_headers->content_length;
}
1;
=head1 NAME
Brackup::Target::Riak - backup to a Riak key-value store
=head1 EXAMPLE
In your ~/.brackup.conf file:
[TARGET:riak1]
type = Riak
riak_host_url = http://192.168.1.1:8098/
riak_r = 1
riak_bucket_prefix = brackup-test
=head1 CONFIG OPTIONS
All options may be omitted unless specified.
=over
=item B<type>
I<(Mandatory.)> Must be "B<Riak>".
=item B<riak_host_url>
URL specifying your riak cluster endpoint. Default: http://127.0.0.1:8098/.
=item B<riak_r>
riak read quorum - how many replicas need to agree when retrieving an object.
Default: 2.
=item B<riak_w>
riak write quorum - how many replicas to write to before returning success.
Default: 2.
=item B<riak_dw>
riak durable write quorum - how many replicas to write to durable storage
before returning success. Default: 2.
=item B<riak_bucket_prefix>
Prefix to use on riak buckets. Probably only worth changing if you want to
store (and separate) multiple brackups in a riak cluster. Default: brackup.
=back
=head1 SEE ALSO
L<Brackup::Target>
L<Net::Riak> -- required module to use Brackup::Target::Riak
=head1 AUTHOR
Gavin Carr E<lt>gavin@openfusion.com.auE<gt>.
Copyright (c) 2010 Gavin Carr.
This module is free software. You may use, modify, and/or redistribute
this software under the same terms as perl itself.
=cut
# vim:sw=4:et
( run in 2.390 seconds using v1.01-cache-2.11-cpan-9e1a9122474 )