1
0

Simplify API

This commit is contained in:
Ca2didi 2025-03-15 21:30:15 +08:00
parent d766aacecc
commit 1f58525816
9 changed files with 7 additions and 62 deletions

View File

@ -3,6 +3,7 @@
/// <summary>
/// An author setup to indicate who create a depot or identify a depot author when uploading it.
/// </summary>
[Serializable]
public readonly struct Author : IEquatable<Author>
{
public readonly string Name;

View File

@ -1,14 +0,0 @@
namespace Flawless.Abstraction;
/// <summary>
/// Standardized interface for depot to represent a depot inner data handles.
/// </summary>
public interface IDepotConnection : IDisposable
{
public IReadonlyRepository Repository { get; }
public IDepotLabel Label { get; }
public IDepotStorage Storage { get; }
}

View File

@ -7,5 +7,5 @@ public interface IDepotLabel
{
public abstract HashId Id { get; }
public IEnumerable<HashId> Dependencies { get; }
public abstract IEnumerable<HashId> Dependencies { get; }
}

View File

@ -1,9 +0,0 @@
namespace Flawless.Abstraction;
/// <summary>
/// Standardized interface to translate a depot to binary stream which also provides a stream lifetime management.
/// </summary>
public interface IDepotStorage
{
}

View File

@ -1,9 +0,0 @@
namespace Flawless.Abstraction;
/// <summary>
/// Standard interface for repository to store file/directory lock info in this repository.
/// </summary>
public interface IOccupationChart
{
}

View File

@ -7,16 +7,10 @@ public interface IReadonlyRepository
{
public bool IsReadonly { get; }
public uint GetLatestCommitId();
public IEnumerable<RepositoryCommit> GetCommits();
public RepositoryCommit? GetCommitById(uint commitId);
public Task<uint> GetLatestCommitIdAsync(CancellationToken cancellationToken = default);
public IAsyncEnumerable<RepositoryCommit> GetCommitsAsync(CancellationToken cancellationToken = default);
public Task<RepositoryCommit?> GetCommitByIdAsync(uint commitId, CancellationToken cancellationToken = default);

View File

@ -5,21 +5,7 @@
/// </summary>
public interface IRepository : IReadonlyRepository
{
public IWorkspace Workspace { get; }
public IOccupationChart OccupationChart { get; }
public uint GetActiveCommitId();
public RepositoryCommit SubmitWorkspace();
public void SyncOccupationChart();
public Task GetActiveCommitIdAsync(CancellationToken cancellationToken = default);
public Task<RepositoryCommit> SubmitWorkspaceAsync(CancellationToken cancellationToken = default);
public Task SyncOccupationChartAsync(CancellationToken cancellationToken = default);
}

View File

@ -1,9 +0,0 @@
namespace Flawless.Abstraction;
/// <summary>
/// Standardized interface for repository working area (Which means those changes are not committed yet.
/// </summary>
public interface IWorkspace
{
public string Message { get; set; }
}

View File

@ -13,4 +13,9 @@ public abstract class RepositoryCommit
public abstract string Message { get; }
public abstract IDepotLabel Depot { get; }
public abstract RepositoryCommit? GetParentCommit();
public abstract RepositoryCommit? GetChildCommit();
}