MemCom Reference Manual > The MemCom Database Structure

The MemCom Database Structure

1. File Structure

A MemCom database consists of a UNIX file system directory containing several files:

  • header The header file.

  • index[.old] The binary index file. Any extension designates a previous version.

  • data.x The binary data file(s).

1.1. The header file

The MemCom database header file is a text file containing the top-level information. In the current version it contains the following parameters:

MEM-COM x.y z endian_flag address_size creation_date access_date
header_size index_size data_size naddr taddr dstsz nentry nrsize
cvties liq clt hmode set_name_size ndim_max nfdes descrl redncy

The table below describes all relevant parameters, some of them being either unused or obsolete.

x y zMajor, minor, and patch level numbers.
endian_flagLittle/big endian flag: 1 means data are stored in little-endian format. 0 means that data are store i big-endian format.
address_sizeDatabase creator address size (4 or 8). Not used anymore, since MemCom stores address in 8 byte format.
creation_dateDatabase creation time stamp.
access_dateDatabase last access time stamp.
header_sizeSize of header in bytes. Not used anymore and set to 0.
index_sizeNumber of rows of index.
data_sizeSize of data file in bytes + 1. data_size designates the byte address where data can be appended. Note that data_size is not necessarily equal to the data file size.
naddrTotal size of data section (in bytes).
taddrNot used.
dstszSize of index table structure (in bytes).
nentryNumber of entries in index table.
nrsizeNumber of entries in index table that triggers index table resize.
cvtiesTotal size of cavities, i.e empty space, in data section (in bytes).
liqLast entry in index table queried.
cltCurrent index table length. Not used.
hmodeIndex table search method. Currently not used.
set_name_sizeMaximum set name size (in bytes).
ndim_maxMaximum number of array dimensions of any set.
nfdesNot used.
descrlDefault dataset descriptor size (in bytes).
redncyNot used.

1.2. The index file

The file index contains for each dataset its attributes (name, type, size, address, etc.). These attributes are stored in IEEE little-endian format, and their layout corresponds to the following (packed) C-structure:

/*
 * Dataset structure as read from and written to index file.
 */
struct dbsetsdb {
    char sname[SET_NAME_LENGTH+1]; /* Name of dataset */
    char type[4];                  /* Type of dataset (E, I, D, etc.) */
    char desclgt[4];               /* Descriptor size (bytes) */
    char dspos[8];                 /* Byte address of descriptor */
    char spos[8];                  /* Byte address of data part */
    char ndim[1];                  /* Number of dimensions */
    char dim[MAX_NDIM][8];         /* Size of each dimension */
    char status[1];                /* Status (0 inactive, 1 active) */
    char hidden[1];                /* Hidden subset (0 no, 1 yes) */
    char unit[1];                  /* File unit (not used yet) */
};

The length of the index (the number of entries) is stored in the header file.

1.3. The data files

The data file data.1 contains the effective data pointed to by the index. All data are stored in IEEE 'little-endian' format.