Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require 'riak'
- @host = ARGV[0]
- @port = ARGV[1].to_i
- @bucket = ARGV[2]
- @dir = ARGV[3]
- @riak_client = Riak::Client.new(:host => @host, :http_port => @port)
- @riak_bucket = @riak_client.bucket(@bucket)
- Dir.glob(@dir + '/*.json') do |file_path|
- json = File.read(file_path)
- w_props = {
- :w => 0,
- :dw => 0,
- :returnbody => false
- }
- o = @riak_bucket.new(File.basename(file_path, ".json"))
- o.data = json
- o.content_type = 'application/json'
- o.store(w_props)
- end
Add Comment
Please, Sign In to add comment