Class: Hook0::Options
- Inherits:
-
Object
- Object
- Hook0::Options
- Defined in:
- lib/hook0/client.rb
Overview
Every bound a client applies to one send.
Constant Summary collapse
- DEFAULT_MAX_PAYLOAD_BYTES =
Largest event payload the client agrees to send, in bytes.
Hook0's API refuses request bodies above 2 MiB, so a payload above 1 MiB is already at risk of being refused once the JSON envelope around it — metadata, labels, identifiers — is counted. The client rules such an event out rather than spending a round trip, and every retry after it, on a request that cannot be accepted.
1024 * 1024
Instance Attribute Summary collapse
-
#max_head_bytes ⇒ Integer
readonly
The largest whole head, every line counted together.
-
#max_header_bytes ⇒ Integer
readonly
The longest one header line may be.
-
#max_payload_bytes ⇒ Integer
readonly
The largest payload sent, refused before a socket is opened.
-
#max_response_bytes ⇒ Integer
readonly
The largest answer read off a socket.
-
#max_response_headers ⇒ Integer
readonly
How many header lines an answer may carry.
-
#request_timeout ⇒ Float
readonly
How long one attempt is given, in seconds.
-
#retry_policy ⇒ RetryPolicy
readonly
How the attempts of one send are spaced out.
Instance Method Summary collapse
Constructor Details
#initialize(retry_policy: RetryPolicy.new, request_timeout: Transport::DEFAULT_REQUEST_TIMEOUT, max_payload_bytes: DEFAULT_MAX_PAYLOAD_BYTES, max_response_bytes: Transport::DEFAULT_MAX_RESPONSE_BYTES, max_response_headers: Transport::DEFAULT_MAX_RESPONSE_HEADERS, max_header_bytes: Transport::DEFAULT_MAX_HEADER_BYTES, max_head_bytes: Transport::DEFAULT_MAX_HEAD_BYTES) ⇒ Options
Returns a new instance of Options.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
# File 'lib/hook0/client.rb', line 222 def initialize( retry_policy: RetryPolicy.new, request_timeout: Transport::DEFAULT_REQUEST_TIMEOUT, max_payload_bytes: DEFAULT_MAX_PAYLOAD_BYTES, max_response_bytes: Transport::DEFAULT_MAX_RESPONSE_BYTES, max_response_headers: Transport::DEFAULT_MAX_RESPONSE_HEADERS, max_header_bytes: Transport::DEFAULT_MAX_HEADER_BYTES, max_head_bytes: Transport::DEFAULT_MAX_HEAD_BYTES ) @retry_policy = retry_policy @request_timeout = request_timeout @max_payload_bytes = max_payload_bytes @max_response_bytes = max_response_bytes @max_response_headers = max_response_headers @max_header_bytes = max_header_bytes @max_head_bytes = max_head_bytes freeze end |
Instance Attribute Details
#max_head_bytes ⇒ Integer (readonly)
Returns the largest whole head, every line counted together.
213 214 215 |
# File 'lib/hook0/client.rb', line 213 def max_head_bytes @max_head_bytes end |
#max_header_bytes ⇒ Integer (readonly)
Returns the longest one header line may be.
210 211 212 |
# File 'lib/hook0/client.rb', line 210 def max_header_bytes @max_header_bytes end |
#max_payload_bytes ⇒ Integer (readonly)
Returns the largest payload sent, refused before a socket is opened.
201 202 203 |
# File 'lib/hook0/client.rb', line 201 def max_payload_bytes @max_payload_bytes end |
#max_response_bytes ⇒ Integer (readonly)
Returns the largest answer read off a socket.
204 205 206 |
# File 'lib/hook0/client.rb', line 204 def max_response_bytes @max_response_bytes end |
#max_response_headers ⇒ Integer (readonly)
Returns how many header lines an answer may carry.
207 208 209 |
# File 'lib/hook0/client.rb', line 207 def max_response_headers @max_response_headers end |
#request_timeout ⇒ Float (readonly)
Returns how long one attempt is given, in seconds.
198 199 200 |
# File 'lib/hook0/client.rb', line 198 def request_timeout @request_timeout end |
#retry_policy ⇒ RetryPolicy (readonly)
Returns how the attempts of one send are spaced out.
195 196 197 |
# File 'lib/hook0/client.rb', line 195 def retry_policy @retry_policy end |