File: pool.rbs

package info (click to toggle)
ruby-httpx 1.7.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,816 kB
  • sloc: ruby: 12,209; makefile: 4
file content (51 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
module HTTPX
  type pool_options = {
    max_connections_per_origin: Integer?,
    pool_timeout: Numeric?
  }

  class Pool
    POOL_TIMEOUT: Integer

    type resolver_manager = Resolver::Multi | Resolver::System

    @max_connections: Integer
    @max_connections_per_origin: Integer
    @pool_timeout: Numeric
    @options: Options
    @resolvers: Hash[Class, Array[resolver_manager]]
    @resolver_mtx: Thread::Mutex
    @connections: Array[Connection]
    @connection_mtx: Thread::Mutex
    @connections_counter: Integer
    @max_connections_cond: ConditionVariable
    @origin_counters: Hash[String, Integer]
    @origin_conds: Hash[String, ConditionVariable]

    def pop_connection: () -> Connection?

    def checkout_connection: (http_uri uri, Options options) -> Connection

    def checkin_connection: (Connection connection) -> void

    def checkout_mergeable_connection: (Connection connection) -> Connection?

    def reset_resolvers: () -> void

    def checkout_resolver: (Options options) -> resolver_manager

    def checkin_resolver: (Resolver::Resolver resolver) -> void

    private

    def initialize: (pool_options options) -> void

    def acquire_connection: (http_uri uri, Options options) -> Connection?

    def checkout_new_connection: (http_uri uri, Options options) -> Connection

    def checkout_new_resolver: (Class resolver_type, Options options) -> resolver_manager

    def drop_connection: (?Connection connection) -> Connection?
  end
end