1.. _rfc-38:
2
3=========================================================================
4RFC 38: OGR Faster Open (withdrawn)
5=========================================================================
6
7Author: Even Rouault
8
9Contact: even dot rouault at spatialys.com
10
11Status: Withdrawn.
12
13Covered by `RFC 46: GDAL/OGR unification <./rfc46_gdal_ogr_unification>`__
14
15Summary
16-------
17
18It is proposed that the OGR datasource opening mechanism relies on the
19GDALOpenInfo class, already used by GDAL drivers, to speed-up datasource
20opening. The speed-up is due to the fact that the file passed to
21OGROpen() will be opened and stat'ed only once, whereas currently, it is
22opened and closed as many times as there are OGR drivers. This should be
23particularly beneficial for network filesystems, or when trying to open
24a file that is not a OGR datasource at all.
25
26E.g., trying to open a file that is not a OGR datasource currently
27requires 45 file opening or stat operations :
28
29::
30
31   $ strace ogrinfo -ro NEWS 2>&1 | grep NEWS | wc -l
32   45
33
34It is expected that if/once all drivers are migrated, it will decrease
35to 2 operations only.
36
37Implementation
38--------------
39
40Similarly to GDALDriver, the OGRSFDriver class is extended to have a
41pfnOpen member, that drivers will set to point to their own Open method.
42
43::
44
45   /* -------------------------------------------------------------------- */
46   /*      The following are semiprivate, not intended to be accessed      */
47   /*      by anyone but the formats instantiating and populating the      */
48   /*      drivers.                                                        */
49   /* -------------------------------------------------------------------- */
50       OGRDataSource       *(*pfnOpen)( GDALOpenInfo * );
51
52The OGRSFDriverRegistrar::Open() method is updated to call pfnOpen when
53iterating over the drivers. When pfnOpen is not set, it will try to call
54the Open() method of OGRSFDriver (which enables a progressive migration
55of drivers).
56
57Mainly for compatibility reasons, the virtual method Open() of
58OGRSFDriver that is currently pure virtual, will now be a regular
59virtual method, that will have a default implementation, that will try
60to call pfnOpen.
61
62The patch with the changes to OGR core is attached to this page.
63
64Backward Compatibility
65----------------------
66
67Proposed additions will not have any impact on C binary compatibility.
68
69C++ binary interface will be broken (due to the addition of a new member
70in OGRSFDriver class and the Open() method changed from pure virtual to
71virtual).
72
73Source level compatibility will be preserved for third-party OGR
74drivers.
75
76Impact on drivers
77-----------------
78
79Existing drivers are *not* required to migrate to RFC38, but are
80strongly encouraged to. New drivers *should* use RFC38 mechanism to
81preserve the overall faster opening.
82
83An example of the migration for a few drivers is attached to this page.
84
85Timeline
86--------
87
88Even Rouault is responsible to implement this proposal. New API will be
89available in GDAL 2.0. Most in-tree OGR drivers will be migrated to the
90new mechanism.
91