Class: Droonga::Command::Remote::AbsorbData
- Defined in:
- lib/droonga/command/remote.rb
Instance Attribute Summary collapse
-
#dataset_name ⇒ Object
writeonly
Sets the attribute dataset_name.
-
#port ⇒ Object
writeonly
Sets the attribute port.
-
#tag ⇒ Object
writeonly
Sets the attribute tag.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Droonga::Command::Remote::Base
Instance Attribute Details
#dataset_name=(value) ⇒ Object
Sets the attribute dataset_name
242 243 244 |
# File 'lib/droonga/command/remote.rb', line 242 def dataset_name=(value) @dataset_name = value end |
#port=(value) ⇒ Object
Sets the attribute port
242 243 244 |
# File 'lib/droonga/command/remote.rb', line 242 def port=(value) @port = value end |
#tag=(value) ⇒ Object
Sets the attribute tag
242 243 244 |
# File 'lib/droonga/command/remote.rb', line 242 def tag=(value) @tag = value end |
Instance Method Details
#process ⇒ Object
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 |
# File 'lib/droonga/command/remote.rb', line 244 def process return unless source log("start to absorb data from #{source}") if dataset_name.nil? or port.nil? or tag.nil? current_catalog = JSON.parse(Path.catalog.read) generator = CatalogGenerator.new generator.load(current_catalog) dataset = generator.dataset_for_host(source) return unless dataset self.dataset_name = dataset.name self.port = dataset.replicas.port self.tag = dataset.replicas.tag end log("dataset = #{dataset_name}") log("port = #{port}") log("tag = #{tag}") status = NodeStatus.new status.set(:absorbing, true) DataAbsorber.absorb(:dataset => dataset_name, :source_host => source, :destination_host => host, :port => port, :tag => tag, :messages_per_second => , :client => "droonga-send") status.delete(:absorbing) end |