This storage is a simple and efficient file storage for most "small-scale" and some "medium scale" systems.
If you expect data up to several GB it may be considered as a data storage.
Memory footprint is increasing with increasing file size for about 60MB per 1M data items, making it ideal database for embedded, mobile and desktop applications. It may be used as secondary storage for application development, testing; or as a storage for
"local" data caching.
This storage is normally initialized with constructor:
IndexedFileStorage(Stream stream, int clusterSize, bool safeWrites)
This storage keeps data in single stream, which is usually a FileStream, but still can be any .NET Stream with comparable capabilities.
Data is being split into blocks, which size is adjusted via clusterSize parameter when file is first being created. When data space is needed additional blocks are added to the stream at the end.
When file is used to store data for applications when power failures may occur, it is recommended to set safeWrites to true.
Otherwise, there is a performance gain to set false, but is not recommended setting for main data storage.
When application shuts down, it is needed to Dispose the storage, which would make a clean shutdown of the file. If this step is skipped due to error or failure, file would still be loaded the next time, but loading time would be slower.