refactor httpfile and remove layering violation
[ruby-mogilefs-client.git] / README.txt
blob0def5e946bb8e12020d936f1baf30a850eb54de2
1 = mogilefs-client
3 A Ruby MogileFS client
5 Rubyforge Project:
7 http://rubyforge.org/projects/seattlerb/
9 Documentation:
11 http://seattlerb.rubyforge.org/mogilefs-client
13 File bugs:
15 http://rubyforge.org/tracker/?func=add&group_id=1513&atid=5921
17 Please email Eric Wong at normalperson@yhbt.net as well since
18 he finds web interfaces difficult to use.
20 Source repository (git):
22   git://bogomips.org/mogilefs-client.git
23   http://bogomips.org/mogilefs-client.git
24   git://repo.or.cz/ruby-mogilefs-client.git (mirror)
25   http://repo.or.cz/r/ruby-mogilefs-client.git (mirror)
27 Repository browsers:
29 * http://bogomips.org/mogilefs-client.git (cgit)
30 * http://repo.or.cz/w/ruby-mogilefs-client.git (gitweb mirror)
32 == About
34 A Ruby MogileFS client.  MogileFS is a distributed filesystem written
35 by Danga Interactive.  This client only supports HTTP.
37 For information on MogileFS see:
39 http://danga.com/mogilefs/
41 == Installing mogilefs-client
43 First you need a MogileFS setup.  You can find information on how to do
44 that at the above URL.
46 Then install the gem:
48   $ sudo gem install mogilefs-client
50 == Using mogilefs-client
52   # Create a new instance that will communicate with these trackers:
53   hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
54   mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts)
56   # Stores "A bunch of text to store" into 'some_key' with a class of 'text'.
57   mg.store_content 'some_key', 'text', "A bunch of text to store"
59   # Retrieve data from 'some_key'
60   data = mg.get_file_data 'some_key'
62   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
63   # 'image'.
64   mg.store_file 'my_image', 'image', 'image.jpeg'
66   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
67   # 'image' using an open IO.
68   File.open 'image.jpeg', 'rb' do |fp|
69     mg.store_file 'my_image', 'image', fp
70   end
72   # Remove the key 'my_image' and 'some_key'.
73   mg.delete 'my_image'
74   mg.delete 'some_key'
76 == WARNING!
78 This client is only supported in HTTP mode.  NFS mode was previously
79 supported in 1.3.x, but since MogileFS 2.x has dropped support for
80 NFS, this client has removed support for it.