2020-11-24 11:54:19 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
2020-11-23 15:04:21 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Diagnostics;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Security.Cryptography;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2020-12-21 23:07:37 -04:00
|
|
|
using EpicGames.Core;
|
2020-11-23 15:04:21 -04:00
|
|
|
|
|
|
|
|
namespace UnrealBuildTool.Storage
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface for reads from content-addressible storage
|
|
|
|
|
/// </summary>
|
|
|
|
|
interface IStorageReader : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Accessor for the read stream
|
|
|
|
|
/// </summary>
|
2020-12-20 18:47:42 -04:00
|
|
|
Stream? Stream { get; }
|
2020-11-23 15:04:21 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Whether the reader contains any data
|
|
|
|
|
/// </summary>
|
|
|
|
|
bool IsValid { get; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface for writes to content-addressible storage
|
|
|
|
|
/// </summary>
|
|
|
|
|
interface IStorageWriter : IDisposable
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Accessor for the write stream
|
|
|
|
|
/// </summary>
|
2020-12-20 18:47:42 -04:00
|
|
|
Stream? Stream { get; }
|
2020-11-23 15:04:21 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Commits the written data to the cache
|
|
|
|
|
/// </summary>
|
|
|
|
|
void Commit();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface for an artifact cache
|
|
|
|
|
/// </summary>
|
|
|
|
|
interface IStorageProvider
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Attempts to open a file from the output cache
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="Digest">Digest of the item to retrieve</param>
|
|
|
|
|
/// <returns>True if the item exists in the cache, false otherwise</returns>
|
|
|
|
|
IStorageReader CreateReader(ContentHash Digest);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Opens a stream for writing into the cache. The digest
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
IStorageWriter CreateWriter(ContentHash Digest);
|
|
|
|
|
}
|
|
|
|
|
}
|