int drms_close_records ( DRMS_RecordSet_t rs,
int  action 

Close a set of records and free allocated memory, optionally inserting new records into the database. If action == DRMS_FREE_RECORD, then if a record being closed is the only reference to a SUMS storage unit slot, that slot is freed and marked for removal during SUMS garbage collection. During SUMS garbage collection, all data-segment files stored within this storage unit will be deleted. In this scenario, segment files written to SUMS during the current DRMS session are not preserved. If action == DRMS_INSERT_RECORD, then this function saves the keyword, link, and segment information in the appropriate database tables, and ensures that segment files written to SUMS during the current DRMS session are preserved. In order to succeed, no record contained in rs can be marked read-only.

Regardless of action, this function calls drms_free_records to deallo- cate the rs DRMS_RecordSet_t structure, the array of pointers to DRMS_Record_t structures contained within rs, and the actual DRMS_Record_t structures that these pointers reference. All these structures and pointers must have been previously allocated in heap memory (functions like drms_open_records ensure this is the case). The records are also removed from the record cache (env->record_cache).

Upon successful completion, the function returns 0. If an error occurs, the function returns an appropriate error code defined in drms_statuscodes.h. Typical errors are as follows. If action is nei- ther DRMS_FREE_RECORD nor DRMS_INSERT_RECORD, then DRMS_ERROR_INVALI- DACTION is returned. If action == DRMS_INSERT_RECORD and at least one record in rs is marked read-only, then DRMS_ERROR_COMMITREADONLY is returned.

rs The set of records to close
action Specifes whether records being closed are to be inserted into the database (DRMS_INSERT_RECORD) or not (DRMS_FREE_RECORD).
DRMS status (see drms_statuscodes.h). 0 if successful, non-0 otherwise.
drms_record_ex2.c, drms_record_ex3.c, drms_record_ex4.c, and drms_record_ex6.c.

Definition at line 3360 of file drms_record.c.

Generated on Mon Mar 26 07:00:52 2018 for JSOC_Documentation by  doxygen