MadeleineServer (Class)

In: libraries/madeleine_service.rb
Parent: Object

Methods

Constants

SNAPSHOT_INTERVAL = 30 * 60 * 24
AUTOMATIC_SNAPSHOTS = true

Public Class methods

Clears all the command_log and snapshot files located in the storage directory, so the database is essentially dropped and recreated as blank. Used in tests.

[Source]

    # File libraries/madeleine_service.rb, line 39
39:   def self.clean_storage(service)
40:     require 'fileutils'
41:     if (File.directory?(service.storage_path))
42:       FileUtils.rm_rf(Dir[service.storage_path + '/*.command_log'])
43:       FileUtils.rm_rf(Dir[service.storage_path + '/*.snapshot'])
44:     else
45:       FileUtils.mkdir_p(service.storage_path)
46:     end
47:   end

[Source]

    # File libraries/madeleine_service.rb, line 49
49:   def initialize(service)
50:     marshaller = Madeleine::ZMarshal.new()
51:     @server = Madeleine::Automatic::AutomaticSnapshotMadeleine.new(service.storage_path, 
52:         marshaller) { service.new }
53:     start_snapshot_thread if AUTOMATIC_SNAPSHOTS
54:   end

Public Instance methods

[Source]

    # File libraries/madeleine_service.rb, line 60
60:   def start_snapshot_thread
61:     Thread.new(@server) {
62:       while true
63:         sleep(SNAPSHOT_INTERVAL)
64:         @server.take_snapshot
65:       end
66:     }
67:   end

[Source]

    # File libraries/madeleine_service.rb, line 56
56:   def system
57:     @server.system
58:   end

[Validate]