Storage Unit Management Subsystem (SUMS)


#ifndef SUM_INCL #define SUM_VERSION_NUM (1.0) #define DBCONNECT "DSOWNER/HMI4SDO@hmidb" #include #include

typedef uint64_t SUMID_t;

#define ARCH 1 #define TEMP 2 #define PERM 4 #define TOUCH 8 #define RETRIEVE 16 #define NORETRIEVE 32 #define FULL 1024

#define SUM_INCL #endif


This is found in sum_rpc.h:

typedef struct SUM_struct {

} SUM_t;

typedef struct SUMEXP_struct {

} SUMEXP_t;


SUM_t *SUM_open(char *server, char *db, int (*history)(const char *fmt, ...))


int SUM_close(SUM_t *sum, int (*history)(const char *fmt, ...))


int SUM_get(SUM_t *sum, int (*history)(const char *fmt, ...))

The caller sets: SUMID = the open id mode = RETRIEVE | NORETRIEVE to get any offline dataunits from tape

tdays = touch days for online retention. Always used regardless of TOUCH mode

reqcnt = Number of dsindex values given below to get dsix_ptr= Pointer to array of reqcnt uint64_t to indicate DB index of

The function returns: Error code = 1, else 0 on success with:

else RESULT_PEND when result msg will be sent later.


int SUM_alloc(SUM_t *sum, int (*history)(const char *fmt, ...))

The caller sets: SUMID = the open id bytes = number of bytes to allocate

The function returns: Error code, else 0 on success with: dsix_ptr= Pointer to dsindex assigned to this storage unit. The application

wd = Pointer to string giving the allocated wd. It is of the form of


int SUM_alloc2(SUM_t *sum, uint64_t sunum, int (*history)(const char *fmt, ...))

The caller sets in sum: SUMID = the open id bytes = number of bytes to allocate

The function returns: Error code, else 0 on success with: dsix_ptr= Pointer to dsindex assigned to this storage unit. In this case,

wd = Pointer to string giving the allocated wd. It is of the form of


int SUM_put(SUM_t *sum, int (*history)(const char *fmt, ...))

The caller sets: SUMID = the open id mode = [ARCH | TEMP | PERM] + TOUCH for a normal, temporary or permanent

tdays = If TOUCH applies, number of days to retain the storage unit dsname = dataseries name group = the storage group # for this dataseries reqcnt = Number of dsindex values given below to put dsix_ptr= Pointer to array of reqcnt uint64_t to indicate DB index of

wd = Array of char * pointing to the wd of each dsindex given. Value


int SUM_poll(SUM_t *sum)

NOTE: Upon msg complete return, sum->status != 0 if error anywhere in the


int SUM_wait(SUM_t *sum)

NOTE: Upon msg complete return, sum->status != 0 if error anywhere in the


int SUM_info(SUM_t *sum, uint64_t sunum, int (*history)(const char *fmt, ...))

Sample use:

The function returns: Error code, else 0 on success with sum->sinfo pointing to: typedef struct SUM_info_struct {

} SUM_info_t;


int SUM_delete_series(char *filename, int (*history)(const char *fmt, ...))

*/ This will mark all the given storage units as delete pending with a substatus of DADPDELSU to not do any Records.txt processing for the storage unit when it is deleted, as the DRMS may have reused the record numbers in the Records.txt file.


int SUM_export(SUMEXP_t *sumexp, int (*history)(const char *fmt, ...))

/* Will take a request (typically from remotesums_ingest)

Example of use is in: /home/production/cvs/JSOC/base/sums/apps/main2.c


EXAMPLE OF USE:

See cvsroot/PROTO/src/SUM/main.c

with corresponding make in Makelinuxia64.mk and Makelinux4.mk

The SUM API library is in:

cvsroot/PROTO/src/libSUMAPI.d (OLD)

and

cvs/jsoc/src/base/sumsapi


DISCUSSION:

The SUMS runs as a server sum_svc, which the SUM_open() connects with via a socket. It can decide how to serialize calls to the DB.


20Jan2005

Here's how the SUMS might be used.

When the DRMS first starts it calls SUM_open(). When the DRMS gets a call to write a record it needs a wd to write the record to. If none is assigned, then it calls SUM_alloc() to get a storage unit and it also gets back a dsindex to associate with this data record.

Subsequent records are written to this wd until the number of records are in the storage unit, which the DRMS knows from the series definition. So when the next record is to be written another SUM_alloc() must be done.

When the application finally returns to pe, it indicates all the storage units that were allocated and that need a SUM_put() done on them. This happens on the return to pe so that an abort and release of everything can be an option that the module selects in the end.

All the storage units are put one by one with a SUM_put() call with the archive mode and retention time and other ancillary info. This would allow a module to produce seperate archivable, temporary and permanenent datasets, compared to mdi which requires that all output ds have the same archive properties.