diff options
Diffstat (limited to 'README')
-rw-r--r-- | README | 79 |
1 files changed, 79 insertions, 0 deletions
@@ -0,0 +1,79 @@ += mogilefs-client - MogileFS client library for Ruby + +A MogileFS client library for Ruby. MogileFS is an open source +distributed filesystem, see: http://mogilefs.org for more details. This +library allows any Ruby application to read, write and delete files in a +MogileFS instance. + +== Links + +rdoc :: http://bogomips.org/mogilefs-client +mogilefs :: http://mogilefs.org/ +list :: mailto:mogile@googlegroups.com +email :: mailto:normalperson@yhbt.net +repo :: git://bogomips.org/mogilefs-client.git +cgit :: http://bogomips.org/mogilefs-client.git +gitweb :: http://repo.or.cz/w/ruby-mogilefs-client.git + +== Install + +First you need a MogileFS 2.x installation. You can find information on +how to do that at http://mogilefs.org + +Then install the RubyGem: + + $ gem install mogilefs-client + +This library supports Ruby 1.8.7 and later, but Ruby 1.9.3 is +recommended. No other libraries are required on the client. + +== Use + + # Create a new instance that will communicate with these trackers: + hosts = %w[192.168.1.69:6001 192.168.1.70:6001] + mg = MogileFS::MogileFS.new(:domain => 'test', :hosts => hosts) + + # Stores "A bunch of text to store" into 'some_key' with a class of 'text'. + mg.store_content 'some_key', 'text', "A bunch of text to store" + + # Retrieve data from 'some_key' + data = mg.get_file_data 'some_key' + + # Store the contents of 'image.jpeg' into the key 'my_image' with a class of + # 'image'. + mg.store_file 'my_image', 'image', 'image.jpeg' + + # Store the contents of 'image.jpeg' into the key 'my_image' with a class of + # 'image' using an open IO. + File.open 'image.jpeg', 'rb' do |fp| + mg.store_file 'my_image', 'image', fp + end + + # Retrieve the contents of 'my_image' into '/path/to/huge_file' + # without slurping the entire contents into memory: + File.open '/path/to/huge_file', 'w' do |fp| + mg.get_file_data 'my_image', wr + end + + # Remove the key 'my_image' and 'some_key'. + mg.delete 'my_image' + mg.delete 'some_key' + +== Contact + +Feedback (bug reports, user/development dicussion, patches, pull +requests) are greatly appreciated and handled via email. We currently +piggy-back onto the public MogileFS +{mailing list}[mailto:mogile@googlegroups.com]. + +If you do not want to deal with the corporate host of the MogileFS +mailing list, or if you wish to keep your issue secret, feel free to +email {Eric Wong at}[mailto:normalperson@yhbt.net]. + +Do not expect Eric Wong to read HTML mail under any circumstances. + +== WARNING! + +This client is only supported in HTTP mode. NFS mode was previously +supported in 1.3.x, but since MogileFS 2.x has dropped support for +NFS, this client has removed support for it. |