FlushFile Event

Fires when the OS needs to flush an open file's data out to storage.

Syntax

// CBFSFlushFileEventArgs carries the CBFS FlushFile event's parameters.
type CBFSFlushFileEventArgs struct {...}

func (args *CBFSFlushFileEventArgs) FileName() string
func (args *CBFSFlushFileEventArgs) FileContext() int64
func (args *CBFSFlushFileEventArgs) ResultCode() int32
func (args *CBFSFlushFileEventArgs) SetResultCode(value int32)

// CBFSFlushFileEvent defines the signature of the CBFS FlushFile event's handler function.
type CBFSFlushFileEvent func(sender *CBFS, args *CBFSFlushFileEventArgs)

func (obj *CBFS) GetOnFlushFileHandler() CBFSFlushFileEvent
func (obj *CBFS) SetOnFlushFileHandler(handlerFunc CBFSFlushFileEvent)

Remarks

This event fires anytime the OS needs the virtual filesystem to flush data out to storage. If the FileName parameter is non-empty, then all data related to the specified file (i.e., contents and all metadata) should be flushed. If FileName is empty, everything related to the virtual drive should be flushed.

To handle this event properly, applications must flush the requested data, writing it out to their backend storage.

The FileContext parameter is a placeholder for application-defined data associated with the file. Please refer to the Contexts topic for more information. (Not applicable if FileName is empty.)

The ResultCode parameter will always be 0 when the event is fired. If the event cannot be handled in a "successful" manner for some reason (e.g., a resource isn't available, security checks failed, etc.), set it to a non-zero value to report an appropriate error. Please refer to the Error Reporting and Handling topic for more information.

Copyright (c) 2022 Callback Technologies, Inc. - All rights reserved.
CBFS Connect 2020 Go Edition - Version 20.0 [Build 8348]