Class: ActiveHarness::Memory::Adapter::Base
- Inherits:
-
Object
- Object
- ActiveHarness::Memory::Adapter::Base
- Defined in:
- lib/active_harness/memory/adapter/base.rb
Overview
Contract that every adapter must implement. Subclasses override these four methods.
Direct Known Subclasses
Instance Method Summary collapse
-
#close ⇒ Object
Flush buffers and release resources.
-
#delete ⇒ Object
Remove all data for the current session from the backend.
-
#open(session_id) ⇒ Object
Load turns for the given session from the storage backend.
-
#read ⇒ Object
Return a plain Array of turn hashes.
-
#write(turn) ⇒ Object
Persist a single turn hash.
Instance Method Details
#close ⇒ Object
Flush buffers and release resources.
25 26 27 |
# File 'lib/active_harness/memory/adapter/base.rb', line 25 def close raise NotImplementedError, "#{self.class}#close not implemented" end |
#delete ⇒ Object
Remove all data for the current session from the backend.
30 31 32 |
# File 'lib/active_harness/memory/adapter/base.rb', line 30 def delete raise NotImplementedError, "#{self.class}#delete not implemented" end |
#open(session_id) ⇒ Object
Load turns for the given session from the storage backend. Must be called before read/write.
9 10 11 |
# File 'lib/active_harness/memory/adapter/base.rb', line 9 def open(session_id) raise NotImplementedError, "#{self.class}#open not implemented" end |
#read ⇒ Object
Return a plain Array of turn hashes. Each turn has at minimum: { request:, response: }
15 16 17 |
# File 'lib/active_harness/memory/adapter/base.rb', line 15 def read raise NotImplementedError, "#{self.class}#read not implemented" end |
#write(turn) ⇒ Object
Persist a single turn hash.
20 21 22 |
# File 'lib/active_harness/memory/adapter/base.rb', line 20 def write(turn) raise NotImplementedError, "#{self.class}#write not implemented" end |