Respect timeout when doing get_file_data
[ruby-mogilefs-client.git] / README.txt
blobecaa131ec0f70be382310f4cde0c266c905f7dd7
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 Source repository (git):
19 git://git.bogomips.org/mogilefs-client.git
21 http://git.bogomips.org/mogilefs-client.git
23 Repository browser (cgit):
25 http://git.bogomips.org/cgit/mogilefs-client.git
27 == About
29 A Ruby MogileFS client.  MogileFS is a distributed filesystem written
30 by Danga Interactive.  This client only supports HTTP.
32 For information on MogileFS see:
34 http://danga.com/mogilefs/
36 == Installing mogilefs-client
38 First you need a MogileFS setup.  You can find information on how to do
39 that at the above URL.
41 Then install the gem:
43   $ sudo gem install mogilefs-client
45 == Using mogilefs-client
47   # Create a new instance that will communicate with these trackers:
48   hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
49   mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts)
51   # Stores "A bunch of text to store" into 'some_key' with a class of 'text'.
52   mg.store_content 'some_key', 'text', "A bunch of text to store"
54   # Retrieve data from 'some_key'
55   data = mg.get_file_data 'some_key'
57   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
58   # 'image'.
59   mg.store_file 'my_image', 'image', 'image.jpeg'
61   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
62   # 'image' using an open IO.
63   File.open 'image.jpeg', 'rb' do |fp|
64     mg.store_file 'my_image', 'image', fp
65   end
67   # Remove the key 'my_image' and 'some_key'.
68   mg.delete 'my_image'
69   mg.delete 'some_key'
71 == WARNING!
73 This client is only supported in HTTP mode.  NFS mode was previously
74 supported in 1.3.x, but since MogileFS 2.x has dropped support for
75 NFS, this client has removed support for it.