-
Notifications
You must be signed in to change notification settings - Fork 0
/
BTrDB.cs
190 lines (160 loc) · 5.47 KB
/
BTrDB.cs
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using Grpc.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BTrDB
{
public struct RawPoint
{
public long Time;
public double Value;
public RawPoint(long time, double value)
{
this.Time = time;
this.Value = value;
}
}
public struct StatPoint
{
public long Time;
public double Min;
public double Mean;
public double Max;
public double Count;
public double Stddev;
public StatPoint(long time, double min, double mean, double max, double count, double stddev)
{
this.Time = time;
this.Min = min;
this.Mean = mean;
this.Max = max;
this.Count = count;
this.Stddev = stddev;
}
}
public struct ChangedRange
{
public long Start;
public long End;
public ulong Version;
public ChangedRange(long start, long end, ulong version)
{
this.Start = start;
this.End = end;
this.Version = version;
}
}
public class Stream
{
private Guid id;
private BTrDB db;
internal Stream(Guid id, BTrDB db)
{
this.id = id;
this.db = db;
}
public bool Exists()
{
throw new NotImplementedException("not implemented");
}
public IEnumerable<RawPoint> RawValues(long start, long end, ulong version = BTrDB.LatestVersion)
{
throw new NotImplementedException("not implemented");
}
public IEnumerable<StatPoint> AlignedWindows(long start, long end, ushort pointWidth, ulong version = BTrDB.LatestVersion)
{
throw new NotImplementedException("not implemented");
}
public IEnumerable<StatPoint> Windows(long start, long end, ushort pointWidth, ulong version = BTrDB.LatestVersion)
{
throw new NotImplementedException("not implemented");
}
public string Collection(bool refresh = false)
{
throw new NotImplementedException("not implemented");
}
public Dictionary<string, string> Tags(bool refresh = false)
{
throw new NotImplementedException("not implemented");
}
public (Dictionary<string, string>, ulong) Annotations(bool refresh = false)
{
throw new NotImplementedException("not implemented");
}
public void SetStreamAnnotations(ulong expectedPropertyVersion, Dictionary<string, string> changes, string[] removals = null)
{
throw new NotImplementedException("not implemented");
}
public void SetStreamTags(ulong expectedPropertyVersion, Dictionary<string, string> changes, string[] removals = null, string newCollection = null)
{
throw new NotImplementedException("not implemented");
}
public (RawPoint, ulong, ulong) Nearest(long time, bool backward)
{
throw new NotImplementedException("not implemented");
}
public (IEnumerable<ChangedRange>, ulong, ulong) Changes(ulong fromVersion, ulong toVersion, ushort depth)
{
throw new NotImplementedException("not implemented");
}
public (ulong, ulong) Insert(IEnumerable<RawPoint> data)
{
throw new NotImplementedException("not implemented");
}
public (ulong, ulong) Delete(ulong start, ulong end)
{
throw new NotImplementedException("not implemented");
}
public (ulong, ulong) Flush()
{
throw new NotImplementedException("not implemented");
}
public void Obliterate()
{
throw new NotImplementedException("not implemented");
}
}
public class BTrDB
{
public const ulong LatestVersion = 0;
private Channel channel;
private V5Api.BTrDB.BTrDBClient client;
public BTrDB(string endpoint)
:this(endpoint, "")
{
}
public BTrDB(string endpoint, string apikey)
{
SslCredentials systemCAs = new SslCredentials();
this.channel = new Channel(endpoint, systemCAs);
this.client = new V5Api.BTrDB.BTrDBClient(this.channel);
}
public IEnumerable<Stream> LookupStreams(string collection, Dictionary<string, string> tags, Dictionary<string, string> annotations, bool isCollectionPrefix = true)
{
throw new NotImplementedException("not implemented");
}
public Stream StreamFromGuid(Guid id)
{
return new Stream(id, this);
}
public Stream CreateStream(Guid id, string collection, Dictionary<string, string> tags, Dictionary<string, string> annotations)
{
throw new NotImplementedException("not implemented");
}
public IEnumerable<string> ListCollections(string prefix = "")
{
throw new NotImplementedException("not implemented");
}
public string Info()
{
V5Api.InfoResponse resp = client.Info(new V5Api.InfoParams());
return resp.Build;
}
public IEnumerable<Dictionary<string, dynamic>> SQLQuery(string query, params dynamic[] args)
{
throw new NotImplementedException("not implemented");
}
}
}