From d4f46b4fb6dfd2672a5205ec9de12050a940f56c Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Sun, 18 Jun 2023 07:03:47 +0200 Subject: Partial refactor --- MatrixRoomUtils.Core/Attributes/TraceAttribute.cs | 10 ++++++++++ MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs | 15 --------------- .../Interfaces/Services/IStorageProvider.cs | 17 +++++++++++++++++ MatrixRoomUtils.Core/Responses/StateEventResponse.cs | 2 +- MatrixRoomUtils.Core/Room.cs | 1 + MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs | 1 + MatrixRoomUtils.Core/Services/HomeserverService.cs | 8 ++++++++ MatrixRoomUtils.Core/Services/TieredStorageService.cs | 9 +++++++++ 8 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 MatrixRoomUtils.Core/Attributes/TraceAttribute.cs delete mode 100644 MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs create mode 100644 MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs create mode 100644 MatrixRoomUtils.Core/Services/HomeserverService.cs create mode 100644 MatrixRoomUtils.Core/Services/TieredStorageService.cs (limited to 'MatrixRoomUtils.Core') diff --git a/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs b/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs new file mode 100644 index 0000000..34a0b67 --- /dev/null +++ b/MatrixRoomUtils.Core/Attributes/TraceAttribute.cs @@ -0,0 +1,10 @@ +using System.Runtime.CompilerServices; + +namespace MatrixRoomUtils.Core.Attributes; + +[AttributeUsage(AttributeTargets.All)] +public class TraceAttribute : Attribute { + public TraceAttribute([CallerMemberName] string callerName = "") { + Console.WriteLine($"{callerName} called!"); + } +} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs deleted file mode 100644 index e1a066e..0000000 --- a/MatrixRoomUtils.Core/Interfaces/IStorageProvider.cs +++ /dev/null @@ -1,15 +0,0 @@ -public interface IStorageProvider { - // save - public async Task SaveAll() { - Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement Save()!"); - } - - public async Task SaveObject(string key, T value) { - Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveObject(key, value)!"); - } - - // delete - public async Task DeleteObject(string key) { - Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement DeleteObject(key)!"); - } -} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs new file mode 100644 index 0000000..2540ad7 --- /dev/null +++ b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs @@ -0,0 +1,17 @@ +namespace MatrixRoomUtils.Core.Interfaces.Services; + +public interface IStorageProvider { + // save + public async Task SaveAll() { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement Save()!"); + } + + public async Task SaveObject(string key, T value) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveObject(key, value)!"); + } + + // delete + public async Task DeleteObject(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement DeleteObject(key)!"); + } +} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs index 36f0a36..7b138e0 100644 --- a/MatrixRoomUtils.Core/Responses/StateEventResponse.cs +++ b/MatrixRoomUtils.Core/Responses/StateEventResponse.cs @@ -1,6 +1,6 @@ using System.Text.Json.Serialization; -namespace MatrixRoomUtils.Core; +namespace MatrixRoomUtils.Core.Responses; public class StateEventResponse : StateEvent { [JsonPropertyName("origin_server_ts")] diff --git a/MatrixRoomUtils.Core/Room.cs b/MatrixRoomUtils.Core/Room.cs index 2d6dc46..4f6bbca 100644 --- a/MatrixRoomUtils.Core/Room.cs +++ b/MatrixRoomUtils.Core/Room.cs @@ -3,6 +3,7 @@ using System.Text.Json; using System.Text.Json.Serialization; using System.Web; using MatrixRoomUtils.Core.Extensions; +using MatrixRoomUtils.Core.Responses; using MatrixRoomUtils.Core.RoomTypes; namespace MatrixRoomUtils.Core; diff --git a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs index e8d4823..7f634dc 100644 --- a/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs +++ b/MatrixRoomUtils.Core/RoomTypes/SpaceRoom.cs @@ -1,5 +1,6 @@ using System.Text.Json; using MatrixRoomUtils.Core.Extensions; +using MatrixRoomUtils.Core.Responses; namespace MatrixRoomUtils.Core.RoomTypes; diff --git a/MatrixRoomUtils.Core/Services/HomeserverService.cs b/MatrixRoomUtils.Core/Services/HomeserverService.cs new file mode 100644 index 0000000..ba48e6c --- /dev/null +++ b/MatrixRoomUtils.Core/Services/HomeserverService.cs @@ -0,0 +1,8 @@ +using MatrixRoomUtils.Core.Attributes; + +namespace MatrixRoomUtils.Core.Services; + +[Trace] +public class HomeserverService { + +} \ No newline at end of file diff --git a/MatrixRoomUtils.Core/Services/TieredStorageService.cs b/MatrixRoomUtils.Core/Services/TieredStorageService.cs new file mode 100644 index 0000000..f6beddd --- /dev/null +++ b/MatrixRoomUtils.Core/Services/TieredStorageService.cs @@ -0,0 +1,9 @@ +using MatrixRoomUtils.Core.Interfaces.Services; + +namespace MatrixRoomUtils.Core.Services; + +public class TieredStorageService { + public TieredStorageService(IStorageProvider cacheStorageProvider, IStorageProvider dataStorageProvider) { + + } +} \ No newline at end of file -- cgit 1.5.1