forked from geffzhang/storage
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIKeyValueStorage.cs
More file actions
73 lines (65 loc) · 3.14 KB
/
IKeyValueStorage.cs
File metadata and controls
73 lines (65 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace Storage.Net.KeyValue
{
/// <summary>
/// Common interface for working with key-value storage
/// </summary>
public interface IKeyValueStorage : IDisposable
{
/// <summary>
/// Returns the list of all table names in the storage.
/// </summary>
/// <returns></returns>
Task<IReadOnlyCollection<string>> ListTableNamesAsync();
/// <summary>
/// Deletes entire table. If table doesn't exist no errors are raised.
/// </summary>
/// <param name="tableName">Name of the table to delete. Passing null raises <see cref="ArgumentNullException"/></param>
Task DeleteAsync(string tableName);
/// <summary>
/// Gets values by key
/// </summary>
/// <param name="tableName">Table name, required.</param>
/// <param name="key">Row key to look up against. The key must have partition key populated, however row key is optional.
/// When row key is not set, this method returns all of the values in a specifi</param>
/// <returns>
/// List of table values in the table's partition. This method never returns null and if no records
/// are found an empty collection is returned.
/// </returns>
Task<IReadOnlyCollection<Value>> GetAsync(string tableName, Key key);
/// <summary>
/// Inserts values in the table.
/// </summary>
/// <param name="tableName">Table name, required.</param>
/// <param name="values">values to insert, required. The values can belong to different partitions.</param>
/// <exception cref="StorageException">
/// If the row already exists thvalues this exception with <see cref="ErrorCode.DuplicateKey"/>.
/// Note that exception is thrown only for partiton batch. If values contains more than one partition to insert
/// some of them may succeed and some may fail.
/// </exception>
Task InsertAsync(string tableName, IReadOnlyCollection<Value> values);
/// <summary>
/// Inserts values in the table, and if they exist replaces them with a new value.
/// </summary>
/// <param name="tableName">Table name, required.</param>
/// <param name="values">values to insert, required. The values can belong to different partitions.</param>
/// <exception cref="StorageException">
/// If input values have duplicated keys thvalues this exception with <see cref="ErrorCode.DuplicateKey"/>
/// </exception>
Task InsertOrReplaceAsync(string tableName, IReadOnlyCollection<Value> values);
/// <summary>
/// Updates multiple values. Note that all the values must belong to the same partition.
/// </summary>
Task UpdateAsync(string tableName, IReadOnlyCollection<Value> values);
/// <summary>
/// Merges multiple values. Note that all values must belong to the same partition
/// </summary>
Task MergeAsync(string tableName, IReadOnlyCollection<Value> values);
/// <summary>
/// Deletes multiple values
/// </summary>
Task DeleteAsync(string tableName, IReadOnlyCollection<Key> rowIds);
}
}