# mco_disk_load_file DEPRECATED

> Load database files from persistent storage. This function has been deprecated in version 7.1. See mco_db_load().

### Prototype

        MCO_RET	mco_disk_load_file(	/*IN*/ char const * file_path,
                        /*IN*/ void *stream_handle,
                        /*IN*/ mco_stream_read input_stream_reader,
                        /*IN*/ mco_dictionary_h dict );

### Arguments

file_path | The file to load from or a database description file
stream_handle | Handle to the input stream
input_stream_reader | Handler function called by the runtime to read the input
dict | The database dictionary handle

### Description

> This function loads eXtremeDB database files from persistent storage. It must be called before `mco_db_open_dev()` but once the database is loaded, it is necessary for the application to then call `mco_db_open_dev()` to open it.

> The argument `file_path` specifies the file to load from for “single-file” databases. However if the database is “multifile” or “raid” the file path identifies a “database description file” which must have extension “.mfd”. (A single-file database may also be described as single segment multifile through the database description file.)

> Whereas `mco_disk_load()` gets the necessary file information from the `mco_device_t` structures passed to it, `mco_disk_load_file()` reads the same information from the database description file (*.mfd). The format for a database description file is as follows:

>         number_of_segments   type_of_storage
>         size_of_segment      path_to_database_file
>         (this line repeats for each segment)

> Where:

> number_of_segments | A number greater than zero. This is the count of `mco_device_t` elements passed to `mco_db_open_dev()` with assignment = `MCO_MEMORY_ASSIGN_PERSISTENT`.
> type_of_storage | Multifile, raid0 or raid1. This is the same as field `type` of structure `mco_device_t` passed to`mco_db_open_dev()`
> size_of_segments | Number of Megabytes or zero for raids. This is the field `segment_size` of structure `mco_device_t` passed to `mco_db_open_dev()`The actual file size in Megabytes for multifile type, zero for raids
> path_to_database_file | The name of file or partition assigned to the database file segment

### Return Codes

MCO_S_OK | The database was closed successfully
MCO_E_NOINSTANCE | The specified database is not opened

### Example

        Application snippet:

        const char * db_name = "backupdb";

        mco_size_sig_t file_reader( void *stream_handle /* FILE *  */,  /* OUT */void *to, mco_size_t max_nbytes )
        {
            FILE *f = (FILE *)stream_handle;
            mco_size_sig_t nbs;
            nbs = fread( to, 1, max_nbytes, f );
            return nbs;
        }

        int  main(int argc, char** argv)
        {
            MCO_RET             rc;
            mco_db_h            db;
            mco_device_t 	    dev[4];
            mco_db_params_t     db_params;
            …
            char * mdf_file = “Multifile.mdf”;
            …
            rc = mco_disk_load_file( mdf_file, file_reader, backupdb_get_dictionary());

            sample_rc_check( "\t Load database file", rc );
            rc = mco_db_open_dev( dbname, backupdb_get_dictionary(),
                        dev, sizeof(dev)/sizeof(dev[0]), &db_params );
            if ( MCO_S_OK == rc )
            {
                /* Connect to database */
                rc = mco_db_connect( dbname, &db );
                sample_rc_check( "\t Connect to database", rc );
            }
        }

> The example database description file “Multifile.mdf” could be one of the following:

> Example 1: (describes a 3-segment raid1 database):

            3 raid1
            0 dbtest.dbs0
            0 dbtest.dbs1
            0 dbtest.dbs2

Example 2: (describes a 3-segment multifile database):

            3 multifile
            2048 dbtest.dbs0
            1024 dbtest.dbs1
            2048 dbtest.dbs2

Example 3: (describes a single-file database):

            1 multifile
            2048 dbtest.dbs0