From 1f585258163a9ec1ae44c33c6169a155bf188c97 Mon Sep 17 00:00:00 2001 From: Cardidi Date: Sat, 15 Mar 2025 21:30:15 +0800 Subject: [PATCH] Simplify API --- Flawless.Abstraction/Author.cs | 1 + Flawless.Abstraction/IDepotConnection.cs | 14 -------------- Flawless.Abstraction/IDepotLabel.cs | 2 +- Flawless.Abstraction/IDepotStorage.cs | 9 --------- Flawless.Abstraction/IOccupationChart.cs | 9 --------- Flawless.Abstraction/IReadonlyRepository.cs | 6 ------ Flawless.Abstraction/IRepository.cs | 14 -------------- Flawless.Abstraction/IWorkspace.cs | 9 --------- Flawless.Abstraction/RepositoryCommit.cs | 5 +++++ 9 files changed, 7 insertions(+), 62 deletions(-) delete mode 100644 Flawless.Abstraction/IDepotConnection.cs delete mode 100644 Flawless.Abstraction/IDepotStorage.cs delete mode 100644 Flawless.Abstraction/IOccupationChart.cs delete mode 100644 Flawless.Abstraction/IWorkspace.cs diff --git a/Flawless.Abstraction/Author.cs b/Flawless.Abstraction/Author.cs index 8052cbb..013c87a 100644 --- a/Flawless.Abstraction/Author.cs +++ b/Flawless.Abstraction/Author.cs @@ -3,6 +3,7 @@ /// /// An author setup to indicate who create a depot or identify a depot author when uploading it. /// +[Serializable] public readonly struct Author : IEquatable { public readonly string Name; diff --git a/Flawless.Abstraction/IDepotConnection.cs b/Flawless.Abstraction/IDepotConnection.cs deleted file mode 100644 index 64cd7a3..0000000 --- a/Flawless.Abstraction/IDepotConnection.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Flawless.Abstraction; - -/// -/// Standardized interface for depot to represent a depot inner data handles. -/// -public interface IDepotConnection : IDisposable - -{ - public IReadonlyRepository Repository { get; } - - public IDepotLabel Label { get; } - - public IDepotStorage Storage { get; } -} \ No newline at end of file diff --git a/Flawless.Abstraction/IDepotLabel.cs b/Flawless.Abstraction/IDepotLabel.cs index 106ce1d..9e97c76 100644 --- a/Flawless.Abstraction/IDepotLabel.cs +++ b/Flawless.Abstraction/IDepotLabel.cs @@ -7,5 +7,5 @@ public interface IDepotLabel { public abstract HashId Id { get; } - public IEnumerable Dependencies { get; } + public abstract IEnumerable Dependencies { get; } } \ No newline at end of file diff --git a/Flawless.Abstraction/IDepotStorage.cs b/Flawless.Abstraction/IDepotStorage.cs deleted file mode 100644 index 0e90309..0000000 --- a/Flawless.Abstraction/IDepotStorage.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Flawless.Abstraction; - -/// -/// Standardized interface to translate a depot to binary stream which also provides a stream lifetime management. -/// -public interface IDepotStorage -{ - -} \ No newline at end of file diff --git a/Flawless.Abstraction/IOccupationChart.cs b/Flawless.Abstraction/IOccupationChart.cs deleted file mode 100644 index 150250c..0000000 --- a/Flawless.Abstraction/IOccupationChart.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Flawless.Abstraction; - -/// -/// Standard interface for repository to store file/directory lock info in this repository. -/// -public interface IOccupationChart -{ - -} \ No newline at end of file diff --git a/Flawless.Abstraction/IReadonlyRepository.cs b/Flawless.Abstraction/IReadonlyRepository.cs index 7b1fe1f..3bcc7fa 100644 --- a/Flawless.Abstraction/IReadonlyRepository.cs +++ b/Flawless.Abstraction/IReadonlyRepository.cs @@ -7,16 +7,10 @@ public interface IReadonlyRepository { public bool IsReadonly { get; } - - public uint GetLatestCommitId(); - public IEnumerable GetCommits(); public RepositoryCommit? GetCommitById(uint commitId); - - public Task GetLatestCommitIdAsync(CancellationToken cancellationToken = default); - public IAsyncEnumerable GetCommitsAsync(CancellationToken cancellationToken = default); public Task GetCommitByIdAsync(uint commitId, CancellationToken cancellationToken = default); diff --git a/Flawless.Abstraction/IRepository.cs b/Flawless.Abstraction/IRepository.cs index 54a4150..9b139b8 100644 --- a/Flawless.Abstraction/IRepository.cs +++ b/Flawless.Abstraction/IRepository.cs @@ -5,21 +5,7 @@ /// 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 SubmitWorkspaceAsync(CancellationToken cancellationToken = default); - - public Task SyncOccupationChartAsync(CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/Flawless.Abstraction/IWorkspace.cs b/Flawless.Abstraction/IWorkspace.cs deleted file mode 100644 index 102b04a..0000000 --- a/Flawless.Abstraction/IWorkspace.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Flawless.Abstraction; - -/// -/// Standardized interface for repository working area (Which means those changes are not committed yet. -/// -public interface IWorkspace -{ - public string Message { get; set; } -} \ No newline at end of file diff --git a/Flawless.Abstraction/RepositoryCommit.cs b/Flawless.Abstraction/RepositoryCommit.cs index 9d9653c..68cc7b4 100644 --- a/Flawless.Abstraction/RepositoryCommit.cs +++ b/Flawless.Abstraction/RepositoryCommit.cs @@ -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(); + } \ No newline at end of file