Class: ForestAdminAgent::AuditTrail::Capture
- Inherits:
-
Object
- Object
- ForestAdminAgent::AuditTrail::Capture
- Includes:
- Recording
- Defined in:
- lib/forest_admin_agent/audit_trail/capture.rb
Overview
Datasource-agnostic capture layer, installed by the agent factory as soon as an audit-trail database is configured. It instruments every collection through the Forest customizer hooks, so it behaves the same whatever the audited datasource is (ActiveRecord, Mongoid, ...).
Every operation is recorded twice: a PENDING row before the write, confirmed DONE after it. One code
path in both critical modes, so status always means the same thing — and what the protocol buys is
that no write goes unaudited, not that every row holds exact after-values. A row left pending says the
write may or may not have landed, which is evidence rather than a defect.
Constant Summary
Constants included from Recording
Recording::DONE, Recording::IDENTITY, Recording::PENDING, Recording::REDACTED
Instance Method Summary collapse
-
#run(datasource_customizer, _collection_customizer = nil, options = {}) ⇒ Object
Signature imposed by DatasourceCustomizer#use; the agent always instruments the whole datasource.
Methods included from Recording
#audit_safely, #correlation_key_for, #identity_of, #now, #redact
Instance Method Details
#run(datasource_customizer, _collection_customizer = nil, options = {}) ⇒ Object
Signature imposed by DatasourceCustomizer#use; the agent always instruments the whole datasource.
15 16 17 18 19 20 21 |
# File 'lib/forest_admin_agent/audit_trail/capture.rb', line 15 def run(datasource_customizer, _collection_customizer = nil, = {}) @store = [:store] @redact = [:redact] || {} @snapshots = Snapshots.new datasource_customizer.collections.each_value { |collection| instrument(collection) } end |