]>
git.proxmox.com Git - librados2-perl.git/blob - PVE/RADOS.pm
11 our @ISA = qw(Exporter);
13 # Items to export into callers namespace by default. Note: do not export
14 # names by default without a very good reason. Use EXPORT_OK instead.
15 # Do not simply export all your public functions/methods/constants.
17 # This allows declaration use PVE::RADOS ':all';
18 # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK
20 our %EXPORT_TAGS = ( 'all' => [ qw(
24 our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } );
33 XSLoader
::load
('PVE::RADOS', $VERSION);
36 my $conn = pve_rados_create
() ||
37 die "unable to create RADOS object\n";
39 pve_rados_connect
($conn);
41 my $self = bless { conn
=> $conn };
49 pve_rados_shutdown
($self->{conn
});
55 return pve_rados_cluster_stat
($self->{conn
});
58 # example: { prefix => 'mon dump', format => 'json' }
60 my ($self, $cmd) = @_;
62 my $json = encode_json
($cmd);
63 my $raw = pve_rados_mon_command
($self->{conn
}, [ $json ]);
64 if ($cmd->{format
} && $cmd->{format
} eq 'json') {
65 return decode_json
($raw);
76 PVE::RADOS - Perl bindings for librados
82 my $rados = PVE::RADOS::new();
83 my $stat = $rados->cluster_stat();
84 my $res = $rados->mon_command({ prefix => 'mon dump', format => 'json' });
88 Perl bindings for librados.
96 Dietmar Maurer, E<lt>dietmar@proxmox.com<gt>