AWS services or capabilities described in AWS Documentation may vary by region/location. Click
Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
Class: Seahorse::Client::AsyncResponse
- Inherits:
-
Object
- Object
- Seahorse::Client::AsyncResponse
show all
- Defined in:
- gems/aws-sdk-core/lib/seahorse/client/async_response.rb
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ AsyncResponse
Returns a new instance of AsyncResponse.
7
8
9
10
11
12
13
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 7
def initialize(options = {})
@response = Response.new(context: options[:context])
@stream = options[:stream]
@stream_mutex = options[:stream_mutex]
@close_condition = options[:close_condition]
@sync_queue = options[:sync_queue]
end
|
Instance Method Details
#context ⇒ Object
15
16
17
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 15
def context
@response.context
end
|
#error ⇒ Object
19
20
21
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 19
def error
@response.error
end
|
#join! ⇒ Object
50
51
52
53
54
55
56
57
58
59
60
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 50
def join!
if error && context.config.raise_response_errors
raise error
elsif @stream
@sync_queue << "sync_signal"
@stream.close
@response
end
end
|
#on(range, &block) ⇒ Object
23
24
25
26
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 23
def on(range, &block)
@response.on(range, &block)
self
end
|
#on_complete(&block) ⇒ Object
28
29
30
31
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 28
def on_complete(&block)
@response.on_complete(&block)
self
end
|
#wait ⇒ Object
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
# File 'gems/aws-sdk-core/lib/seahorse/client/async_response.rb', line 33
def wait
if error && context.config.raise_response_errors
raise error
elsif @stream
@sync_queue << "sync_signal"
@stream_mutex.synchronize {
@close_condition.wait(@stream_mutex)
}
@response
end
end
|