ErrorFileWrapper

class ErrorFileWrapper(val id: UUID, resolverReference: ResolverReference, fileManager: FileManager, val error: Throwable, val errorCode: ErrorCode) : AbstractFileWrapper

A ErrorServerFileWrapper is a AbstractFileWrapper that encountered an error when accessing the underlying file.

Author

Richard Arriaga

Parameters

id

The FileManager.fileCache key.

resolverReference

The reference of the target file.

fileManager

The FileManager this ManagedFileWrapper belongs to.

Constructors

Link copied to clipboard
constructor(id: UUID, resolverReference: ResolverReference, fileManager: FileManager, error: Throwable, errorCode: ErrorCode)

Construct a ManagedFileWrapper.

Properties

Link copied to clipboard
open override val error: Throwable

The Throwable if one was encountered when opening the file, null otherwise.

Link copied to clipboard
open override val errorCode: ErrorCode

The associated ErrorCode if error is not null; null otherwise

Link copied to clipboard
open override val file: AvailFile

The AvailFile wrapped by this ManagedFileWrapper.

Link copied to clipboard
val id: UUID

The FileManager.fileCache key.

Link copied to clipboard

The number of clients that actively have this file open.

Link copied to clipboard

Is the file closed? true indicates it is; false otherwise.

Link copied to clipboard
open override val isError: Boolean

true indicates that there was an error; false otherwise.

Link copied to clipboard

The ResolverReference of the target file on disk.

Functions

Link copied to clipboard
fun close()

Close this ManagedFileWrapper.

Link copied to clipboard

Save the tracedActionStack to local history starting from the position at tracedActionStackSavePointer.

Link copied to clipboard
open override fun delete(success: (UUID?) -> Unit, failure: (ErrorCode, Throwable?) -> Unit)

Delete the wrapped file from its storage location.

Link copied to clipboard
fun execute(fileAction: FileAction, originator: UUID, continuation: () -> Unit)

Update the wrapped AvailFile with the provided FileAction.

Link copied to clipboard
fun notifyOpenFailure(errorCode: ErrorCode, e: Throwable? = null)

Notify the FileRequestHandlers in ManagedFileWrapper.fileRequestQueue that the file action encountered a failure while opening.

Link copied to clipboard

Notify this ManagedFileWrapper that the AvailFile has been fully read.

Link copied to clipboard
fun provide(registerInterest: Boolean, successHandler: (UUID, String, AvailFile) -> Unit, failureHandler: (ErrorCode, Throwable?) -> Unit)

Provide the raw bytes of the enclosed AvailFile to the requesting consumer.

Link copied to clipboard
fun redo(originator: UUID)

If an undo resulted in a revert on the file and no other FileAction has occurred since, redo the previously reverted action.

Link copied to clipboard
fun undo(originator: UUID)

Undo the FileAction performed on the file from the TracedAction that is undoStackDepth + 1 from the top of the stack.