Changes between Version 6 and Version 7 of rfc12_filemanagement


Ignore:
Timestamp:
May 8, 2007, 5:38:38 PM (17 years ago)
Author:
warmerdam
Comment:

Added Copy operation.

Legend:

Unmodified
Added
Removed
Modified
  • rfc12_filemanagement

    v6 v7  
    77== Summary ==
    88
    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/rename them.
     9Some 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.
    1010
    1111== !GetFileList() ==
     
    5555It 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.
    5656
     57== pfnCopyFiles() ==
     58
     59The following new function is added to the GDALDriver class.
     60
     61{{{
     62    CPLErr       (*pfnCopyFiles)( const char *pszNewName, const char *pszOldName );
     63}}}
     64
     65Also a corresponding function is added to the C API.
     66
     67{{{
     68    CPLErr        GDALCopyDatasetFiles( GDALDriverH hDriver, const char *pszNewName, const char *pszOldName );
     69}}}
     70
     71Note 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
     73If 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
     75Optionally a NULL hDriver argument may be passed in, in which case the appropriate driver will be selected by first opening the datasource.
     76
     77Copy 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
    5779== pfnDelete() ==
    5880
     
    84106== SWIG Implications ==
    85107
    86 The GDALRenameDataset() operation on the driver, and the !GetFileList() operation on the dataset will need to be exposed through SWIG.
     108The GDALRenameDataset(), and GDALCopyDatasetFiles() operations on the driver, and the !GetFileList() operation on the dataset will need to be exposed through SWIG.
    87109
    88110== Testing ==
    89111
    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.
     112Rename 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.
    91113
    92 A small gdalrename.py script will be implemented allowing use and testing of the rename operation from the commandline in a convenient fashion. 
     114A 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. 
    93115