about summary refs log tree commit diff
path: root/LibMatrix/Interfaces
diff options
context:
space:
mode:
authorRory& <root@rory.gay>2024-08-23 02:55:07 +0200
committerRory& <root@rory.gay>2024-08-23 02:55:07 +0200
commitf50ed7ccc4347907d3c5ec6b68e1b84c4e0a7a0e (patch)
treed77d1d1f30e0ea01051561d8caaadeed2fdcf439 /LibMatrix/Interfaces
parentMinor cleanup (diff)
downloadLibMatrix-f50ed7ccc4347907d3c5ec6b68e1b84c4e0a7a0e.tar.xz
Synapse admin API stuff, a mass of other changes
Diffstat (limited to 'LibMatrix/Interfaces')
-rw-r--r--LibMatrix/Interfaces/Services/IStorageProvider.cs16
1 files changed, 15 insertions, 1 deletions
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<List<string>> GetAllKeysAsync() {
+    public Task<IEnumerable<string>> 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<object>(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