// Copyright Epic Games, Inc. All Rights Reserved. using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using EpicGames.Horde.Commits; using EpicGames.Horde.Storage; using EpicGames.Horde.Storage.Nodes; using EpicGames.Horde.Streams; namespace EpicGames.Horde.Artifacts { /// /// Information about an artifact /// public interface IArtifact { /// /// Identifier for the Artifact. Randomly generated. /// ArtifactId Id { get; } /// /// Name of the artifact /// ArtifactName Name { get; } /// /// Type of artifact /// ArtifactType Type { get; } /// /// Description for the artifact /// string? Description { get; } /// /// Identifier for the stream that produced the artifact /// StreamId StreamId { get; } /// /// Change that the artifact corresponds to /// CommitIdWithOrder CommitId { get; } /// /// Keys used to collate artifacts /// IReadOnlyList Keys { get; } /// /// Metadata for the artifact /// IReadOnlyList Metadata { get; } /// /// Storage namespace containing the data /// NamespaceId NamespaceId { get; } /// /// Name of the ref containing the root data object /// RefName RefName { get; } /// /// Time at which the artifact was created /// DateTime CreatedAtUtc { get; } /// /// Handle to the artifact data /// IBlobRef Content { get; } /// /// Deletes this artifact /// /// Cancellation token for the operation Task DeleteAsync(CancellationToken cancellationToken); } /// /// Used to write data into an artifact /// public interface IArtifactBuilder { /// ArtifactId Id { get; } /// ArtifactName Name { get; } /// ArtifactType Type { get; } /// string? Description { get; } /// StreamId StreamId { get; } /// CommitIdWithOrder CommitId { get; } /// IReadOnlyList Keys { get; } /// IReadOnlyList Metadata { get; } /// NamespaceId NamespaceId { get; } /// RefName RefName { get; } /// /// Creates a writer for new artifact blobs /// IBlobWriter CreateBlobWriter(); /// /// Adds an alias to a given blob /// /// Alias for the blob /// Locator for the blob /// Rank for this alias. In situations where an alias has multiple mappings, the alias with the highest rank will be returned by default. /// Additional data to be stored inline with the alias /// Cancellation token for the operation Task AddAliasAsync(string name, IBlobRef handle, int rank = 0, ReadOnlyMemory data = default, CancellationToken cancellationToken = default); /// /// Finish writing the artifact data /// /// Root blob for the artifact /// Cancellation token for the operation /// The complete artifact Task CompleteAsync(IHashedBlobRef blobRef, CancellationToken cancellationToken = default); } }