Class: Roma::Command::Receiver

Inherits:
Event::Handler
  • Object
show all
Includes:
BackgroundCommandReceiver, MultiHashCommandReceiver, RoutingCommandReceiver, SystemCommandReceiver, UtilCommandReceiver
Defined in:
lib/roma/command/receiver.rb

Instance Attribute Summary

Attributes inherited from Event::Handler

#addr, #connected, #last_access, #lastcmd, #port

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SystemCommandReceiver

#ev_add_latency_avg_calc_cmd, #ev_balse, #ev_chg_latency_avg_calc_time_count, #ev_dcnice, #ev_del_latency_avg_calc_cmd, #ev_forcedly_start, #ev_out, #ev_quit, #ev_radd_latency_avg_calc_cmd, #ev_rbalse, #ev_rchg_latency_avg_calc_time_count, #ev_rdcnice, #ev_rdel_latency_avg_calc_cmd, #ev_restart, #ev_rrestart, #ev_rset, #ev_rset_accepted_connection_expire_time, #ev_rset_connection_pool_expire_time, #ev_rset_connection_pool_maxlength, #ev_rset_continuous_limit, #ev_rset_descriptor_table_size, #ev_rset_emconnection_pool_expire_time, #ev_rset_emconnection_pool_maxlength, #ev_rset_gui_last_snapshot, #ev_rset_hilatency_warn_time, #ev_rset_latency_avg_calc_rule, #ev_rset_log_shift_age, #ev_rset_log_shift_size, #ev_rset_reqpushv_timeout_count, #ev_rset_routing_trans_timeout, #ev_rset_spushv_klength_warn, #ev_rset_spushv_read_timeout, #ev_rset_spushv_vlength_warn, #ev_rset_wb_shift_size, #ev_rshutdown, #ev_rswitch_dns_caching, #ev_rswitch_failover, #ev_rwb_command_map, #ev_rwritebehind_get_current_file, #ev_rwritebehind_get_path, #ev_rwritebehind_rotate, #ev_rzset, #ev_set_accepted_connection_expire_time, #ev_set_cleanup_regexp, #ev_set_connection_pool_expire_time, #ev_set_connection_pool_maxlength, #ev_set_continuous_limit, #ev_set_descriptor_table_size, #ev_set_emconnection_pool_expire_time, #ev_set_emconnection_pool_maxlength, #ev_set_gui_last_snapshot, #ev_set_gui_run_snapshot, #ev_set_hilatency_warn_time, #ev_set_latency_avg_calc_rule, #ev_set_log_level, #ev_set_log_shift_age, #ev_set_log_shift_size, #ev_set_reqpushv_timeout_count, #ev_set_routing_trans_timeout, #ev_set_spushv_klength_warn, #ev_set_spushv_read_timeout, #ev_set_spushv_vlength_warn, #ev_set_storage_status, #ev_set_wb_shift_size, #ev_shutdown, #ev_shutdown_self, #ev_stat, #ev_stats, #ev_switch_dns_caching, #ev_switch_failover, #ev_version, #ev_wb_command_map, #ev_whoami, #ev_writebehind_get_current_file, #ev_writebehind_get_path, #ev_writebehind_rotate

Methods included from MultiHashCommandReceiver

#ev_hashlist

Methods included from Definition

#forward_and_multi_line_receive, #forward_and_one_line_receive, included

Methods included from UtilCommandReceiver

#async_broadcast_cmd, #async_send_cmd, #broadcast_cmd, #chg_time_expt, #send_cmd

Methods included from RoutingCommandReceiver

#ev_add_rttable_sub_nid, #ev_clear_rttable_sub_nid, #ev_create_nodes_from_v_idx, #ev_delete_rttable_sub_nid, #ev_enabled_repetition_in_routing?, #ev_get_key_info, #ev_getroute, #ev_history_of_lost, #ev_join, #ev_leave, #ev_mklhash, #ev_nodelist, #ev_radd_rttable_sub_nid, #ev_rclear_rttable_sub_nid, #ev_rdelete_rttable_sub_nid, #ev_routingdump, #ev_rset_auto_recover, #ev_rset_gap_for_failover, #ev_rset_lost_action, #ev_rset_threshold_for_failover, #ev_set_auto_recover, #ev_set_gap_for_failover, #ev_set_lost_action, #ev_set_threshold_for_failover, #ev_setroute

Methods included from BackgroundCommandReceiver

#ev_balance, #ev_rbalance, #ev_recover, #ev_release, #ev_rrecover

Methods included from VnodeCommandReceiver

#ev_reqpushv, #ev_spushv, #ev_spushv_protection, #req_push_a_vnode

Methods inherited from Event::Handler

connection_expire_time, connection_expire_time=, connections, ev_list, get_ccl, #post_init, #receive_data, set_ccl, system_commands, timeout, timeout=, #unbind

Constructor Details

#initialize(storages, rttable) ⇒ Receiver

Returns a new instance of Receiver.



22
23
24
25
26
27
# File 'lib/roma/command/receiver.rb', line 22

def initialize(storages, rttable)
  super(storages, rttable)
  @stats = Roma::Stats.instance
  @nid = @stats.ap_str
  @defhash = 'roma'
end

Class Method Details

.each_system_commandsObject



37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/roma/command/receiver.rb', line 37

def self.each_system_commands
  methods = RoutingCommandReceiver::public_instance_methods
  methods << BackgroundCommandReceiver::public_instance_methods
  methods << SystemCommandReceiver::public_instance_methods

  if Receiver::public_instance_methods.include?(:ev_eval)
    methods << :ev_eval
  end
  methods.flatten.each{|m|
     yield m if m.to_s.start_with?('ev_')
  }
end

.mk_evlistObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/roma/command/receiver.rb', line 50

def self.mk_evlist
  each_system_commands{|m|
    Event::Handler.system_commands[m.to_s[3..-1]] = nil
  }
  Receiver::public_instance_methods.each{|m|
    if m.to_s.start_with?('ev_')
      Event::Handler.ev_list[m.to_s[3..-1]] = m
    end
  }
end

.mk_starting_evlistObject



29
30
31
32
33
34
35
# File 'lib/roma/command/receiver.rb', line 29

def self.mk_starting_evlist
  Event::Handler.ev_list.clear
  each_system_commands{|m|
    Event::Handler.ev_list[m.to_s[3..-1]] = m
    Event::Handler.system_commands[m.to_s[3..-1]] = nil
  }
end