// Copyright Epic Games, Inc. All Rights Reserved. using System.Collections.Generic; using EpicGames.UBA.Impl; namespace EpicGames.UBA { /// /// Struct containing results from artifact fetch /// /// Is set to true if succeeded in fetching artifacts /// Contains log lines if any public readonly record struct FetchFromCacheResult(bool Success, List LogLines); /// /// Base interface for a cache client /// public interface ICacheClient : IBaseInterface { /// /// Connect to cache server /// /// Cache server address /// Cache server port /// Number of tcp connections we want /// True if successful public abstract bool Connect(string host, int port, int desiredConnectionCount = 1); /// /// Disconnect from cache server /// public abstract void Disconnect(); /// /// Register path with string that will be hashed. All files under this path will be ignored and instead refer to this path hash /// /// Path that will represent all files under that path /// String that is unique to the content of data under path public abstract bool RegisterPathHash(string path, string hash); /// /// Write to cache /// /// Bucket to store cache entry /// Process /// Input files /// Input files size /// Output files /// Output files size /// True if successful public abstract bool WriteToCache(uint bucket, nint processHandle, byte[] inputs, uint inputsSize, byte[] outputs, uint outputsSize); /// /// Fetch from cache /// /// handle for roots /// Bucket to search for cache entry /// Process start info /// True if successful public abstract FetchFromCacheResult FetchFromCache(ulong rootsHandle, uint bucket, ProcessStartInfo info); /// /// Request the connected server to shutdown /// /// Reason for shutdown public abstract void RequestServerShutdown(string reason); /// /// Create a ICacheClient object /// /// The session /// Output reason for cache miss to log. /// Enable crypto by using a 32 character crypto string (representing a 16 byte value) /// string that will show in cache server log /// The ICacheClient public static ICacheClient CreateCacheClient(ISessionServer session, bool reportMissReason, string crypto = "", string hint = "") { return new CacheClientImpl(session, reportMissReason, crypto, hint); } } }