This module contains classes that can resume a dormant session from a binary representation. See docs for the suspend module for details.
The resume logic provides a compromise between usefulness and correctness so two assumptions are made:
We assume that a checksum of a job changes when their behavior changes. This way we can detect when job definitions were updated after suspending but before resuming.
We assume that software and hardware may change while the session is suspended but this is not something that framework (PlainBox) is concerned with. Applications should provide job definitions that are capable of detecting this and acting appropriately.
This is true since the user may install additional packages or upgrade existing packages. The user can also add or remove pluggable hardware. Lastly actual machine suspend (or hibernate) and resume may cause alterations to the hardware as it is visible from within the system. In any case the framework does not care about this.
Bases: plainbox.impl.session.resume.SessionResumeError
Exception raised when SessionResumeHelper detects that a file needed by the session to resume is not present. This is typically used to signal inaccessible log files.
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Bases: plainbox.impl.session.resume.SessionResumeError
Exception raised when SessionResumeHelper cannot decode the session byte stream. This exception will be raised with additional context that captures the actual underlying cause. Having this exception class makes it easier to handle resume errors.
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Bases: builtins.object
A mix-in class capable of unpacking the envelope of the session storage
Unpack the binary envelope and get access to a JSON object
Parameters: | data – Bytes representing the dormant session |
---|---|
Returns: | the JSON representation of a session stored in the envelope |
Raises CorruptedSessionError: | |
if the representation of the session is corrupted in any way |
Bases: plainbox.impl.session.resume.SessionResumeError
Exception raised when SessionResumeHelper detects that the set of jobs it knows about is incompatible with what was saved before.
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Bases: plainbox.impl.session.resume.SessionResumeError
Exception raised when SessionResumeHelper comes across malformed or unsupported data that was (presumably) produced by SessionSuspendHelper
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Bases: plainbox.impl.secure.qualifiers.SimpleQualifier
A job qualifier that designates jobs that should be removed after doing a session resume.
Return a list of primitives that constitute this qualifier.
Returns: | A list of IJobQualifier objects that each is the smallest, indivisible entity. Here it just returns a list of one element, itself. |
---|
Get one of the VOTE_IGNORE, VOTE_INCLUDE, VOTE_EXCLUDE votes that this qualifier associated with the specified job.
Parameters: | job – A IJobDefinition instance that is to be visited |
---|---|
Returns: |
|
Origin of this qualifier
This property can be used to trace the origin of a qualifier back to its definition point.
Bases: plainbox.impl.session.resume.EnvelopeUnpackMixIn
Peek at the meta-data of a dormant session.
Parameters: | data – Bytes representing the dormant session |
---|---|
Returns: | a SessionMetaData object |
Raises: |
|
Unpack the binary envelope and get access to a JSON object
Parameters: | data – Bytes representing the dormant session |
---|---|
Returns: | the JSON representation of a session stored in the envelope |
Raises CorruptedSessionError: | |
if the representation of the session is corrupted in any way |
Bases: plainbox.impl.session.resume.MetaDataHelper1MixIn
Helper class for implementing session peek feature
This class works with data constructed by SessionSuspendHelper1 which has been pre-processed by SessionPeekHelper (to strip the initial envelope).
The only goal of this class is to reconstruct session state meta-data.
Bases: plainbox.impl.session.resume.MetaDataHelper2MixIn, plainbox.impl.session.resume.SessionPeekHelper1
Helper class for implementing session peek feature
This class works with data constructed by SessionSuspendHelper1 which has been pre-processed by SessionPeekHelper (to strip the initial envelope).
The only goal of this class is to reconstruct session state meta-data.
Resume a SessionState object from the JSON representation.
This method is called by peek() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: plainbox.impl.session.resume.MetaDataHelper3MixIn, plainbox.impl.session.resume.SessionPeekHelper2
Helper class for implementing session peek feature
This class works with data constructed by SessionSuspendHelper1 which has been pre-processed by SessionPeekHelper (to strip the initial envelope).
The only goal of this class is to reconstruct session state meta-data.
Resume a SessionState object from the JSON representation.
This method is called by peek() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: plainbox.impl.session.resume.SessionPeekHelper3
Helper class for implementing session peek feature
This class works with data constructed by SessionSuspendHelper1 which has been pre-processed by SessionPeekHelper (to strip the initial envelope).
The only goal of this class is to reconstruct session state meta-data.
Resume a SessionState object from the JSON representation.
This method is called by peek() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: builtins.Exception
Base class for exceptions that can be raised when attempting to resume a dormant session.
Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.
Bases: plainbox.impl.session.resume.EnvelopeUnpackMixIn
Helper class for implementing session resume feature.
This class is a facade that does enough of the resume process to know which version is being resumed and delegate the rest of the process to an appropriate, format specific, resume class.
Resume a dormant session.
Parameters: |
|
---|---|
Returns: | resumed session instance |
Return type: |
This method validates the representation of a dormant session and re-creates an identical SessionState instance. It can fail in multiple ways, some of which are a part of normal operation and should always be handled (IncompatibleJobError and IncompatibleJobError). Applications may wish to capture SessionResumeError as a generic base exception for all the possible problems.
Raises: |
|
---|
Unpack the binary envelope and get access to a JSON object
Parameters: | data – Bytes representing the dormant session |
---|---|
Returns: | the JSON representation of a session stored in the envelope |
Raises CorruptedSessionError: | |
if the representation of the session is corrupted in any way |
Bases: plainbox.impl.session.resume.MetaDataHelper1MixIn
Helper class for implementing session resume feature
This class works with data constructed by SessionSuspendHelper1 which has been pre-processed by SessionResumeHelper (to strip the initial envelope).
Due to the constraints of what can be represented in a suspended session, this class cannot work in isolation. It must operate with a list of know jobs.
Since (most of the) jobs are being provided externally (as they represent the non-serialized parts of checkbox or other job providers) several failure modes are possible. Those are documented in resume()
Resume a SessionState object from the JSON representation.
This method is called by resume() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: plainbox.impl.session.resume.MetaDataHelper2MixIn, plainbox.impl.session.resume.SessionResumeHelper1
Helper class for implementing session resume feature
This class works with data constructed by SessionSuspendHelper2 which has been pre-processed by SessionResumeHelper (to strip the initial envelope).
Due to the constraints of what can be represented in a suspended session, this class cannot work in isolation. It must operate with a list of know jobs.
Since (most of the) jobs are being provided externally (as they represent the non-serialized parts of checkbox or other job providers) several failure modes are possible. Those are documented in resume()
Resume a SessionState object from the JSON representation.
This method is called by resume() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: plainbox.impl.session.resume.MetaDataHelper3MixIn, plainbox.impl.session.resume.SessionResumeHelper2
Helper class for implementing session resume feature
This class works with data constructed by SessionSuspendHelper3 which has been pre-processed by SessionResumeHelper (to strip the initial envelope).
Due to the constraints of what can be represented in a suspended session, this class cannot work in isolation. It must operate with a list of know jobs.
Since (most of the) jobs are being provided externally (as they represent the non-serialized parts of checkbox or other job providers) several failure modes are possible. Those are documented in resume()
Resume a SessionState object from the JSON representation.
This method is called by resume() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.
Bases: plainbox.impl.session.resume.SessionResumeHelper3
Helper class for implementing session resume feature
This class works with data constructed by SessionSuspendHelper4 which has been pre-processed by SessionResumeHelper (to strip the initial envelope).
Due to the constraints of what can be represented in a suspended session, this class cannot work in isolation. It must operate with a list of know jobs.
Since (most of the) jobs are being provided externally (as they represent the non-serialized parts of checkbox or other job providers) several failure modes are possible. Those are documented in resume()
Resume a SessionState object from the JSON representation.
This method is called by resume() after the initial envelope and parsing is done. The only error conditions that can happen are related to semantic incompatibilities or corrupted internal state.