FlushFile Method
Flushes the specified file's modified blocks out to external storage.
Syntax
Remarks
This method flushes any modified data blocks for the file specified by FileId out to external storage via the WriteData event (and possibly, the ReadFile event, if the cache is forced to retrieve data from external storage before writing it back). The FlushMode parameter specifies what kind of flushing should be performed; it must be one of the following values:
FLUSH_MODE_SYNC | 0 | Flush file data synchronously, blocking until finished. |
FLUSH_MODE_ASYNC | 1 | Flush file data in the background; do not wait until the flush operation completes. |
FLUSH_MODE_TEST | 2 | Check to see if there's file data that needs to be flushed, but don't actually flush anything. |
The Delay parameter may be passed a non-zero number of seconds to delay the flushing operation.
The FileContext parameter may be passed any application-defined value. If the flushing operation causes the file to be opened, the specified value will be passed through to the WriteData and ReadFile events' corresponding parameter. (If the file is already open, the value passed to OpenFile takes precedence).
This method will return one of the following values:
FLUSH_RESULT_NOTHING | 0 | The file has no data that needs flushing. |
FLUSH_RESULT_DIRTY | 1 | The file has data that needs flushing, but no flush operation is running yet. |
FLUSH_RESULT_RUNNING | 2 | The file's data is in the process of being flushed. |
FLUSH_RESULT_SUCCESS | 3 | The file's data has been flushed successfully. |
.NET Standard Notes
To call this method in an asynchronous manner call FlushFileAsync instead. When the method completes (or an error is encountered) the FlushFileCompleted event will fire.