Sha256: a83467e3fb3aefe7bd6d0d39afd33b6c326a2cf5e6e5c9786a4929ab6b57aca2

Contents?: true

Size: 1.62 KB

Versions: 13

Compression:

Stored size: 1.62 KB

Contents

module HTTPX
  module Plugins
    module CircuitBreaker

      class CircuitStore
        @circuits: Hash[String, Circuit]

        def try_open: (generic_uri uri, response response) -> void

        def try_respond: (Request request) -> response?

        private

        def get_circuit_for_uri: (generic_uri uri) -> Circuit

        def initialize: (Options & _CircuitOptions options) -> void
      end

      class Circuit
        @state: :closed | :open | :half_open
        @max_attempts: Integer
        @reset_attempts_in: Float
        @break_in: Float
        @circuit_breaker_half_open_drip_rate: Float
        @attempts: Integer

        @response: response?
        @opened_at: Float?
        @attempted_at: Float?

        def respond: () -> response?

        def try_open: (response) -> void

        def try_close: () -> void

        private

        def initialize: (Integer max_attempts, Float reset_attempts_in, Float break_in, Float circuit_breaker_half_open_drip_rate) -> void
      end

      interface _CircuitOptions
        def circuit_breaker_max_attempts: () -> Integer
        def circuit_breaker_reset_attempts_in: () -> Float
        def circuit_breaker_break_in: () -> Float
        def circuit_breaker_half_open_drip_rate: () -> Float
        def circuit_breaker_break_on: () -> (^(Response) -> boolish | nil)
      end

      def self.load_dependencies: (singleton(Session)) -> void
      def self.extra_options: (Options) -> (Options & _CircuitOptions)

      module InstanceMethods
        @circuit_store: CircuitStore
      end

    end

    type sessionCircuitBreaker = Session & CircuitBreaker::InstanceMethods
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
httpx-0.23.4 sig/plugins/circuit_breaker.rbs
httpx-0.23.3 sig/plugins/circuit_breaker.rbs
httpx-0.23.2 sig/plugins/circuit_breaker.rbs
httpx-0.23.1 sig/plugins/circuit_breaker.rbs
httpx-0.23.0 sig/plugins/circuit_breaker.rbs
httpx-0.22.5 sig/plugins/circuit_breaker.rbs
httpx-0.22.4 sig/plugins/circuit_breaker.rbs
httpx-0.22.3 sig/plugins/circuit_breaker.rbs
httpx-0.22.2 sig/plugins/circuit_breaker.rbs
httpx-0.22.1 sig/plugins/circuit_breaker.rbs
httpx-0.22.0 sig/plugins/circuit_breaker.rbs
httpx-0.21.1 sig/plugins/circuit_breaker.rbs
httpx-0.21.0 sig/plugins/circuit_breaker.rbs