syspolicy :: change :: ChangeSet :: Class ChangeSet
[hide private]
[frames] | no frames]

Class ChangeSet

source code

This class represents a set of Change's that are to be implemented in the order they are appended to the ChangeSet. A ChangeSet is considered completed only when all the changes have been completed successfully.

A ChangeSet must be either accepted or rejected in it's entirety and no individual selection among the Change's is supported. This is a design requirement, since many times Changes depend on the previous ones.

Instance Methods [hide private]
 
__init__(self, changes=None) source code
 
set_state(self, state)
This function accepts a new state for the ChangeSet and marks this state for all the contained Changes as well.
source code
 
check_state(self)
This function checks the state of the changes and updates the state of the ChangeSet if appropriate.
source code
 
get_state(self)
This function returns the state of the ChangeSet after checking it with self.check_state().
source code
 
append(self, change)
This function appends a Change to the ChangeSet.
source code
 
insert(self, position, change)
This function inserts a Change to the ChangeSet at position `position`.
source code
 
extend(self, changes)
This function extends the ChangeSet with a list of changes.
source code
 
merge(self, changeset)
This function merges the changes from another ChangeSet.
source code
Class Variables [hide private]
  changes = None
an ordered list of Change elements creating the ChangeSet
  state = 0
summarized state of the ChangeSet
Method Details [hide private]

set_state(self, state)

source code 

This function accepts a new state for the ChangeSet and marks this state for all the contained Changes as well.

If the current state is STATE_PROPOSED, it can be changed to STATE_ACCEPTED, STATE_IGNORED or STATE_REJECTED.

If the current state is STATE_ACCEPTED, it can be changed to STATE_COMPLETED or STATE_FAILED.

Parameters:
  • state - The new state
Returns:
True if the state of the ChangeSet is `state`, False otherwise

check_state(self)

source code 

This function checks the state of the changes and updates the state of the ChangeSet if appropriate. The checking is performed only when the ChangeSet has been accepted.

The state is changed to completed when all the changes have been completed and the state is changed to failed when a change is found that is not in the completed nor unhandled state.

append(self, change)

source code 

This function appends a Change to the ChangeSet.

Parameters:
  • change - The Change to be appended

insert(self, position, change)

source code 

This function inserts a Change to the ChangeSet at position `position`.

Parameters:
  • position - The position in the list of changes
  • change - The Change to be appended

extend(self, changes)

source code 

This function extends the ChangeSet with a list of changes.

Parameters:
  • changes - List of Change elements

merge(self, changeset)

source code 

This function merges the changes from another ChangeSet.

Parameters:
  • changeset - Another ChangeSet where to get the Changes from