backend: remember to require 'thread' here
[ruby-mogilefs-client.git] / README.txt
blob71ad0bc79b5ae3782315442742b03dd5c6919d05
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 Source repository (git):
19 git://git.bogomips.org/mogilefs-client.git
20 http://git.bogomips.org/mogilefs-client.git
22 Repository browser (cgit):
24 http://git.bogomips.org/cgit/mogilefs-client.git
26 == About
28 A Ruby MogileFS client.  MogileFS is a distributed filesystem written
29 by Danga Interactive.  This client only supports HTTP.
31 For information on MogileFS see:
33 http://danga.com/mogilefs/
35 == Installing mogilefs-client
37 First you need a MogileFS setup.  You can find information on how to do
38 that at the above URL.
40 Then install the gem:
42   $ sudo gem install mogilefs-client
44 == Using mogilefs-client
46   # Create a new instance that will communicate with these trackers:
47   hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
48   mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts)
50   # Stores "A bunch of text to store" into 'some_key' with a class of 'text'.
51   mg.store_content 'some_key', 'text', "A bunch of text to store"
53   # Retrieve data from 'some_key'
54   data = mg.get_file_data 'some_key'
56   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
57   # 'image'.
58   mg.store_file 'my_image', 'image', 'image.jpeg'
60   # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
61   # 'image' using an open IO.
62   File.open 'image.jpeg' do |fp|
63     mg.store_file 'my_image', 'image', fp
64   end
66   # Remove the key 'my_image' and 'some_key'.
67   mg.delete 'my_image'
68   mg.delete 'some_key'
70 == WARNING!
72 This client is only supported in HTTP mode.  NFS mode was previously
73 supported in 1.3.x, but since MogileFS 2.x has dropped support for
74 NFS, this client has removed support for it.