blob: baca95c67f16c453a765910131512768d5aa1469 (
plain)
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Tango.DataStore
{
/// <summary>
/// Represents a data store collection.
/// </summary>
public interface IDataStoreCollection
{
/// <summary>
/// Gets the collection name.
/// </summary>
String Name { get; }
/// <summary>
/// Upserts the specified key and value.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
void Put(String key, Object value);
/// <summary>
/// Upserts the specified key and value of type T.
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key">The key.</param>
/// <param name="value">The value.</param>
void Put<T>(String key, T value);
/// <summary>
/// Upserts the specified key and value.
/// The value must be of the specified DataType.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="type">The type.</param>
/// <param name="value">The value.</param>
void Put(String key, DataType type, Object value);
/// <summary>
/// Gets the value by the specified key
/// </summary>
/// <param name="key">The key.</param>
/// <returns></returns>
Object Get(String key);
/// <summary>
/// Gets the value by the specified key
/// </summary>
/// <param name="key">The key.</param>
/// <param name="defaultValue">Will execute put when the key was not found.</param>
/// <returns></returns>
Object Get(String key, Object defaultValue);
/// <summary>
/// Gets the value of type T by the specified key
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key">The key.</param>
/// <returns></returns>
T Get<T>(String key);
/// <summary>
/// Gets the value of type T by the specified key
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="key">The key.</param>
/// <param name="defaultValue">Will execute put when the key was not found.</param>
/// <returns></returns>
T Get<T>(String key, T defaultValue);
/// <summary>
/// Gets the full data store item by the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <returns></returns>
IDataStoreItem GetItem(String key);
/// <summary>
/// Gets the full data store item by the specified key.
/// </summary>
/// <param name="key">The key.</param>
/// <param name="defaultValue">Will execute put when the key was not found.</param>
/// <returns></returns>
IDataStoreItem GetItem(String key, Object defaultValue);
/// <summary>
/// Gets all the data store items in the collection.
/// </summary>
/// <returns></returns>
List<IDataStoreItem> GetAll();
/// <summary>
/// Gets all the data store unsynchronized items in the collection.
/// </summary>
/// <returns></returns>
List<IDataStoreItem> GetUnsynchronized();
/// <summary>
/// Deleted an item by the specified key.
/// </summary>
/// <param name="key">The key.</param>
void Delete(String key);
/// <summary>
/// Deletes all items in the collection.
/// </summary>
void DeleteAll();
/// <summary>
/// Returns the number of items in the collection.
/// </summary>
/// <returns></returns>
int Count();
}
}
|