DRMS_RecordSet_t * drms_clone_records ( DRMS_RecordSet_t recset,
DRMS_RecLifetime_t  lifetime,
DRMS_CloneAction_t  mode,
int *  status 

Create a new set of records using values from an original set of records to populate the new records. Within the current DRMS session, this function creates a record-set structure (DRMS_RecordSet_t) that contains "copies" of the record structures contained in recset. For each record in recset, a new DRMS_Record_t structure is created and assigned a unique record number from the DRMS database. The values of the keywords, links, and segments of the original record in recset are used to populate the newly created record. If mode == DRMS_SHARE_SEGMENTS, the newly created segments will share the segment files with the original record, i.e. the new record will have the same storage unit number (DSINDEX) as the original record. However, keyword and link data will be replicated. If mode == DRMS_COPY_SEGMENTS, the original record's segment files will be copied to a new storage unit slot, and the copied files will be associated with the new record.

The newly created records are placed in the record cache (DRMS_Env_t->record_cache) and are made writeable and assigned a lifetime of lifetime (please see drms_reclifetime for details on lifetime).

Upon successful completion, the function returns a DRMS_RecordSet_t pointer, and sets *status to 0. If an error occurs, the function returns NULL and sets *status to an appropriate error code defined in drms_statuscodes.h. Typical errors are as follows. If recset does not have any legitimate records, then *status is set to DRMS_ERROR_BADRECORDCOUNT. If there was an error receiving one or more proper record numbers from the database server, then *status is set to DRMS_ERROR_BADSEQUENCE. If an error occurs while creating a SUMS slot directory, then *status is set to DRMS_ERROR_MKDIRFAILED.

The caller owns the allocated memory associated with the returned record set and must release it by calling drms_close_records.

recset The original set of records that get cloned.
lifetime Either DRMS_PERMANENT (at the end of the DRMS session, the cloned records should be saved to the database) or DRMS_TRANSIENT (at the end of the DRMS session, the cloned records should be discarded).
mode Either DRMS_COPY_SEGMENTS (copy original data to the newly cloned records) or DRMS_SHARE_SEGMENTS(point to the original data).
status Pointer to DRMS status (see drms_statuscodes.h) returned by reference. 0 if successful, non-0 otherwise.
The set of cloned records.
drms_record_ex3.c, and drms_record_ex4.c.

Definition at line 3336 of file drms_record.c.

Generated on Mon Apr 24 07:00:41 2017 for JSOC_Documentation by  doxygen