Changes between Version 6 and Version 7 of rfc12_filemanagement
- Timestamp:
- May 8, 2007, 5:38:38 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
rfc12_filemanagement
v6 v7 7 7 == Summary == 8 8 9 Some applications using GDAL have a requirement to provide file management operations through the GUI. This includes deleting, renaming, moving and packaging up datasets which often requires operations on several associated files. This RFC introduces an operation on a GDALDataset to identify all the dataset files, and operations to move /renamethem.9 Some applications using GDAL have a requirement to provide file management operations through the GUI. This includes deleting, renaming, moving and packaging up datasets which often requires operations on several associated files. This RFC introduces an operation on a GDALDataset to identify all the dataset files, and operations to move or copy them. 10 10 11 11 == !GetFileList() == … … 55 55 It should be noted that in some error conditions, such as the destination file system running out of space during a copy, it may happen that some files for a dataset get renamed, and some do not leaving things in an inconsistent state. 56 56 57 == pfnCopyFiles() == 58 59 The following new function is added to the GDALDriver class. 60 61 {{{ 62 CPLErr (*pfnCopyFiles)( const char *pszNewName, const char *pszOldName ); 63 }}} 64 65 Also a corresponding function is added to the C API. 66 67 {{{ 68 CPLErr GDALCopyDatasetFiles( GDALDriverH hDriver, const char *pszNewName, const char *pszOldName ); 69 }}} 70 71 Note that copying is done by the driver. The dataset may be opened, but if opened in update mode it may be prudent to first do a flush to synchronize the in-process state with what is on disk. GDALCopyDatasetFiles() will invoke pfnCopyFiles if it is non-NULL. 72 73 If pfnCopy is NULL the default implementation will be used which will open the dataset, fetch the file list, close the dataset, and then try to copy all the files (based on shared basenames). The default copy operation will fail if it is unable to establish a relationship between the files (ie. a common basename or stem) to indicate how the group of files should be renamed to the new pattern. 74 75 Optionally a NULL hDriver argument may be passed in, in which case the appropriate driver will be selected by first opening the datasource. 76 77 Copy is essentially the same as Rename, but the original files are unaltered. Note that this form of copy is distinct from CreateCopy() in that it preserves the exact binary files on disk in the new location while CreateCopy() just attempts to reproduce a new dataset with essentially the same data as modelled and carried through GDAL. 78 57 79 == pfnDelete() == 58 80 … … 84 106 == SWIG Implications == 85 107 86 The GDALRenameDataset() operationon the driver, and the !GetFileList() operation on the dataset will need to be exposed through SWIG.108 The GDALRenameDataset(), and GDALCopyDatasetFiles() operations on the driver, and the !GetFileList() operation on the dataset will need to be exposed through SWIG. 87 109 88 110 == Testing == 89 111 90 Rename testing will be added to the regression tests for a few representative formats. These rename operations will be between one directory and another, and will not test cross file system copying which will have to be tested manually.112 Rename and CopyFiles testing will be added to the regression tests for a few representative formats. These rename operations will be between one directory and another, and will not test cross file system copying which will have to be tested manually. 91 113 92 A small gdal rename.py script will be implemented allowing use and testing of the rename operationfrom the commandline in a convenient fashion.114 A small gdalmanage.py script will be implemented allowing use and testing of the rename, copy and delete operations from the commandline in a convenient fashion. 93 115