about summary refs log tree commit diff
path: root/LibMatrix/Interfaces/Services/IStorageProvider.cs
diff options
context:
space:
mode:
Diffstat (limited to 'LibMatrix/Interfaces/Services/IStorageProvider.cs')
-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