Main Page   Compound List   File List   Compound Members   File Members  

checkpoint.h File Reference

Go to the source code of this file.

Compounds

struct  HC_NodelistNode_t
struct  HC_NodeStack_s
struct  HC_Sequence_t

Defines

#define HC_OK   0
 Error code: OK.

#define HC_FAIL   -1
 Error code: Fail.

#define HC_INVALIDSEQUENCE   -2
 Error code: Invalid Sequence (NULL).

#define HC_INVALIDNODE   -3
 Error code: Bad node was given.

#define HC_FAILEDALLOC   -4
 Error code: Out of memory.

#define HC_FAILEDSEQUENCE   -5
 Error code: ?? unused.

#define HC_FINALERROR   -5
 Last error value (internal use).


Typedefs

typedef HC_NodeStack_s HC_NodeStack_t

Enumerations

enum  HC_PolicyEvent_t {
  HC_INVALID_EVENT, HC_NORMALFAIL, HC_NORMALSUCCESS, HC_ROLLBACKSUCCESS,
  HC_ROLLBACKFAIL
}
enum  HC_TypeTag_t { HC_LISTEND, HC_NORMALFUNC, HC_ROLLBACKFUNC, HC_POLICYFUNC }

Functions

int HC_Normal (HC_Sequence_t *sequence, long node, void *userdata)
int HC_NormalCurrent (HC_Sequence_t *sequence, void *userdata)
int HC_RollBackPrev (HC_Sequence_t *sequence)
int HC_RollBackCurrent (HC_Sequence_t *sequence)
int HC_NormalSuccess (HC_Sequence_t *sequence, long policy_data)
int HC_NormalFail (HC_Sequence_t *sequence, long policy_data)
int HC_RollBackSuccess (HC_Sequence_t *sequence, long policy_data)
int HC_RollBackFail (HC_Sequence_t *sequence, long policy_data)
int HC_Checkpoint (HC_Sequence_t *sequence, unsigned long checkpoint)
HC_Sequence_tHC_NewSequence (HC_NodelistNode_t *nodelist)
void HC_DeleteSequence (HC_Sequence_t *sequence)
int HC_CallSequence (HC_Sequence_t *sequence, void *userdata, long start_node)
int HC_DefaultPolicy (HC_Sequence_t *sequence, void *userdata, HC_PolicyEvent_t event, long policy_data)
void HC_Panic (HC_Sequence_t *sequence, const char *format,...)
int HC_Log (HC_Sequence_t *sequence, const char *format,...)
const char * HC_Strerror (int error)


Detailed Description

This file defines the external interface of the HAFTA checkpoint library.


Typedef Documentation

typedef struct HC_NodeStack_s HC_NodeStack_t
 

The stack of nodes, used for rolling back


Enumeration Type Documentation

enum HC_PolicyEvent_t
 

Event types handled by the policy functions

Enumeration values:
HC_INVALID_EVENT  An invalid event.
HC_NORMALFAIL  Normal function failed.
HC_NORMALSUCCESS  Normal function succeeded.
HC_ROLLBACKSUCCESS  Rollback function failed.
HC_ROLLBACKFAIL  Rollback function succeeded.

enum HC_TypeTag_t
 

HC_NodelistNode->type_tag values

Enumeration values:
HC_LISTEND  Denotes the end of a Nodelist.
HC_NORMALFUNC  Denotes a Normal function on this line.
HC_ROLLBACKFUNC  Denotes a Rollback function on this line.
HC_POLICYFUNC  Denotes a Policy function on this line.


Function Documentation

int HC_CallSequence HC_Sequence_t   sequence,
void *    userdata,
long    start_node
 

Execution of a sequence starts here. The sequence starts by running the Normal function for the start_node given.

Parameters:
sequence  The sequence object, created by HC_NewSequence().
userdata  User defined data. It is passed to all user functions.
start_node  The first executed node.
Returns:
An error code (or HC_OK)

int HC_Checkpoint HC_Sequence_t   sequence,
unsigned long    checkpoint
 

Sets the checkpoint. This is used during a rollback to determine how far to rollback a function.

Parameters:
sequence  Sequence object for context
checkpoint  The user-defined checkpoint value
Returns:
An error code.

int HC_DefaultPolicy HC_Sequence_t   sequence,
void *    userdata,
HC_PolicyEvent_t    event,
long    policy_data
 

Call the policy function for the given node.

Parameters:
sequence  Sequence object.
userdata  User-defined data.
event  The event that has occured.
policy_data  The policy-specific data.
Returns:
An error code.

void HC_DeleteSequence HC_Sequence_t   sequence
 

Deletes a sequence, cleanups up any memory, etc. The sequence pointer is invalid after this call.

Parameters:
sequence  A sequence object

int HC_Log HC_Sequence_t   sequence,
const char *    format,
...   
 

Prints an error to stderr.

Parameters:
sequence  Sequence object.
format  Printf()-style format string.

HC_Sequence_t* HC_NewSequence HC_NodelistNode_t   nodelist
 

Creates a sequence object from nodelist.

Parameters:
nodelist  A table of nodes and functions to be executed by the sequence.
Returns:
A sequence object containing the nodelist data given.

int HC_Normal HC_Sequence_t   sequence,
long    node,
void *    userdata
 

Transition forward to a new node.

Parameters:
sequence  A sequence object.
node  The node to transition to.
userdata  User specific data.
Returns:
An error value.

int HC_NormalCurrent HC_Sequence_t   sequence,
void *    userdata
 

Rerun the normal function for the current node.

Parameters:
sequence  A sequence object.
userdata  User specific data.
Returns:
An error value.

int HC_NormalFail HC_Sequence_t   sequence,
long    policy_data
 

Called from a normal function signifying failure.

Parameters:
sequence  Sequence object.
policy_data  Data specific to the policy
Returns:
An error code.

int HC_NormalSuccess HC_Sequence_t   sequence,
long    policy_data
 

Called from a normal function signifying success.

Parameters:
sequence  Sequence object.
policy_data  Data specific to the policy
Returns:
An error code.

void HC_Panic HC_Sequence_t   sequence,
const char *    format,
...   
 

Called to halt program execution because of a fatal error.

Parameters:
sequence  Sequence object.
format  Printf()-style format string.

int HC_RollBackCurrent HC_Sequence_t   sequence
 

Rolls back the current node.

Parameters:
sequence  Sequence object.
Returns:
An error code.

int HC_RollBackFail HC_Sequence_t   sequence,
long    policy_data
 

Called from a rollback function signifying failure in rolling back.

Parameters:
sequence  Sequence object.
policy_data  Data specific to the policy
Returns:
An error code.

int HC_RollBackPrev HC_Sequence_t   sequence
 

Rolls back the previous node.

Parameters:
sequence  Sequence object.
Returns:
An error code.

int HC_RollBackSuccess HC_Sequence_t   sequence,
long    policy_data
 

Called from a rollback function signifying success in rolling back.

Parameters:
sequence  Sequence object.
policy_data  Data specific to the policy
Returns:
An error code.

const char* HC_Strerror int    error
 

Convert from an error code to a string describing the error.

Parameters:
error  The error code
Returns:
A contant string describing the error.


Copyright ©2003. Astra Network Inc. All Rights Reserved.