Class: Webmachine::Trace::PStoreTraceStore
- Inherits:
-
Object
- Object
- Webmachine::Trace::PStoreTraceStore
- Defined in:
- lib/webmachine/trace/pstore_trace_store.rb
Overview
Implements a trace storage using PStore from Ruby’s standard library. To use this trace store, specify the :pstore engine and a path where it can store traces:
Instance Method Summary collapse
-
#[]=(key, trace) ⇒ Object
private
Records a trace in the store.
-
#fetch(key) ⇒ Array
private
Fetches a trace from the store.
-
#initialize(path) ⇒ PStoreTraceStore
constructor
private
A new instance of PStoreTraceStore.
-
#keys ⇒ Array
private
Lists the recorded traces.
Constructor Details
#initialize(path) ⇒ PStoreTraceStore
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of PStoreTraceStore.
13 14 15 |
# File 'lib/webmachine/trace/pstore_trace_store.rb', line 13 def initialize(path) @pstore = PStore.new(path) end |
Instance Method Details
#[]=(key, trace) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Records a trace in the store
34 35 36 |
# File 'lib/webmachine/trace/pstore_trace_store.rb', line 34 def []=(key, trace) @pstore.transaction { @pstore[key] = trace } end |
#fetch(key) ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Fetches a trace from the store
28 29 30 |
# File 'lib/webmachine/trace/pstore_trace_store.rb', line 28 def fetch(key) @pstore.transaction(true) { @pstore[key] } end |
#keys ⇒ Array
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Lists the recorded traces
20 21 22 |
# File 'lib/webmachine/trace/pstore_trace_store.rb', line 20 def keys @pstore.transaction(true) { @pstore.roots } end |