Keywords: arch

Next: 3 Overlord Up: HAFTA Architecture Overview Previous: 1 Introduction Contents
Subsections

- 2.1 Sequences
  - The important features of the sequence structure
- 2.2 Checkpoints
  - The important features of the checkpoint structure

# 2 Checkpoint Library

The client application can use this library to help ensure the flow of the program is developed in such a way in which it can recover from any type of unexpected problem.

This is accomplished by dividing the program structure into two levels, the sequence level, and the checkpoint level.

## 2.1 Sequences

A sequence consists of an associative array style data structure containing a list of functions that the sequence will call. Each set of functions in the list, known as a node, contains a normal function, a rollback function, and a policy function.

A sequence is invoked similarily to the way one might invoke a single function, except that it is done through the API of the checkpoint library.

### The important features of the sequence structure

- The progression through the nodes in the sequence is linear or branching. It is not a dependancy map.

- The nodes are anonymous and uniform. There is no need to differentiate between setup, running, or teardown functions.

- The nodes are self-directing. The execution sequence is indicated to the checkpoint library by the policy function, which is described below.

- Sequences are independant and nestable. Inter-sequence dependancies are left to the domain of the developer's code.

- When a node is invoked, it will be pushed onto the stack as it is called. This allows a node's policy function to roll back to a previous node should it determine that an error can't be corrected in the context of the current node.

- Errors encountered during the execution of the sequence are reported by the developer's code to the checkpoint library.

## 2.2 Checkpoints

Checkpoints are a facility for allowing the rollback of a partially completed function. Checkpoints are a strictly linear enumeration of the resources allocated by the programmer's code.

The value of the last checkpoint set by a particular normal or rollback function is stored, then presented to the rollback function so that the programmer's rollback code can know what resources it needs to free and/or deconfigure.

### The important features of the checkpoint structure

- The progression through the checkpoints is strictly linear, and as such is 100% predictable. Branching is handled in the scope of the sequence structure, not the checkpoints.

- The checkpoints are maintained by both the normal function and the rollback function. This is necassary in case the rollback function fails and needs to be re-executed.

- The checkpoint system is designed to be inobtrusive and lightweight. It does not directly affect the flow of execution.

Next: 3 Overlord Up: HAFTA Architecture Overview Previous: 1 Introduction Contents