ManagedFileWrapper

class ManagedFileWrapper(    val id: UUID,     resolverReference: ResolverReference,     fileManager: FileManager) : AbstractFileWrapper

A ManagedFileWrapper is an AbstractFileWrapper used by the FileManager to hold an AvailFile that is on the file system of the machine Avail is running. The purpose of this is to enable the FileManager cache to delay establishing the type of the AvailFile until the file type can be read without delaying adding a file object to the FileManager cache.

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
fun ManagedFileWrapper(    id: UUID,     resolverReference: ResolverReference,     fileManager: FileManager)

Construct a ManagedFileWrapper.

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
fun close()

Close this ManagedFileWrapper.

Link copied to clipboard
fun conditionallySaveToLocalHistory()

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
fun notifyReady()

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.

Properties

Link copied to clipboard
open val error: Throwable? = null

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

Link copied to clipboard
open val errorCode: ErrorCode? = null

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
val interestCount: AtomicInteger

The number of clients that actively have this file open.

Link copied to clipboard
val isClosed: Boolean

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

Link copied to clipboard
open val isError: Boolean

true indicates that there was an error; false otherwise.

Link copied to clipboard
val reference: ResolverReference

The ResolverReference of the target file on disk.