Recreate the index file from the data file

In some cases (depending on the data identifiers you use), the FileStorage index file can become quite huge. When you backup or deploy your storage to some other place you (in principle) only need to keep the .data fil. However, if you want to use FileStorage afterwards, you do need this index file. The index file can be derived from the data file. You derive it, by using the 'recreate index file' feature of NFileStorage.

Recreate the index file using the CLI

You can use the FileStorageCommand tool for this (or use the C# logic if you prefer); in the example below you can see I store batches (increments) of new files in a FileStorage. In this case the FileStorage is called '26-2' (a date), restoring of this file works like so:

H:\Proj\NFileStorages\IncrementalData\26_2_done>FileStorageCmd.exe restoreindexfile 26-2
. 9889 (329 files/sec, 00:00:30 mins) RestoreIndexFile..............................................
This operation took 30288 msecs
Files in index (after restore)

Recreate the index file using C#

If you want to use C# code to recreate an index file, take a look at the RestoreIndexFile implementation in the FileStorageFacade:

        public static void RestoreIndexFile(string fileStorageName, AddFileBehaviour addFileBehaviour, FileStorageHandler.ExposeProgressDelegate exposeProgressDelegate)
            FileStorageHandler.RestoreIndexFile(fileStorageName, addFileBehaviour, exposeProgressDelegate);

For details about the index file, see index file details


Last edited May 30, 2009 at 10:24 AM by barkgj, version 6


No comments yet.