| Catalyst-Model-MogileFS-Client documentation | Contained in the Catalyst-Model-MogileFS-Client distribution. |
Catalyst::Model::MogileFS::Client - Model class of MogileFS::Client on Catalyst
Version 0.06
in MyApp.pm
package MyApp;
MyApp->config(
'Model::Storage::MyImage' => {
domain => 'myimage.art-code.org',
readonly => 1
}
);
At first, you must run mogilefsd and mogstored. For example,
$ sudo mogstored $ sudo -u mogile mogilefsd
Next, execute Makefile.PL.
Constructor. $config must be hash ref. See below for available parameter. More detail in MogileFS::Client.
For nfs setup.
MogileFS domain
MogileFS::Backend object
readonly flag 1 or 0
trackers hosts as array ref
timeout sec
Reload MogileFS::Client setting More detail, see 'new' method.
Getter for MogileFS::Client original instance
Return last using tracker. See MogileFS::Client, MogileFS::Backend
Return error message if exists errors. See MogileFS::Client, MogileFS::Backend
Return error code if exists errors. See MogileFS::Client, MogileFS::Backend
Readonly flag accessor. See MogileFS::Client, MogileFS::Backend
$arg must be hash ref as {"standard-ip" => "prefferred-ip"}. See MogileFS::Client, MogileFS::Backend
Return MogileFS::NewHTTPFile object or undef if no device.
Specified file key name.
Specified class name include files.
The length of the file.
It must be hash ref. Now supported option is "fid".
"fid" option is unique file id to use instead of just picking one in the database.
See MogileFS::Client, MogileFS::Backend
File name.
See also new_method about other arguments. See MogileFS::Client, MogileFS::Backend
File content.
See also new_method about other arguments. See MogileFS::Client, MogileFS::Backend
Specified file key name.
Available two option. see below.
No verify. 0 or 1.
Specified zone value.
See MogileFS::Client, MogileFS::Backend
Specified file key name.
Timeout seconds. default 10 sec.
See MogileFS::Client, MogileFS::Backend
Delete file with $key.
See MogileFS::Client, MogileFS::Backend
Sleep thread $duration seconds. See MogileFS::Client, MogileFS::Backend
Rename file key name $from_key to $to_key. See MogileFS::Client, MogileFS::Backend
Search key list by $prefix, $after.
key's prefix.
key's postfix.
Limitation of result list count.
See MogileFS::Client, MogileFS::Backend
Apply callback easch list keys.
Hash ref. Available option is only prefix. See list_keys method.
Code ref with 1 argument.
See MogileFS::Client, MogileFS::Backend
used to support plugins that have modified the server, this builds things into an argument list and passes them back to the server
See MogileFS::Client, MogileFS::Backend
Toru Yamaguchi, <zigorou at cpan.org>
Please report any bugs or feature requests to
bug-catalyst-model-mogilefs-client at rt.cpan.org, or through the web interface at
http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-Model-MogileFS-Client.
I will be notified, and then you'll automatically be notified of progress on
your bug as I make changes.
You can find documentation for this module with the perldoc command.
perldoc Catalyst::Model::MogileFS::Client
You can also look for information at:
http://cpanratings.perl.org/d/Catalyst-Model-MogileFS-Client
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Catalyst-Model-MogileFS-Client
Copyright 2006 Toru Yamaguchi, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-Model-MogileFS-Client documentation | Contained in the Catalyst-Model-MogileFS-Client distribution. |
package Catalyst::Model::MogileFS::Client; use strict; use warnings; use base qw/Catalyst::Model/; use Carp qw/croak/; use Catalyst::Exception; use NEXT; use Scalar::Util qw/reftype/; use MogileFS::Client; __PACKAGE__->mk_accessors(qw/client/); { no strict 'refs'; my @delegate_methods = qw( last_tracker errstr errcode readonly set_pref_ip new_file store_file store_content get_paths get_file_data delete sleep rename list_keys foreach_keys ); foreach my $method (@delegate_methods) { *{ "Catalyst::Model::MogileFS::Client::" . ${method} } = sub { my ( $proto, @args ) = @_; return eval { $proto->client->$method(@args); }; if ( my $error = $@ ) { Catalyst::Exception->throw($error); } }; } }
our $VERSION = '0.06'; our $AUTOLOAD;
sub new { my $class = shift; my $arguments = pop; my $c = shift; $class->config($arguments); my $self = $class->NEXT::new( $c, $class->config ); eval { $self->client( MogileFS::Client->new( $class->_regulize_config( $class->config ) ) ); }; if ( my $error = $@ ) { Catalyst::Exception->throw($error); } return $self; }
sub reload { my $self = shift; return eval { $self->client->reload( $self->_regulize_config(@_) ); }; if ( my $error = $@ ) { Catalyst::Exception->throw($error); } }
sub AUTOLOAD { my $self = shift; my $method = $AUTOLOAD; $method =~ s/^.*://; return if ( $method eq 'DESTROY' ); return eval { return $self->$method(@_) if ( $self->can($method) ); return $self->client->$method(@_) if ( $self->can() ); }; croak($@); } sub _regulize_config { my $proto = shift; my %params = (); if ( reftype $_[0] eq 'HASH' ) { %params = %{ $_[0] }; } else { %params = @_; } my %options; $options{$_} = 1 foreach (qw/root domain backend readonly hosts timeout/); return map { ( $_, $params{$_} ) } grep { exists $options{$_} } keys %params; }
1; # End of Catalyst::Model::MogileFS::Client