public async Task <Possible <string, Failure> > ProduceFileAsync(
            CasHash hash,
            string filename,
            FileState fileState,
            UrgencyHint urgencyHint,
            Guid activityId,
            CancellationToken cancellationToken)
        {
            var result = await ReadOnlyCacheSession.PlaceFileAsync(
                new Context(Logger),
                hash.ToMemoization(),
                new BuildXL.Cache.ContentStore.Interfaces.FileSystem.AbsolutePath(filename),
                fileState == FileState.ReadOnly?FileAccessMode.ReadOnly : FileAccessMode.Write,
                ReplaceExistingOnPlaceFile?FileReplacementMode.ReplaceExisting : FileReplacementMode.FailIfExists,
                fileState.ToMemoization(),
                cancellationToken);

            switch (result.Code)
            {
            case PlaceFileResult.ResultCode.PlacedWithHardLink:
            case PlaceFileResult.ResultCode.PlacedWithCopy:
                return(filename);

            case PlaceFileResult.ResultCode.NotPlacedAlreadyExists:
                return(new FileAlreadyExistsFailure(CacheId, hash, filename));

            case PlaceFileResult.ResultCode.NotPlacedContentNotFound:
                return(new NoCasEntryFailure(CacheId, hash));

            case PlaceFileResult.ResultCode.Error:
            case PlaceFileResult.ResultCode.Unknown:
                return(new CacheFailure(result.ErrorMessage));

            default:
                return(new CacheFailure("Unrecognized PlaceFileAsync result code: " + result.Code + ", error message: " + (result.ErrorMessage ?? string.Empty)));
            }
        }
 /// <inheritdoc />
 public Task <PlaceFileResult> PlaceFileAsync(Context context, ContentHash contentHash, AbsolutePath path, FileAccessMode accessMode, FileReplacementMode replacementMode, FileRealizationMode realizationMode, CancellationToken cts, UrgencyHint urgencyHint)
 {
     return(_innerCacheSession.PlaceFileAsync(context, contentHash, path, accessMode, replacementMode, realizationMode, cts, urgencyHint));
 }