Branching mogilefs-client to version 1.2.1
[ruby-mogilefs-client.git] / README.txt
bloba96b399d457b8d73cd14b50f39699f98ff833051
1 = mogilefs-client
3 A Ruby MogileFS client
5 Rubyforge Project:
7 http://rubyforge.org/projects/seattlerb/
9 Documentation:
11 http://seattlerb.org/mogilefs-client
13 File bugs:
15 http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921
17 == About
19 A Ruby MogileFS client.  MogileFS is a distributed filesystem written
20 by Danga Interactive.  This client supports NFS and HTTP modes.
22 For information on MogileFS see:
24 http://danga.com/mogilefs/
26 == Installing mogilefs-client
28 First you need a MogileFS setup.  You can find information on how to do that at the above URL.
30 Then install the gem:
32   $ sudo gem install mogilefs-client
34 == Using mogilefs-client
36   # Create a new instance that will communicate with these trackers:
37   hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
38   mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts
39                               :root => '/mnt/mogilefs')
40   
41   # Stores "A bunch of text to store" into 'some_key' with a class of 'text'.
42   mg.store_content 'some_key', 'text', "A bunch of text to store"
43   
44   # Retrieve data from 'some_key'
45   data = mg.get_file_data 'some_key'
46   
47   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
48   # 'image'.
49   mg.store_file 'my_image', 'image', 'image.jpeg'
50   
51   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
52   # 'image' using an open IO.
53   File.open 'image.jpeg' do |fp|
54     mg.store_file 'my_image', 'image', fp
55   end
56   
57   # Remove the key 'my_image' and 'some_key'.
58   mg.delete 'my_image'
59   mg.delete 'some_key'
61 == WARNING!
63 This client is only known to work in NFS mode.  HTTP mode is implemented but
64 only lightly tested in production environments.  If you find a bug,
65 please report it on the Rubyforge project.