Class: Seaweed::Master

Inherits:
Object
  • Object
show all
Defined in:
lib/seaweed/master.rb

Class Method Summary collapse

Class Method Details

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



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

def connect(host: "localhost", port: 9333)
  @base_url = "http://#{host}:#{port}"
end

.dir_assign!Object



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

def dir_assign!
  res = Seaweed::HTTP.post "#{@base_url}/dir/assign", {}
  Seaweed::HTTP.parse res
end

.dir_lookup(volume_id) ⇒ Object



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

def dir_lookup(volume_id)
  res = Seaweed::HTTP.get "#{@base_url}/dir/lookup?volumeId=#{volume_id}"
  Seaweed::HTTP.parse(res)[:locations][0]
end

.statusObject



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

def status
  res = Seaweed::HTTP.get "#{@base_url}/cluster/status?pretty=y"
  Seaweed::HTTP.parse res
end

.vaccum!(threshold: 0.3) ⇒ Object



23
24
25
26
# File 'lib/seaweed/master.rb', line 23

def vaccum!(threshold: 0.3)
  res = Seaweed::HTTP.get "#{@base_url}/vol/vaccum?garbageThreshold=#{threshold}"
  Seaweed::HTTP.parse res
end