Class: Droonga::Serf::RemoteCommand::Base
- Inherits:
-
Object
- Object
- Droonga::Serf::RemoteCommand::Base
- Defined in:
- lib/droonga/serf/remote_command.rb
Direct Known Subclasses
AcceptMessagesNewerThan, ChangeRole, CrossNodeCommandBase, ModifyReplicasBase, ReportLastMessageTimestamp, UpdateClusterState
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(serf_name, params) ⇒ Base
constructor
A new instance of Base.
-
#log(message) ⇒ Object
-
#process ⇒ Object
-
#should_process? ⇒ Boolean
Constructor Details
#initialize(serf_name, params) ⇒ Base
Returns a new instance of Base.
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/droonga/serf/remote_command.rb', line 34 def initialize(serf_name, params) @serf_name = serf_name @params = params @response = { "log" => [] } @serf = Serf.new(@serf_name) @service_installation = ServiceInstallation.new @service_installation.ensure_using_service_base_directory log("params = #{params}") end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
32 33 34 |
# File 'lib/droonga/serf/remote_command.rb', line 32 def response @response end |
Instance Method Details
#log(message) ⇒ Object
75 76 77 |
# File 'lib/droonga/serf/remote_command.rb', line 75 def log() @response["log"] << end |
#process ⇒ Object
48 49 50 |
# File 'lib/droonga/serf/remote_command.rb', line 48 def process # override me! end |
#should_process? ⇒ Boolean
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/droonga/serf/remote_command.rb', line 52 def should_process? if @params.nil? log("anonymous query (to be processed)") return true end unless for_this_cluster? log("query for different cluster (mine: #{cluster_id}, to be ignroed)") return false end unless @params.include?("node") log("anonymous node query (to be processed)") return true end unless for_me? log("query for different node (me: #{@serf_name}, to be ignored)") return false end log("query for this node (to be processed)") true end |