Module: Seaweed

Defined in:
lib/seaweed.rb

Defined Under Namespace

Classes: File, HTTP, Master

Class Method Summary collapse

Class Method Details

.connect(host: "localhost", port: 9333, http_options: {}) ⇒ Object



3
4
5
6
# File 'lib/seaweed.rb', line 3

def self.connect(host: "localhost", port: 9333, http_options: {})
  Seaweed::HTTP.configure http_options
  Seaweed::Master.connect host: host, port: port
end

.find(fid, http_options: nil) ⇒ Object



18
19
20
21
# File 'lib/seaweed.rb', line 18

def self.find(fid, http_options: nil)
  location = Seaweed::Master.dir_lookup fid.split(",")[0]
  Seaweed::File.new fid, volume_url: location[:url]
end

.statusObject



8
9
10
# File 'lib/seaweed.rb', line 8

def self.status
  Seaweed::Master.status
end

.upload(path) ⇒ Object



12
13
14
15
16
# File 'lib/seaweed.rb', line 12

def self.upload(path)
  location = Seaweed::Master.dir_assign!
  file = Seaweed::File.new location[:fid], volume_url: location[:url], attachment: path
  file.upload!
end