Class: Google::Cloud::Debugger::Transmitter

Inherits:
Object
  • Object
show all
Defined in:
lib/google/cloud/debugger/transmitter.rb

Overview

Transmitter

Responsible for submit evaluated breakpoints back to Stackdriver Debugger service asynchronously. It has it's own dedicated child thread, so it doesn't interfere with main Ruby application threads or the debugger agent's thread.

The transmitter is controlled by the debugger agent it belongs to. Debugger agent submits evaluated breakpoint into a thread safe queue, and the transmitter operates directly on the queue along with minimal interaction with the rest debugger agent components

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#agentGoogle::Cloud::Debugger::Agent

The debugger agent this transmiter belongs to



48
49
50
# File 'lib/google/cloud/debugger/transmitter.rb', line 48

def agent
  @agent
end

#max_queue_sizeObject

Maxium backlog size for this transmitter's queue



52
53
54
# File 'lib/google/cloud/debugger/transmitter.rb', line 52

def max_queue_size
  @max_queue_size
end

Instance Method Details

#startObject

Starts the transmitter and its worker thread



66
67
68
# File 'lib/google/cloud/debugger/transmitter.rb', line 66

def start
  async_start
end

#stopObject

Stops the transmitter and its worker thread. Once stopped, cannot be started again.



73
74
75
# File 'lib/google/cloud/debugger/transmitter.rb', line 73

def stop
  async_stop
end

#submit(breakpoint) ⇒ Object

Enqueue an evaluated breakpoints to be submitted by the transmitter.

Parameters:



82
83
84
85
86
87
88
89
# File 'lib/google/cloud/debugger/transmitter.rb', line 82

def submit breakpoint
  synchronize do
    @queue.push breakpoint
    @lock_cond.broadcast
    # Discard old entries if queue gets too large
    @queue.pop while @queue.size > @max_queue_size
  end
end