class Webmachine::Trace::PStoreTraceStore
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: @example
Webmachine::Trace.trace_store = :pstore, "/tmp/webmachine.trace"
Public Class Methods
new(path)
click to toggle source
@api private @param [String] path where to store traces in a PStore
# File lib/webmachine/trace/pstore_trace_store.rb, line 13 def initialize(path) @pstore = PStore.new(path) end
Public Instance Methods
[]=(key, trace)
click to toggle source
Records a trace in the store @api private
# File lib/webmachine/trace/pstore_trace_store.rb, line 34 def []=(key, trace) @pstore.transaction { @pstore[key] = trace } end
fetch(key)
click to toggle source
Fetches a trace from the store @api private @param [String] key the trace to fetch @return [Array] a raw trace
# File lib/webmachine/trace/pstore_trace_store.rb, line 28 def fetch(key) @pstore.transaction(true) { @pstore[key] } end
keys()
click to toggle source
Lists the recorded traces @api private @return [Array] a list of recorded traces
# File lib/webmachine/trace/pstore_trace_store.rb, line 20 def keys @pstore.transaction(true) { @pstore.roots } end