FireAllOpenCloseEvents Property
Whether to fire events for all file open/close operations, or just the first and last.
Syntax
cbfs.getFireAllOpenCloseEvents([callback]) cbfs.setFireAllOpenCloseEvents( fireAllOpenCloseEvents, [callback])
Default Value
FALSE
Callback
The 'callback' parameter specifies a function which will be called when the operation completes (or an error is encountered). If the 'callback' parameter is not specified, then the method will block and will not return until the operation completes (or an error is encountered).
The callback for the getFireAllOpenCloseEvents([callback]) method is defined as:
function(err, data){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'data' is the value returned by the method.
The callback for the setFireAllOpenCloseEvents([callback]) method is defined as:
function(err){ }
'err' is the error that occurred. If there was no error, then 'err' is 'null'.
'err' has 2 properties which hold detailed information:
err.code err.message
Remarks
This property specifies when the class should fire the CreateFile/OpenFile and CleanupFile/CloseFile events.
When this property is disabled (default), the class won't fire CreateFile/OpenFile for a file if there is already another handle open for it. Similarly, the CleanupFile/CloseFile events won't be fired unless the handle being closed is the last handle open for the file in question. This behavior results in better overall performance since the number of event firings is minimized, but there are some drawbacks as well:
- If the file is only opened for reading initially, and then another process opens it for writing, the application won't be notified about the new mode, and may not be prepared to respond to the "unexpected" WriteFile events that will arrive should the second process start writing to the file. (Such an application may be able to mitigate this issue by always opening the file data from the backend store in read-write mode.)
- The HandleInfo parameter of various events has no effect; they carry handle-specific information that isn't accessible to the application if this property is disabled.
When this property is enabled, the class fires the CreateFile/OpenFile and CleanupFile/CloseFile events every time a file handle is opened or closed.
This table shows when events will fire based on how this property is set:
Operation on File | Disabled | Enabled |
1. Opened by process A | X | X |
2. Opened by process B | X | |
3. Closed by process B | X | |
4. Opened by process C | X | |
5. Closed by process A | X | |
6. Closed by process C | X | X |
Note: This property cannot be changed after a virtual drive is created, and cannot be changed within events.
Data Type
Boolean