A teljes DC client api definialva!

Meg esetleges valtoztatasok lehetnek, de jo kiindulasi alap.

Mar csak a dc_client.c-t kell implementalni hozza eloszor BOINC-ra!



git-svn-id: svn+ssh://cvs.lpds.sztaki.hu/var/lib/svn/szdg/dcapi/trunk@280 a7169a2c-3604-0410-bc95-c702d8d87f7a
This commit is contained in:
vida 2006-01-24 15:52:37 +00:00 committed by Adam Visegradi
parent 1ad378ec42
commit 60b3e6ef92
1 changed files with 73 additions and 4 deletions

View File

@ -1,7 +1,7 @@
/* API for Master-worker applications on Distributed Computing Platforms /* API for Master-worker applications on Distributed Computing Platforms
API for the Client program API for the Client program
v0.2 Norbert Podhorszki v0.4 Norbert Podhorszki, and Gabor Vida
MTA SZTAKI, 2004 MTA SZTAKI, 2006
*/ */
#ifndef __DCCLIENT_H_ #ifndef __DCCLIENT_H_
#define __DCCLIENT_H_ #define __DCCLIENT_H_
@ -10,6 +10,49 @@
extern "C" { extern "C" {
#endif #endif
/* For return value */
#define DC_OK 0
#define DC_ERROR 1
/* For the DC_ResolveFileName function */
#define INPUT_FILE 0
#define OUTPUT_FILE 1
#define CKPT_FILE 2
#define TEMP_FILE 3
/** Inicialize the client API.
* Some kind of init is usually required in most of the GRIDs!
*
* Return: DC_OK
*/
int DC_Init(void);
/** File name resolution
* The real file name (and path) of an input/output file may be different from what
* the application expects. It should ask the API about the actual path.
* It may want to open input file 'inp.txt' in the actual directory but
* the actual file may be e.g. '../project/szdg_lpds_sztaki_hu_szdg/inp.txt09247814354'
*
* The first "type" parameter decides what is the type of the requested file:
* --> input: 0, output: 1, ckpt: 2, tmp: 3
*
* Usage:
* char fname[256];
* dc_ResolveFileName(INPUT_FILE, "inp.txt", fname, 256);
* f = fopen(fname);
*
* Return: DC_OK always
*/
int DC_ResolveFileName(
int type,
conts char *requestedFileName,
char *actualFileName,
int maxlength
);
/** Send a (partial) result back to the master. /** Send a (partial) result back to the master.
* Parameters: * Parameters:
* files list of created output files to be sent back * files list of created output files to be sent back
@ -17,10 +60,27 @@ extern "C" {
* *
* Return: DC_OK * Return: DC_OK
*/ */
int DC_SendResult(char **files, // output files int DC_SendResult(char **files,
int nfiles // number of output files int nfiles
); );
/** Is it time to make a checkpoint?
* Return: 0 No, 1 Yes
*
* Comment: fast function, it can be called very regularly.
* BOINC provides such functionality, for ClusterGrid,
* the api answers Yes every 5 minutes.
*/
int DC_TimeToCheckpoint(void);
/** User/level checkpoint made.
* Return: DC_OK
*/
int DC_CheckpointMade(void);
/** Check if work can be continued. (Ask master) /** Check if work can be continued. (Ask master)
* This involves network communication and may block long. * This involves network communication and may block long.
* Parameters: * Parameters:
@ -33,6 +93,15 @@ int DC_SendResult(char **files, // output files
int DC_ContinueWork(void); int DC_ContinueWork(void);
/** Informs about the fraction already done!
* Parameter:
* fraction - a double value of work already done / total work
*
* Return: DC_OK
*/
int DC_FractionDone(double fraction);
/** Finish computation. /** Finish computation.
* Tell DC to finish this work unit and start a new one. * Tell DC to finish this work unit and start a new one.
* It should be called as the last function and then exit. * It should be called as the last function and then exit.