/// <summary> /// See <see cref="PlaceHydratedFileAsync(VirtualPath, VfsFilePlacementData, CancellationToken)"/> /// </summary> public Task <BoolResult> PlaceHydratedFileAsync(FullPath fullPath, VfsFileNode node, CancellationToken token) { var data = node.Data; var realPath = node.RealPath.ToString(Tree.PathTable); return(WithOperationContext(new Context(_logger), token, context => context.PerformOperationAsync( Tracer, async() => { // Replace the file at the real path var result = await _placer.PlaceFileAsync( context, new FullPath(realPath), data, token).ThrowIfFailure(); // Place the file in the VFS path as well await _placer.PlaceFileAsync( context, fullPath, data, token).ThrowIfFailure(); if (result.FileSize >= 0) { Counters[VfsCounters.PlaceHydratedFileBytes].Add(result.FileSize); } else { Counters[VfsCounters.PlaceHydratedFileUnknownSizeCount].Increment(); } return BoolResult.Success; }, extraStartMessage: $"VfsPath={fullPath}, RealPath={realPath}, Hash={data.Hash}", counter: Counters[VfsCounters.PlaceHydratedFile]))); }
/// <summary> /// Places a hydrated file at the given VFS root relative path /// </summary> /// <param name="relativePath">the vfs root relative path</param> /// <param name="data">the content and placement data for the file</param> /// <param name="token">the cancellation token</param> /// <returns>a task which completes when the operation is complete or throws an exception if error is encountered during operation</returns> internal Task PlaceHydratedFileAsync(VirtualPath relativePath, VfsFileNode node, CancellationToken token) { var fullPath = ToFullPath(relativePath); return(PlaceHydratedFileAsync(fullPath, node, token)); }