Net::STF::Client - STF Client
use Net::STF::Client; my $client = Net::STF::Client->new( url => "http://stf.example.com", repl_count => 3, ); # If you want to use Basic Auth: # my $client = Net::STF::Client->new( # ... other params ... # username => ...., # password => ...., # ); # direct CRUD from the client (fastest if you have the URL) $object = $client->put_object( $url, $content, \%opts ); $object = $client->get_object( $url, \%opts ); $bool = $client->delete_object( $url, \%opts ); $bool = $client->delete_bucket( $url, \%opts ); # bucket-oriented interface my $bucket = $client->create_bucket( $bucket_name ); $object = $bucket->put_object( $key, $content, \%opts ); $object = $bucket->get_object( $key, \%opts ); $bool = $bucket->del_object( $key, \%opts ); $bool = $bucket->delete( $recursive ); # object data $object->url; $object->key; $object->content;
Net::STF::Client implements the STF protocol to talk to STF servers.
The base URL for your STF server. Required if you're going to use the bucket-oriented interface.
The default number of replicas to request when creating new objects. You may override this setting during a call to put_object(), but if unspecified, this value will be used as default.
If you don't specify this value in the constructor call, default value of 3 will be used.
Username used for basic authentication. Leave blank if your server does not use basic authentiation.
Password used for basic authentication. Leave blank if your server does not use basic authentiation.
The user agent name used when accessing the STF server. If unspecified, "Net::STF::Client/$VERSION" will be used as default.
Furl::HTTP object to talk to the STF server. You only need to provide this if you want to customize the behavior of Furl::HTTP object, which is pretty rare.
The object value to be stored. Can be anything that Furl::HTTP can handle when making a POST request.
The URL to put your object.
If the url parameter was supplied, you may specify a URL fragment containing the"$bucket_name/$object_name"
So these are equivalent:
my $stf_base = "http://stf.mycompany.com/"; my $bucket_name = "mybucket"; my $object_name = "path/to/object.dat"; # Complete URL { my $client = Net::STF::Client->new(); $client->put_object( "$stf_base/$bucket_name/$object_name", ... ); } # URL fragment { my $client = Net::STF::Client->new( url => $stf_base ); $client->put_object( "$bucket_name/$object_name", ... ); }
Specify if you want to override the default X-STF-Replication-Count value:
# Make a lot of replicas for this object! $client->put_object( $url, $content, { repl_count => 30 } ); # Use whatever default in $client $client->put_object( $url, $content );
Specify if you want to set the X-STF-Consistency value.
Appended to headers sent by Furl::HTTP
Passed to Furl::HTTP
See docs for put_object() for details
Net::STF::Object
Net::STF::Bucket
Daisuke Maki <daisuke@endeworks.jp>
<daisuke@endeworks.jp>
Copyright (C) 2011 by Daisuke Maki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.
To install Net::STF::Client, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Net::STF::Client
CPAN shell
perl -MCPAN -e shell install Net::STF::Client
For more information on module installation, please visit the detailed CPAN module installation guide.