Class: ProconBypassMan::RemoteAction::QueueOverProcess

Inherits:
Object
  • Object
show all
Extended by:
CanOverProcess
Includes:
Singleton
Defined in:
lib/procon_bypass_man/remote_action/queue_over_process.rb

Constant Summary

Constants included from CanOverProcess

CanOverProcess::PROTOCOL

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CanOverProcess

distributed_class, enable?, extended, shutdown_distributed_object, socket_file_path, socket_path, start_distributed_object!

Constructor Details

#initializeQueueOverProcess

Returns a new instance of QueueOverProcess.



41
42
43
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 41

def initialize
  @distributed_queue = DRbObject.new_with_uri(self.class.socket_path)
end

Instance Attribute Details

#distributed_queueObject (readonly)

Returns the value of attribute distributed_queue.



6
7
8
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 6

def distributed_queue
  @distributed_queue
end

Class Method Details

.clearObject



35
36
37
38
39
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 35

def self.clear
  return unless enable?

  instance.distributed_queue.clear
end

.distributed_classObject



14
15
16
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 14

def self.distributed_class
  Queue
end

.enable?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 9

def self.enable?
  ProconBypassMan.config.enable_remote_action?
end

.popObject



29
30
31
32
33
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 29

def self.pop
  return unless enable?

  instance.distributed_queue.pop
end

.push(value) ⇒ Object



23
24
25
26
27
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 23

def self.push(value)
  return unless enable?

  instance.distributed_queue.push(value)
end

.socket_file_pathObject



19
20
21
# File 'lib/procon_bypass_man/remote_action/queue_over_process.rb', line 19

def self.socket_file_path
  "/tmp/procon_bypass_man_remote_macro_queue".freeze
end