From f50ed7ccc4347907d3c5ec6b68e1b84c4e0a7a0e Mon Sep 17 00:00:00 2001 From: Rory& Date: Fri, 23 Aug 2024 02:55:07 +0200 Subject: Synapse admin API stuff, a mass of other changes --- LibMatrix/Interfaces/Services/IStorageProvider.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'LibMatrix/Interfaces/Services/IStorageProvider.cs') diff --git a/LibMatrix/Interfaces/Services/IStorageProvider.cs b/LibMatrix/Interfaces/Services/IStorageProvider.cs index 165e7df..fb7bb6d 100644 --- a/LibMatrix/Interfaces/Services/IStorageProvider.cs +++ b/LibMatrix/Interfaces/Services/IStorageProvider.cs @@ -31,7 +31,7 @@ public interface IStorageProvider { } // get all keys - public Task> GetAllKeysAsync() { + public Task> GetAllKeysAsync() { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement GetAllKeys()!"); throw new NotImplementedException(); } @@ -53,4 +53,18 @@ public interface IStorageProvider { Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement LoadStream(key)!"); throw new NotImplementedException(); } + + // copy + public async Task CopyObjectAsync(string sourceKey, string destKey) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement CopyObject(sourceKey, destKey), using load + save!"); + var data = await LoadObjectAsync(sourceKey); + await SaveObjectAsync(destKey, data); + } + + // move + public async Task MoveObjectAsync(string sourceKey, string destKey) { + Console.WriteLine($"StorageProvider<{GetType().Name}> does not implement MoveObject(sourceKey, destKey), using copy + delete!"); + await CopyObjectAsync(sourceKey, destKey); + await DeleteObjectAsync(sourceKey); + } } \ No newline at end of file -- cgit 1.4.1