Open existing data records. The parameter dataset_desc contains a dataset descriptor string using the syntax described in Section 1.4. The number of records matching the descriptor is returned in (*num_records), and an array containing pointers to the records retrieved is returned in (*records). If mode=READONLY the record will be opened as read-only. Opening with mode=CLONE_COPY is shorthand for opening and cloning (with mode=COPY_DATA) records in a single call and corresponds to the following code snippet:
int num_recs, *flags; DRMS_Record_t **old_recs, **new_recs; ... drms_open_records(drms_handle, dataset_desc, &num_recs, &old_recs, READONLY); new_recs = (DRMS_Record_t **) malloc(num_records*sizeof(DRMS_Record_t *)); mode = malloc(num_records*sizeof(int)); for (i=0; i<num_recs; i++) flags[i] = COPY_DATA; drms_clone_records(drms_handle, num_records, old_recs, new_recs, flags); for (i=0; i<num_recs; i++) flags[i] = DISCARD; drms_close_records(drms_handle, num_recs, old_recs, flags);Opening with mode=CLONE_SHARE is shorthand for opening and cloning with mode=SHARE_DATA. See the desciption of drms_clone_records below.
Clones a set of existing data records. For each input record input[i], , create a copy of it, assign the copy a new unique record number.
The parameter mode can take the values COPY_DATA, SHARE_DATA and determines whether the data segment files are copied or the old data segment shared between the old and the new record. If mode=COPY_DATA then the data segments are copied to a new slot in a storage unit and the caller will have permission to open them for writing. If mode=SHARE_DATA the new record will point to the data unit slot containing the data segments of the old record, and will not have permission to open them for writing. [exactly how permissions on datasegments will work is TBD]
If the value returned in status is 0 the call suceeded. If status is -1 an unknown error occured. TBD: [Add positive status codes for known error conditions]
Create num_records new records from the series whose name is given by the string argument series and return handles to the records in the array records. Each record will be given a unique record number and its keywords and links will be initialized to their default values. If the series definition contains one or more data segments, DRMS will assign a storage unit to each record. This may involve allocate new data units from SUMS if not enough slots available in new storage units already opened for writing for the series. If the value returned in status is 0 the call suceeded. If status is -1 an unknown error occured. TBD: [Add positive status codes for known error conditions]
This call tells DRMS to close num_records data records identified by the handles in the array argument records. The optional array action has an entry for every record telling DRMS what to do with the record. Entries in action can take the values COMMIT and DISCARD.
A value of action[i]=COMMIT will tell DRMS to insert the keyword and link values for record in the record database, and to mark any of the data segment files written to a storage unit for subsequent archiving by the SUMS.
A value of action[i]=DISCARD will tell DRMS to discard the record, i.e. not insert it into the database. DRMS will also delete data segment files associated with the record, unless the record was created by drms_clone_records with mode=SHARE_DATA.
For ``old'' records opened with drms_open_records in read-only mode, action always defaults to DISCARD. For ``new'' records created by calling
If the value returned in status is 0 the call suceeded. If status is -1 an unknown error occured. TBD: [Add positive status codes for known error conditions]
Returns a malloced string containing a path to the directory where data segment files associated with record reside. It is the responsibility of the caller to free the returned string.
Frees the memory associated with record.
Frees the memory associated with record[i], i=1,...,num_records-1.
status | C macro | Meaning |
0 | SUCCESS | Success, no loss of accuracy |
1 | JSOC_INEXACT | Success, possible loss of accuracy |
-1 | JSOC_RANGE | Failure, value out of range |
-2 | JSOC_BADSTRING | Failure, trying to convert invalid string to numeric type |
-3 | JSOC_MISSING | Failure, keyname refers to non-existing keyword |
destination type | char | short | int | long long | float | double | string | |
source type | ||||||||
char | 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
short | -1, 0 | 0 | 0 | 0 | 0 | 0 | 0 | |
int | -1, 0 | -1, 0 | 0 | 0 | 0, 1 | 0 | 0 | |
long long | -1, 0 | -1, 0 | -1, 0 | 0 | 0, 1 | 0, 1 | 0 | |
float | -1, 0, 1 | -1, 0, 1 | -1, 0, 1 | -1, 0, 1 | 0 | 0 | 1 | |
double | -1, 0, 1 | -1, 0, 1 | -1, 0, 1 | -1, 0, 1 | -1, 0, 1 | 0 | 1 | |
string | -2, -1, 0 | -2, -1, 0 | -2, -1, 0 | -2, -1, 0 | -2, -1, 1 | -2, -1, 1 | 0 |