1 = mogilefs-client - MogileFS client library for Ruby
3 A MogileFS client library for Ruby. MogileFS is an open source
4 distributed filesystem, see: http://mogilefs.org for more details. This
5 library allows any Ruby application to read, write and delete files in a
10 rdoc :: http://bogomips.org/mogilefs-client
11 mogilefs :: http://mogilefs.org/
12 list :: mailto:mogile@googlegroups.com
13 email :: mailto:normalperson@yhbt.net
14 repo :: git://bogomips.org/mogilefs-client.git
15 cgit :: http://bogomips.org/mogilefs-client.git
16 gitweb :: http://repo.or.cz/w/ruby-mogilefs-client.git
20 First you need a MogileFS 2.x installation. You can find information on
21 how to do that at http://mogilefs.org
23 Then install the RubyGem:
25 $ gem install mogilefs-client
27 This library supports Ruby 1.8.7 and later, but Ruby 1.9.3 is
28 recommended. No other libraries are required on the client.
32 # Create a new instance that will communicate with these trackers:
33 hosts = %w[192.168.1.69:6001 192.168.1.70:6001]
34 mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts)
36 # Stores "A bunch of text to store" into 'some_key' with a class of 'text'.
37 mg.store_content 'some_key', 'text', "A bunch of text to store"
39 # Retrieve data from 'some_key'
40 data = mg.get_file_data 'some_key'
42 # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
44 mg.store_file 'my_image', 'image', 'image.jpeg'
46 # Store the contents of 'image.jpeg' into the key 'my_image' with a class of
47 # 'image' using an open IO.
48 File.open 'image.jpeg', 'rb' do |fp|
49 mg.store_file 'my_image', 'image', fp
52 # Retrieve the contents of 'my_image' into '/path/to/huge_file'
53 # without slurping the entire contents into memory:
54 File.open '/path/to/huge_file', 'w' do |fp|
55 mg.get_file_data 'my_image', wr
58 # Remove the key 'my_image' and 'some_key'.
64 Feedback (bug reports, user/development dicussion, patches, pull
65 requests) are greatly appreciated and handled via email. We currently
66 piggy-back onto the public MogileFS
67 {mailing list}[mailto:mogile@googlegroups.com].
69 If you do not want to deal with the corporate host of the MogileFS
70 mailing list, or if you wish to keep your issue secret, feel free to
71 email {Eric Wong at}[mailto:normalperson@yhbt.net].
73 Do not expect Eric Wong to read HTML mail under any circumstances.
77 This client is only supported in HTTP mode. NFS mode was previously
78 supported in 1.3.x, but since MogileFS 2.x has dropped support for
79 NFS, this client has removed support for it.