Class: Igniter::Store::HTTPAdapter::StatusHandler

Inherits:
Object
  • Object
show all
Includes:
ResponseHelper
Defined in:
lib/igniter/store/http_adapter.rb

Overview

Returns the canonical observability snapshot at GET /v1/status. When status_provider is given (e.g. StoreServer#observability_snapshot), it is called to produce the full server+storage shape. Otherwise falls back to the interpreter’s storage-level snapshot.

Instance Method Summary collapse

Constructor Details

#initialize(interpreter:, status_provider: nil) ⇒ StatusHandler

Returns a new instance of StatusHandler.



90
91
92
93
# File 'lib/igniter/store/http_adapter.rb', line 90

def initialize(interpreter:, status_provider: nil)
  @interpreter     = interpreter
  @status_provider = status_provider
end

Instance Method Details

#call(env) ⇒ Object



95
96
97
98
99
100
# File 'lib/igniter/store/http_adapter.rb', line 95

def call(env)
  return method_not_allowed unless env["REQUEST_METHOD"] == "GET"

  data = @status_provider ? @status_provider.call : @interpreter.observability_snapshot
  json_response(200, data)
end