Package haizea :: Package core :: Module manager :: Class PersistenceManager
[hide private]
[frames] | no frames]

Class PersistenceManager

source code


Persistence manager.

The persistence manager is in charge of persisting leases, and some scheduling data, to disk. This allows Haizea to recover from crashes.

Instance Methods [hide private]
 
__init__(self, file)
Constructor
source code
 
persist_lease(self, lease)
Persists a single lease to disk
source code
 
persist_queue(self, queue)
Persists the queue to disk
source code
 
persist_future_leases(self, leases)
Persists the set of future leases
source code
 
get_leases(self)
Returns the leases persisted to disk.
source code
 
get_queue(self)
Returns the queue persisted to disk.
source code
 
get_future_leases(self)
Returns the future leases persisted to disk.
source code
 
close(self)
Closes the persistence manager.
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, file)
(Constructor)

source code 
Constructor

Initializes the persistence manager. If the specified file
does not exist, it is created. If the file is created, it
is opened but the information is not recovered (this is
the responsibility of the Manager class)

Arguments:
file -- Persistence file. If None is specified, then
        persistence is disabled and Haizea will run entirely
        in-memory.

Overrides: object.__init__

persist_lease(self, lease)

source code 

Persists a single lease to disk

Arguments: lease -- Lease to persist

persist_queue(self, queue)

source code 

Persists the queue to disk

Arguments: queue -- The queue

persist_future_leases(self, leases)

source code 

Persists the set of future leases

Arguments: leases -- "Future leases" (as determined by backfilling algorithm)

close(self)

source code 

Closes the persistence manager.

Closing the persistence manager saves any remaining data to disk.