Class: Provenance::Context
- Inherits:
-
Object
- Object
- Provenance::Context
- Defined in:
- lib/provenance/context.rb
Overview
Per-request scratch space backed by fiber-local storage. Holds the active journal, the deferred delivery callback and the request/response metadata for the duration of a single request.
Class Method Summary collapse
- .cleanup ⇒ Object
- .journal ⇒ Object
- .journal=(value) ⇒ Object
- .pending_audit_log ⇒ Object
- .pending_audit_log=(callback) ⇒ Object
- .request_completed? ⇒ Boolean
- .request_id ⇒ Object
- .request_id=(value) ⇒ Object
- .response_status ⇒ Object
- .response_status=(value) ⇒ Object
Class Method Details
.cleanup ⇒ Object
48 49 50 51 52 53 54 55 |
# File 'lib/provenance/context.rb', line 48 def cleanup Thread.current[:provenance_journal] = nil Thread.current[:provenance_pending_log] = nil Thread.current[:provenance_request_id] = nil Thread.current[:provenance_send_scheduled] = nil Thread.current[:provenance_response_status] = nil Thread.current[:provenance_request_completed] = nil end |
.journal ⇒ Object
11 12 13 |
# File 'lib/provenance/context.rb', line 11 def journal Thread.current[:provenance_journal] end |
.journal=(value) ⇒ Object
15 16 17 |
# File 'lib/provenance/context.rb', line 15 def journal=(value) Thread.current[:provenance_journal] = value end |
.pending_audit_log ⇒ Object
19 20 21 |
# File 'lib/provenance/context.rb', line 19 def pending_audit_log Thread.current[:provenance_pending_log] end |
.pending_audit_log=(callback) ⇒ Object
23 24 25 |
# File 'lib/provenance/context.rb', line 23 def pending_audit_log=(callback) Thread.current[:provenance_pending_log] = callback end |
.request_completed? ⇒ Boolean
44 45 46 |
# File 'lib/provenance/context.rb', line 44 def request_completed? Thread.current[:provenance_request_completed] || false end |
.request_id ⇒ Object
27 28 29 |
# File 'lib/provenance/context.rb', line 27 def request_id Thread.current[:provenance_request_id] end |
.request_id=(value) ⇒ Object
31 32 33 |
# File 'lib/provenance/context.rb', line 31 def request_id=(value) Thread.current[:provenance_request_id] = value end |
.response_status ⇒ Object
35 36 37 |
# File 'lib/provenance/context.rb', line 35 def response_status Thread.current[:provenance_response_status] end |
.response_status=(value) ⇒ Object
39 40 41 42 |
# File 'lib/provenance/context.rb', line 39 def response_status=(value) Thread.current[:provenance_response_status] = value Thread.current[:provenance_request_completed] = true end |