public BackgroundFileSystemTaskRunner( GVFSContext context, Func <FileSystemTaskResult> preCallback, Func <FileSystemTask, FileSystemTaskResult> callback, Func <FileSystemTaskResult> postCallback, string databasePath) { this.context = context; this.preCallback = preCallback; this.callback = callback; this.postCallback = postCallback; string error; if (!FileSystemTaskQueue.TryCreate( this.context.Tracer, databasePath, new PhysicalFileSystem(), out this.backgroundTasks, out error)) { string message = "Failed to create new background tasks folder: " + error; context.Tracer.RelatedError(message); throw new InvalidRepoException(message); } this.wakeUpThread = new AutoResetEvent(true); }
public static bool TryCreate(ITracer tracer, string dataDirectory, PhysicalFileSystem fileSystem, out FileSystemTaskQueue output, out string error) { output = new FileSystemTaskQueue(tracer, fileSystem, dataDirectory); if (!output.TryLoadFromDisk <long, FileSystemTask>( output.TryParseAddLine, output.TryParseRemoveLine, output.AddParsedEntry, out error)) { output = null; return(false); } return(true); }