Class: Madeleine::Snapshotter
- Inherits:
-
Object
- Object
- Madeleine::Snapshotter
- Defined in:
- lib/madeleine.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(directory_name, marshaller) ⇒ Snapshotter
constructor
A new instance of Snapshotter.
- #take(system) ⇒ Object
Constructor Details
#initialize(directory_name, marshaller) ⇒ Snapshotter
Returns a new instance of Snapshotter.
395 396 397 |
# File 'lib/madeleine.rb', line 395 def initialize(directory_name, marshaller) @directory_name, @marshaller = directory_name, marshaller end |
Instance Method Details
#take(system) ⇒ Object
399 400 401 402 403 404 405 406 407 408 |
# File 'lib/madeleine.rb', line 399 def take(system) numbered_file = SnapshotFile.next(@directory_name) name = numbered_file.name open(name + '.tmp', 'wb') {|snapshot| @marshaller.dump(system, snapshot) snapshot.flush snapshot.fsync } File.rename(name + '.tmp', name) end |