Module: Pokan::Cluster::ClassMethods
- Defined in:
- lib/pokan-cluster.rb
Instance Attribute Summary collapse
-
#address ⇒ Object
Returns the value of attribute address.
-
#epoll ⇒ Object
(also: #epoll?)
Returns the value of attribute epoll.
-
#gossip_interval ⇒ Object
Returns the value of attribute gossip_interval.
-
#log_file ⇒ Object
Returns the value of attribute log_file.
-
#log_level ⇒ Object
Returns the value of attribute log_level.
-
#logging ⇒ Object
(also: #logging?)
Returns the value of attribute logging.
-
#seed ⇒ Object
Returns the value of attribute seed.
-
#shares ⇒ Object
Returns the value of attribute shares.
-
#tcp_port ⇒ Object
Returns the value of attribute tcp_port.
-
#udp_port ⇒ Object
Returns the value of attribute udp_port.
Instance Method Summary collapse
-
#config(&block) ⇒ Object
Loads the server configuration, expecting a valid config hash in a block.
-
#config_file(path, options = {}) ⇒ Object
Convenience method, allowing the user to set the file containing the configuration in the YAML format.
-
#disable_log ⇒ Object
Disables log for the gossip server.
-
#gossip_with(address, options) ⇒ Object
Sets the seed address and redis port, if specified.
- #method_missing(meth, *args, &block) ⇒ Object
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
128 129 130 |
# File 'lib/pokan-cluster.rb', line 128 def method_missing(meth, *args, &block) @delegator.send(meth, *args, &block) end |
Instance Attribute Details
#address ⇒ Object
Returns the value of attribute address.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def address @address end |
#epoll ⇒ Object Also known as: epoll?
Returns the value of attribute epoll.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def epoll @epoll end |
#gossip_interval ⇒ Object
Returns the value of attribute gossip_interval.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def gossip_interval @gossip_interval end |
#log_file ⇒ Object
Returns the value of attribute log_file.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def log_file @log_file end |
#log_level ⇒ Object
Returns the value of attribute log_level.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def log_level @log_level end |
#logging ⇒ Object Also known as: logging?
Returns the value of attribute logging.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def logging @logging end |
#seed ⇒ Object
Returns the value of attribute seed.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def seed @seed end |
#shares ⇒ Object
Returns the value of attribute shares.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def shares @shares end |
#tcp_port ⇒ Object
Returns the value of attribute tcp_port.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def tcp_port @tcp_port end |
#udp_port ⇒ Object
Returns the value of attribute udp_port.
84 85 86 |
# File 'lib/pokan-cluster.rb', line 84 def udp_port @udp_port end |
Instance Method Details
#config(&block) ⇒ Object
Loads the server configuration, expecting a valid config hash in a block. This allows you to use whatever configuration format, as long as you can transform it to a valid pokan hash.
94 95 96 97 98 99 |
# File 'lib/pokan-cluster.rb', line 94 def config(&block) @server || load!(block.call) initialize_log store_hwinfo delegate end |
#config_file(path, options = {}) ⇒ Object
Convenience method, allowing the user to set the file containing the configuration in the YAML format. In the future, maybe add builtin support for other different formats.
104 105 106 |
# File 'lib/pokan-cluster.rb', line 104 def config_file(path, ={}) config { YAML.load(File.read path) } end |
#disable_log ⇒ Object
Disables log for the gossip server
109 110 111 |
# File 'lib/pokan-cluster.rb', line 109 def disable_log @logging = false end |
#gossip_with(address, options) ⇒ Object
123 124 125 126 |
# File 'lib/pokan-cluster.rb', line 123 def gossip_with(address, ) update_autorunner_option(:gossip_with, address) update_autorunner_option(:redis, [:redis] || DEFAULTS[:redis]) end |