Class: Pgoutput::Client::RunnerState

Inherits:
RunnerStateData show all
Defined in:
lib/pgoutput/client/state.rb

Overview

Immutable operational snapshot for a Runner.

‘RunnerState` is intentionally small and transport-focused. It exposes connection, feedback, keepalive, and retry state without claiming anything about downstream processing, sink delivery, or business-level consumption.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#connectedBoolean (readonly)

whether an active replication stream exists

Returns:

  • (Boolean)

    the current value of connected



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def connected
  @connected
end

#last_errorString? (readonly)

last transport error message

Returns:

  • (String, nil)

    the current value of last_error



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def last_error
  @last_error
end

#last_feedback_lsnString? (readonly)

latest downstream-acknowledged WAL position used for flushed/applied feedback

Returns:

  • (String, nil)

    the current value of last_feedback_lsn



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def last_feedback_lsn
  @last_feedback_lsn
end

#last_keepalive_atTime? (readonly)

last time a primary keepalive was observed

Returns:

  • (Time, nil)

    the current value of last_keepalive_at



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def last_keepalive_at
  @last_keepalive_at
end

#last_received_lsnString? (readonly)

latest WAL position received from PostgreSQL

Returns:

  • (String, nil)

    the current value of last_received_lsn



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def last_received_lsn
  @last_received_lsn
end

#reconnect_attemptsInteger (readonly)

reconnect attempts used by the current/last run

Returns:

  • (Integer)

    the current value of reconnect_attempts



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def reconnect_attempts
  @reconnect_attempts
end

#runningBoolean (readonly)

whether the runner is inside its streaming loop

Returns:

  • (Boolean)

    the current value of running



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def running
  @running
end

#stop_requestedBoolean (readonly)

whether graceful stop was requested

Returns:

  • (Boolean)

    the current value of stop_requested



32
33
34
# File 'lib/pgoutput/client/state.rb', line 32

def stop_requested
  @stop_requested
end

Instance Method Details

#stopped?Boolean

Whether the runner currently has no active stream.

Returns:

  • (Boolean)


36
37
38
# File 'lib/pgoutput/client/state.rb', line 36

def stopped?
  !running
end