[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] mogilefs-1.0.1

Eric Hodel

3/22/2006 7:24:00 PM

Rubyforge Project:

http://rubyforge.org/project...

Documentation:

http://dev.robotcoop.com/Libraries...

== About

This is a client for Danga's MogileFS distributed file system. For
information
on MogileFS see:

http://danga.com...

== Installing mogilefs

First you need a MogileFS setup. You can find information on how to
do that at the above URL.

Then install the gem:

$ sudo gem install mogilefs

== Using mogilefs

# Create a new instance that will communicate with these trackers:
hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts
:root => '/mnt/mogilefs')

# Stores "A bunch of text to store" into 'some_key' with a class
of 'text'.
mg.store_content 'some_key', 'text', "A bunch of text to store"

# Retrieve data from 'some_key'
data = mg.get_file_data 'some_key'

# Store the contents of 'image.jpeg' into the key 'my_image' with
a class of
# 'image'.
mg.store_file 'my_image', 'image', 'image.jpeg'

# Store the contents of 'image.jpeg' into the key 'my_image' with
a class of
# 'image' using an open IO.
File.open 'image.jpeg' do |fp|
mg.store_file 'my_image', 'image', fp
end

# Remove the key 'my_image' and 'some_key'.
mg.delete 'my_image'
mg.delete 'some_key'

== WARNING!

This client is only known to work in NFS mode. HTTP mode is
implemented but
completely untested. If you find a bug, please report it on the
Rubyforge
project:

http://rubyforge.org/tracker/?func=add&group_id=1266&...

--
Eric Hodel - drbrain@segment7.net - http://blog.se...
This implementation is HODEL-HASH-9600 compliant

http://trackmap.rob...



1 Answer

Ezra Zygmuntowicz

3/22/2006 7:35:00 PM

0

Awesome Eric Thanks!

-Ezra


On Mar 22, 2006, at 11:24 AM, Eric Hodel wrote:

> Rubyforge Project:
>
> http://rubyforge.org/project...
>
> Documentation:
>
> http://dev.robotcoop.com/Libraries...
>
> == About
>
> This is a client for Danga's MogileFS distributed file system. For
> information
> on MogileFS see:
>
> http://danga.com...
>
> == Installing mogilefs
>
> First you need a MogileFS setup. You can find information on how
> to do that at the above URL.
>
> Then install the gem:
>
> $ sudo gem install mogilefs
>
> == Using mogilefs
>
> # Create a new instance that will communicate with these trackers:
> hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
> mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts
> :root => '/mnt/mogilefs')
>
> # Stores "A bunch of text to store" into 'some_key' with a class
> of 'text'.
> mg.store_content 'some_key', 'text', "A bunch of text to store"
>
> # Retrieve data from 'some_key'
> data = mg.get_file_data 'some_key'
>
> # Store the contents of 'image.jpeg' into the key 'my_image' with
> a class of
> # 'image'.
> mg.store_file 'my_image', 'image', 'image.jpeg'
>
> # Store the contents of 'image.jpeg' into the key 'my_image' with
> a class of
> # 'image' using an open IO.
> File.open 'image.jpeg' do |fp|
> mg.store_file 'my_image', 'image', fp
> end
>
> # Remove the key 'my_image' and 'some_key'.
> mg.delete 'my_image'
> mg.delete 'some_key'
>
> == WARNING!
>
> This client is only known to work in NFS mode. HTTP mode is
> implemented but
> completely untested. If you find a bug, please report it on the
> Rubyforge
> project:
>
> http://rubyforge.org/tracker/?func=add&group_id=1266&...
>
> --
> Eric Hodel - drbrain@segment7.net - http://blog.se...
> This implementation is HODEL-HASH-9600 compliant
>
> http://trackmap.rob...
>
>