From ed2205972a7b7d6fdd4563c3775a83616920597a Mon Sep 17 00:00:00 2001 From: TheArcaneBrony Date: Mon, 19 Jun 2023 02:36:32 +0200 Subject: Working sync --- MatrixRoomUtils.Core/Interfaces/IHomeServer.cs | 2 +- .../Interfaces/Services/IStorageProvider.cs | 39 +++++++++++++++++++--- 2 files changed, 35 insertions(+), 6 deletions(-) (limited to 'MatrixRoomUtils.Core/Interfaces') diff --git a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs index a808c3d..c5645e6 100644 --- a/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs +++ b/MatrixRoomUtils.Core/Interfaces/IHomeServer.cs @@ -10,7 +10,7 @@ public class IHomeServer { public string HomeServerDomain { get; set; } public string FullHomeServerDomain { get; set; } - private protected MatrixHttpClient _httpClient { get; set; } = new(); + protected internal MatrixHttpClient _httpClient { get; set; } = new(); public async Task ResolveHomeserverFromWellKnown(string homeserver) { var res = await _resolveHomeserverFromWellKnown(homeserver); diff --git a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs index 2540ad7..01314da 100644 --- a/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs +++ b/MatrixRoomUtils.Core/Interfaces/Services/IStorageProvider.cs @@ -1,17 +1,46 @@ namespace MatrixRoomUtils.Core.Interfaces.Services; public interface IStorageProvider { - // save - public async Task SaveAll() { - Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement Save()!"); + // save all children of a type with reflection + public Task SaveAllChildren(string key, T value) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveAllChildren(key, value)!"); + return Task.CompletedTask; } + + // load all children of a type with reflection + public Task LoadAllChildren(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadAllChildren(key)!"); + return Task.FromResult(default(T)); + } + - public async Task SaveObject(string key, T value) { + public Task SaveObject(string key, T value) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement SaveObject(key, value)!"); + return Task.CompletedTask; + } + + // load + public Task LoadObject(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadObject(key)!"); + return Task.FromResult(default(T)); + } + + // check if exists + public Task ObjectExists(string key) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement ObjectExists(key)!"); + return Task.FromResult(false); + } + + // get all keys + public Task> GetAllKeys() { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement GetAllKeys()!"); + return Task.FromResult(new List()); } + // delete - public async Task DeleteObject(string key) { + public Task DeleteObject(string key) { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement DeleteObject(key)!"); + return Task.CompletedTask; } } \ No newline at end of file -- cgit 1.5.1