Академический Документы
Профессиональный Документы
Культура Документы
Checkpoint Services
Application Program Interface
Page 1
Checkpoint Service API
3.5.3.2 cpsSendFull() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
3.5.3.3 cpsSendPartial() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
3.5.4 RECEIVING CHECKPOINT DATA . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.5.4.1 cpsGetDataInAddr() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
3.5.4.2 cpsLockData(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
3.5.4.3 cpsUnLockData() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
3.5.4.4 cpsInvokeNotification() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25
3.5.5 ON-THE-FLY CONFIGURATION . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.5.5.1 cpsServerAction() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
3.5.5.2 cpsBind(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
3.5.5.3 cpsUnBind() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
3.5.5.4 cpsRemoveBindings(). . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 30
3.5.5.5 cpsBindingsDefault() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
3.5.5.6 cpsShutDown() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
4 Writing Applications Using CPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.1 Connect to CPS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.2 Register CPS Data Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.3 Perform periodic checkpoints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
4.4 Receive checkpoint data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
4.4.1 Notification Function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 34
Page 3
Checkpoint Service API
2.1 INTRODUCTION
This section describes how to get a minimally configured CPS up and running and test it with the
included example file.
2. The CKPT_SCOPE parameter should read as follows so that we may also checkpoint between
local processes.
CKPT_SCOPE = REMOTE, LOCAL
Page 5
Checkpoint Service API
3.1 OVERVIEW
Page 7
Checkpoint Service API
Page 9
Checkpoint Service API
3.3.5 TRACE_OUTPUT
This variable specifies where information from TRACE_OPTIONS is to be sent. The options, all
case insensitive, are standard out (stdout), standard error (stderr) and LOG_FILE. Any or
all of these values may be specified for receiving output. Standard in and standard out may be
redirected when starting a client or server. If no TRACE_OUTPUT is specified, then stderr is
used.
TRACE_OUTPUT stderr, log_file
The above entry will cause TRACE_OPTION output to standard error and a log file. The keyword
LOG_FILE is valid only if the file path to a log file has been provided using the LOG_FILE entry
in the configuration file. The LOG_FILE entry is discussed next.
3.3.6 LOG_FILE
The LOG_FILE value is the path of the file to which TRACE_OPTIONS information will be
written when CPS clients and servers are running. If the keyword LOG_FILE is not provided as a
value to the TRACE_OUTPUT variable, then this path is ignored. There is no default for this
variable.
LOG_FILE /etc/logs/mylogfile
3.3.7 MSGS_DATA
When MSGS is one of the values specified for TRACE_OPTIONS, then the contents of messages
are also dumped as they are tracked. The amount of data dumped (via a hexadecimal print routine)
is controlled by this option. For instance, perhaps only 16 bytes is necessary to provide enough
information when showing a message’s contents to make tracing useful. If messages are
especially large, then this value is of great importance in controlling the amount of time and CPU
used to display message content. If not provided, the default is 0, in which case only the message
headers are displayed or printed.
MSGS_DATA 32
3.3.8 SHMKEY_BASE
This integer variable represents the base value for keys which will be used to acquire shared
Page 11
Checkpoint Service API
3.3.14 BIND
One or more BIND’s may be specified to cause one or more outgoing tagged data objects [see
3.5.3.1 on page 17] to be sent to a specific subset of the listed servers. This capability is desirable
in larger server groups when only limited distribution of certain data objects is desired. Once
BIND is used, any outgoing checkpoint data having the tag name specified will be sent only to
those servers specified.
For any particular tagged data object, BIND and UNBIND are mutually exclusive specifications.
The format is:
BIND = <data_object_tag>, <server_name>
BIND = ABCD, alice
BIND = ABCD, sam
BIND = MOTO, pugsly, MOTO, sarah
3.3.15 UNBIND
The opposite of BIND, UNBIND cause one or more outgoing tagged data objects [see 3.5.3.1 on
page 17] to be sent to all servers in a server group except those specified on the UNBIND lines.
This may be simpler than specifying several BIND’s to accomplish the same effect. This
capability is desirable in larger server groups to limit distribution of certain data objects. Once
UNBIND is used, any outgoing checkpoint data having the tag name specified will be sent to all
servers in a server group except those servers specified.
For any particular tagged data object, BIND and UNBIND are mutually exclusive specifications.
The format is:
UNBIND = <data_object_tag>, <server_name>
UNBIND = ABCD, alice, DATA, condo
UNBIND = ABCD, sam
UNBIND = MOTO, pugsly
3.3.16 BINDINGS_DEFAULT
If outgoing data objects have no BIND’s or UNBIND’s specified, then they are by default sent to
all the servers in a CPS’s server group when they are checkpointed. Change that default by using
one of the following two, case insensitive, options:
ALL - bind outgoing data objects to all servers. (default)
NONE - do not bind outgoing data objects to any servers.
The format is:
BINDINGS_DEFAULT = <ALL || NONE>
BINDINGS_DEFAULT = NONE
3.4 SOFTWARE INTERFACES
The CPS API functions fall into five (5) major categories:
Page 13
Checkpoint Service API
3.5.1.1 cpsOpenCkptInterface()
NAME
cpsOpenCkptInterface - client application opens the checkpoint interface
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsOpenCkptInterface(void (*notify)(char *tag,
unsigned int offset, unsigned int count))
DESCRIPTION
This function must be called before any other CPS API functions can be used. It opens
and initializes the checkpointing interface by establishing a client link between the
application and the local checkpoint server (CPS).
In addition, if the notify() function address is not NULL (0), it will be invoked with
the tagged name of the data object that has just been received by the server and for
which the application has registered. The two additional arguments provided specify
the offset from the address of the data object at which the update was written and a
count, which is the number of bytes written at that address offset.
This notification address may be left NULL (0) if receipt of checkpointed data is of no
interest to the application (it will be sending data only) or if the application has no need
to be notified each time the checkpointed data arrives.
Page 15
Checkpoint Service API
cpsSTATUS cpsCloseCkptInterface(void)
DESCRIPTION
This function closes the program’s connection to the CPS API’s resources. It is
important that this call be made prior to terminating execution in order to disassociate
the application from its shared memory segments.
DIAGNOSTICS
cpsOK is returned if the call is successful.
cpsEOPEN is returned if the application has not previously called
cpsOpenCkptInterface() successfully.
cpsBMF is returned if the checkpointing subsystem detected a bad message
format--this is an internal fault. See your system administrator.
cpsIOERR is returned if the client application suffers a serious I/O error while
communicating with the checkpoint server.
3.5.3.1 cpsGetDataOutAddr()
NAME
cpsGetDataOutAddr - allocates resources for a data object to be checkpointed.
SYNOPSIS
#include <cpsapi.h>
cpsSTATUScpsGetDataOutAddr(char * tag, int byte_count,
char ** data_addr)
DESCRIPTION
This function acts as the counterpart of the cpsGetDataInAddr() function. This function
takes a string identifier (tag) and length (byte_count) to associate with outgoing
checkpoint data and outputs the memory address (data_addr) of the character buffer
which the application must use to contain this data prior to requesting any
checkpointing. The application can make several calls to this function if it has several
different data objects it wishes to checkpoint. However, each data tag name may be
used only once. The tag is a name supplied by the client to identify the data object to
the CPS for any and all subsequent calls regarding it.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
byte_count - this is the size in bytes of the data object associated with the specified tag.
data_addr - this is the allocated storage address for the data object that is going to be
checkpointed. Its size is byte_count. The application should initialize and use this
Page 17
Checkpoint Service API
associates this tag with an allocated buffer for the data object and uses the data in that
buffer for checkpointing.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
DIAGNOSTICS
3.5.3.3 cpsSendPartial()
NAME
cpsSendPartial - initiates a checkpoint for a subset of data in the specified data
object.
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsSendPartial(char * tag, char *data_addr, int
Page 19
Checkpoint Service API
3.5.4.1 cpsGetDataInAddr()
NAME
cpsGetDataInAddr - allocates resources for a data object to receive checkpoint
data.
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsGetDataInAddr(char * tag, int byte_count,
char ** data_addr)
DESCRIPTION
This function acts as the counterpart of the cpsGetDataOutAddr() function. This
function takes a string identifier (tag) and length (byte_count) to associate with
incoming checkpoint data and outputs the memory address (data_addr) of the character
buffer which the application may use to access this data. The application can make
several calls to this function if it has several different data objects it wishes to receive.
However, each data tag name may be used only once. The tag is a name supplied by the
client to identify the data object to the CPS for any and all subsequent calls regarding it.
This function may be called even if there isn’t a sender for the data object, assuming the
sender will be along eventually. The data in the allocated buffer should not be
considered valid until the client has been notified of a checkpoint via the callback
specified in cpsOpenCkptInterface function.
This function must be called to identify each data object the client expects to receive.
If not done, the client application will never be able to receive checkpointed data sent
by another client, whether local or remote.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
byte_count - this is the size in bytes of the data object associated with the specified tag.
data_addr - this is the allocated storage address for the data object that is going to be
received. Its size is byte_count. The application should use this buffer to access
received checkpointed data. Data in this buffer should not be considered valid until the
application has been notified via the callback that a full checkpoint has occurred.
DIAGNOSTICS
Page 21
Checkpoint Service API
the cpsUnLockData() function also is not called by default, and must also be done
explicitly.
The cpsLockData() routine is usable within any section of the client’s code, not
just the notification routine, when a data object’s contents must be protected from
change during its access.
It is important to call cpsUnLockData() as soon as possible after the
cpsLockData() call, so that at a minimum, the CPS can update its contents with
newly arrived updates. The CPS updates this data object immediately upon release by
the client.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
direction - this value specifies whether the data object being locked is of type inbound
(DataIn) or outbound (DataOut). It is rare for a client to lock outbound data objects, a
step normally performed by the checkpointing routines to protect the data from being
updated by the client’s threads while it is being copied to the target servers. Direction
accepts the following two values:
• cpsCKPTIN - for data objects which are inbound from other clients and
whose tags were associated using the cpsGetDataInAddr() function.
• cpsCKPTOUT - for data objects which are outbound and whose tags were
associated using the cpsGetDataOutAddr() function.
tries - this value specifies the number of one millisecond waits to be performed before
giving up the lock attempt, should the initial lock request fail. Specifying a value of zero
(0) causes a single, non-delayed attempt to lock this data object before returning with
the request status.
DIAGNOSTICS
cpsOK is returned if the call is successful. This include the case where the client
has previously locked this data object.
cpsDCL is returned if the data object is already locked by another client or by the
CPS. Client must try again.
cpsEOPEN is returned if the application has not previously called
cpsOpenCkptInterface() successfully.
cpsSCP is returned if connecting to the CPS is pending. The client will be
informed when the connection is completed by having its notify routine
invoked with a NULL pointer instead of a four character string. This
only occurs if the CPS is not running when the client process is started
or if the CPS shuts down unexpectedly. Any calls made during this
condition are ignored.
cpsINVALIDis returned if the tries argument value is less than zero (<0).
cpsIDT is returned if the tag is NULL (0) or not exactly four characters in length.
Page 23
Checkpoint Service API
3.5.4.4 cpsInvokeNotification()
NAME
cpsInvokeNotification - causes invocation of client’s notification function
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsInvokeNotification(char * tag)
DESCRIPTION
This function is used to explicitly invoke the client’s notification function. It is typically
to be used if either cpsGetDataInAddr() or cpsUnLockData() call provides
a return code of cpsOKDATA. This means that not only was the client’s call successful,
but that new data is present for that object, and can be examined immediately. Invoking
the client’s notification function directly doesn’t enable the proper arguments of offset
and size to be provided, so using this call ensures that those arguments are correct.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
Page 25
Checkpoint Service API
• If a server’s status is not known, this call can be used to make that determi-
nation.
ARGUMENTS
name - this is the name of the server for which the action is being performed.
actions - these are the actions which are to be performed. They are arithmetically or’d
together, where appropriate, and consist of one or more of the following:
• cpsCREATE - create the named server as if it were in the SERVERS list of
the configuration file.
• cpsACTIVE and cpsSTANDBY - used with cpsCREATE, they specify the
mode in which the server is to be started. Used alone, they specify the new
state to which the server is to be moved.
• cpsREMOVE - remove the named server as if it had never existed.
• cpsGETSTATUS - used alone, the status of the server named is retrieved. It
is superfluous to use this action in conjunction with any other action as it is
always performed after the action completes.
The results for conflicting combinations of actions are undefined.
status - if the status pointer is non-zero, a status for the named server is returned.
Status’s are as follows:
• cpsACTIVE - the server is in the active state.
• cpsQUEUED - the server is scheduled for transition to the active state.
• cpsSTANDBY - the server is in a standby state.
• cpsREMOVE - the server has been removed as a direct result of this call.
• cpsUNKNOWN - the server named does not exist and a cpsCREATE action
was not specified.
• cpsNOROOM - there is no room for adding any additional servers. The
maximum number of servers in a server group is 32.
DIAGNOSTICS
cpsOK is returned if the call is successful.
cpsINVALIDis returned if the name provided is NULL or missing.
cpsEOPEN is returned if the application has not previously called
cpsOpenCkptInterface() successfully.
cpsISN is returned if the server name provided is NULL or missing.
cpsMHCE action not taken because the maximum number of hosts (32) would be
exceeded if the host named were created.
cpsNSS is returned if the server named does not exists and a cpsCREATE was
not one of the actions.
cpsBMF is returned if the checkpointing subsystem detected a bad message
format--this is an internal fault. See your system administrator.
cpsSOCKET is returned if the CPS has aborted operations. In this event, the client
Page 27
Checkpoint Service API
cpsIOERR is returned if the client application suffers a serious I/O error while
communicating with the checkpoint server. In this event, the client must
reopen the CPS interface and respecify the data it wishes to checkpoint
or receive.
3.5.5.3 cpsUnBind()
NAME
cpsUnBind - unbinds an outbound data object from a server for checkpointing
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsUnBind(char * tag, char * server)
DESCRIPTION
This function provides the ability to unbind an outbound data object from a server in a
manner fully analogous to the UNBIND option in the configuration file. Upon
successful completion of this call, all current bindings are updated within the CPS.
Note that, as with usage in the configuration file, an unbind cannot be used with a tag
which already has one or more binds.
ARGUMENTS
tag - this is a NULL terminated string used to identify the data object. It must be exactly
four characters in length, excluding the NULL terminator.
server - this is the name of the server from which the outbound data object, identified
by tag, is to be unbound. This server does not have to be known or identified at the time
of this call. If and when the server is created by a call to cpsServerAction(), the unbinds
will be updated to reflect this change.
DIAGNOSTICS
cpsOK is returned if the call is successful. This include the case where the client
has previously locked this data object.
cpsIDT is returned if the tag is NULL or not exactly four characters in length.
cpsISN is returned if the server name provided is NULL or missing.
cpsEOPEN is returned if the application has not previously called
cpsOpenCkptInterface() successfully.
cpsBMF is returned if the checkpointing subsystem detected a bad message
format--this is an internal fault. See your system administrator.
cpsSOCKET is returned if the CPS has aborted operations. In this event, the client
must reopen the CPS interface and respecify the data it wishes to
checkpoint or receive.
cpsIOERR is returned if the client application suffers a serious I/O error while
communicating with the checkpoint server. In this event, the client must
Page 29
Checkpoint Service API
checkpoint or receive.
cpsIOERR is returned if the client application suffers a serious I/O error while
communicating with the checkpoint server. In this event, the client must
reopen the CPS interface and respecify the data it wishes to checkpoint
or receive.
3.5.5.5 cpsBindingsDefault()
NAME
cpsBindingsDefault - changes the default bindings for all data objects
SYNOPSIS
#include <cpsapi.h>
cpsSTATUS cpsBindingsDefault(int bindings_default)
DESCRIPTION
This function causes all outgoing CPS data objects to be bound either to all servers or
to none of them, by default. This default does not apply to data objects which are, or
will be, BOUND or UNBOUND either in the configuration file or by subsequent
cpsBind() or cpsUnBind() calls.
ARGUMENTS
bindings_default - this value specifies the new binding default to be used for all tags.
It has 2 possible values:
cpsALL - outgoing data objects with no bindings specified will default to all CPS
hosts. That means that they will be sent to all servers in the SERVERS grouping
when checkpointed.
cpsNONE - data objects with no bindings specified will default to none, hence not
be sent to any servers within the server group when checkpointed.
DIAGNOSTICS
Page 31
Checkpoint Service API
Page 33