-
Notifications
You must be signed in to change notification settings - Fork 1
/
skizze.proto
181 lines (142 loc) · 4.02 KB
/
skizze.proto
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
syntax = "proto2";
package protobuf;
service Skizze {
rpc CreateSnapshot (CreateSnapshotRequest) returns (CreateSnapshotReply) {}
rpc GetSnapshot (GetSnapshotRequest) returns (GetSnapshotReply) {}
rpc List (ListRequest) returns (ListReply) {}
rpc ListAll (Empty) returns (ListReply) {}
rpc ListDomains (Empty) returns (ListDomainsReply) {}
rpc CreateDomain (Domain) returns (Domain) {}
rpc DeleteDomain (Domain) returns (Empty) {}
rpc GetDomain (Domain) returns (Domain) {}
rpc CreateSketch(Sketch) returns (Sketch) {}
rpc DeleteSketch(Sketch) returns (Empty) {}
rpc GetSketch(Sketch) returns (Sketch) {}
rpc Add (AddRequest) returns (AddReply) {}
rpc GetMembership (GetRequest) returns (GetMembershipReply) {}
rpc GetFrequency (GetRequest) returns (GetFrequencyReply) {}
rpc GetCardinality (GetRequest) returns (GetCardinalityReply) {}
rpc GetRankings (GetRequest) returns (GetRankingsReply) {}
}
//
// Enums
//
enum SketchType {
MEMB = 1;
FREQ = 2;
RANK = 3;
CARD = 4;
}
enum SnapshotStatus {
PENDING = 1;
IN_PROGRESS = 2;
SUCCESSFUL = 3;
FAILED = 4;
}
//
// Generic Structures
//
message Empty {
}
message SketchProperties {
optional int64 maxUniqueItems = 1; // MEMB, FREQ
optional float errorRate = 2; // MEMB, FREQ
optional int64 size = 3; // RANK
}
message SketchState {
optional float fillRate = 1; // 0.0 -> 1.0
optional int64 lastSnapshot = 2; // Age of last snapshot in seconds since epoch
}
// CreateDomain: name:required, propertiess:optional (array = nSketchTypes, order of types above)
// DeleteDomain: name:required
// GetDomain : name:required
message Domain {
required string name = 1;
repeated Sketch sketches = 2;
}
// CreateSketch: name:required, type:required, properties:optional
// DeleteSketch: name:required, type:required
// GetSketch : name:required, type:required
message Sketch {
required string name = 1;
required SketchType type = 2;
optional SketchProperties properties = 3;
optional SketchState state = 4;
}
message Membership {
required string value = 1;
required bool isMember = 2;
}
message Frequency {
required string value = 1;
required int64 count = 2;
}
message Rank {
required string value = 1;
required int64 count = 2;
}
//
// Request/Reply Envelopes
//
// Right now empty but in the future can request specific snapshot location
// (e.g. S3 or disk) and snapshot options
message CreateSnapshotRequest {
}
message CreateSnapshotReply {
required SnapshotStatus status = 1;
optional string statusMessage = 2;
}
// Empty for now, future can send in id of specific snapshot
message GetSnapshotRequest {
}
message GetSnapshotReply {
required SnapshotStatus status = 1;
optional string statusMessage = 2;
optional int64 timestamp = 3;
}
message ListRequest {
required SketchType type = 1;
}
message ListReply {
repeated Sketch sketches = 1;
}
message ListDomainsReply {
repeated string names = 1;
}
message AddRequest {
optional Domain domain = 1;
optional Sketch sketch = 2;
repeated string values = 3;
}
message AddReply {
}
// All Sketches will be of one kind
// All values will apply to all sketches (if card or ranking, values will be ignored)
message GetRequest {
repeated Sketch sketches = 1; // MEMB:users-20151214,MEMB:users-20151214
repeated string values = 2; // "gary","michelle","ray","harpindar" // Apply to all sketches above
}
message MembershipResult {
repeated Membership memberships = 1;
}
message FrequencyResult {
repeated Frequency frequencies = 2;
}
message CardinalityResult {
required int64 cardinality = 1;
}
message RankingsResult {
repeated Rank rankings = 1;
}
message GetMembershipReply {
repeated MembershipResult results = 1;
}
message GetFrequencyReply {
repeated FrequencyResult results = 1;
}
message GetCardinalityReply {
repeated CardinalityResult results = 1;
}
message GetRankingsReply {
repeated RankingsResult results = 1;
}