Пример #1
0
        public ReliableBackgroundOperations(
            GVFSContext context,
            Func <CallbackResult> preCallback,
            Func <GVFltCallbacks.BackgroundGitUpdate, CallbackResult> callback,
            Func <CallbackResult> postCallback,
            string databasePath)
        {
            this.context      = context;
            this.preCallback  = preCallback;
            this.callback     = callback;
            this.postCallback = postCallback;

            string error;

            if (!BackgroundGitUpdateQueue.TryCreate(
                    this.context.Tracer,
                    databasePath,
                    new PhysicalFileSystem(),
                    out this.backgroundOperations,
                    out error))
            {
                string message = "Failed to create new background operations folder: " + error;
                context.Tracer.RelatedError(message);
                throw new InvalidRepoException(message);
            }

            this.wakeUpThread = new AutoResetEvent(true);
        }
Пример #2
0
        public static bool TryCreate(ITracer tracer, string dataDirectory, PhysicalFileSystem fileSystem, out BackgroundGitUpdateQueue output, out string error)
        {
            output = new BackgroundGitUpdateQueue(tracer, fileSystem, dataDirectory);
            if (!output.TryLoadFromDisk <long, GVFltCallbacks.BackgroundGitUpdate>(
                    output.TryParseAddLine,
                    output.TryParseRemoveLine,
                    output.AddParsedEntry,
                    out error))
            {
                output = null;
                return(false);
            }

            return(true);
        }