-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathlog_io.proto
225 lines (203 loc) · 7.81 KB
/
log_io.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
syntax = "proto3";
package varlog.snpb;
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "google/protobuf/empty.proto";
import "varlogpb/metadata.proto";
import "snpb/metadata.proto";
option go_package = "github.com/kakao/varlog/proto/snpb";
option (gogoproto.protosizer_all) = true;
option (gogoproto.marshaler_all) = true;
option (gogoproto.unmarshaler_all) = true;
option (gogoproto.goproto_unkeyed_all) = false;
option (gogoproto.goproto_unrecognized_all) = false;
option (gogoproto.goproto_sizecache_all) = false;
// AppendRequest is a message to send a payload to a storage node. It contains
// a vector of storage nodes to replicate the payload.
message AppendRequest {
option (gogoproto.equal) = true;
option (gogoproto.populate) = true;
option (gogoproto.testgen) = true;
int32 topic_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
repeated bytes payload = 3;
}
message AppendResult {
varlogpb.LogEntryMeta meta = 1 [(gogoproto.nullable) = false];
string error = 2;
}
// AppendResponse is a response message of Append RPC.
message AppendResponse {
repeated AppendResult results = 1 [(gogoproto.nullable) = false];
}
// ReadRequest asks a storage node to retrieve log entry at the GLSN.
message ReadRequest {
uint64 glsn = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSN"
];
int32 topic_id = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 3 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
}
// ReadResponse contains the contents of the log entry which is retrieved by
// the ReadRequest.
message ReadResponse {
uint64 glsn = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSN"
];
uint64 llsn = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LLSN",
(gogoproto.customname) = "LLSN"
];
bytes payload = 3;
}
// SubscribeRequest has GLSN which indicates an inclusive starting position
// from which a client wants to receive.
message SubscribeRequest {
uint64 glsn_begin = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSNBegin"
];
uint64 glsn_end = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSNEnd"
];
int32 topic_id = 3 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 4 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
}
// SubscribeResponse comprises the contents of the log entry and its GLSN.
message SubscribeResponse {
uint64 glsn = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSN"
];
uint64 llsn = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LLSN",
(gogoproto.customname) = "LLSN"
];
bytes payload = 3;
}
message SubscribeToRequest {
int32 topic_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
uint64 llsn_begin = 3 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LLSN",
(gogoproto.customname) = "LLSNBegin"
];
uint64 llsn_end = 4 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LLSN",
(gogoproto.customname) = "LLSNEnd"
];
}
message SubscribeToResponse {
varlogpb.LogEntry log_entry = 1 [(gogoproto.nullable) = false];
}
// TrimRequest contains inclusive GLSN until which a client wants to delete.
// If async field is true, the trim operation returns immediately and the
// storage node removes its log entry in the background.
message TrimDeprecatedRequest {
int32 topic_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
uint64 glsn = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.GLSN",
(gogoproto.customname) = "GLSN"
];
}
message LogStreamMetadataRequest {
int32 topic_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
}
message LogStreamMetadataResponse {
varlogpb.LogStreamDescriptor log_stream_descriptor = 1
[(gogoproto.nullable) = false];
}
message LogStreamReplicaMetadataRequest {
int32 topic_id = 1 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.TopicID",
(gogoproto.customname) = "TopicID"
];
int32 log_stream_id = 2 [
(gogoproto.casttype) = "github.com/kakao/varlog/pkg/types.LogStreamID",
(gogoproto.customname) = "LogStreamID"
];
}
message LogStreamReplicaMetadataResponse {
LogStreamReplicaMetadataDescriptor log_stream_replica = 1
[(gogoproto.nullable) = false];
}
service LogIO {
// Append stores a list of log entries to the end of the log stream
// specified by AppendRequest. The log entries are appended partially; that
// is, some of the log entries could not be stored due to failures.
//
// It returns the following gRPC errors:
// - InvalidArgument: AppendRequest has invalid fields; for instance, TopicID
// is invalid.
// - NotFound: The log stream replica specified by the AppendRequest does not
// exist in the storage node. Note that it does not mean that the log stream
// does not exist in the cluster.
// - FailedPrecondition: The log stream may be sealed; thus, clients cannot
// write the log entry. Clients should unseal the log stream to append a log
// entry to the log stream.
// - Unavailable: The storage node is shutting down, or the log stream replica
// is not primary.
// - Canceled: The client canceled the request.
// - DeadlineExceeded: The client's timeout has expired.
//
// FIXME: Partial failures are not specified by the gRPC error codes.
rpc Append(stream AppendRequest) returns (stream AppendResponse) {}
// Read reads a log entry from the log stream specified by ReadRequest.
// Deprecated: Use Subscribe or SubscribeTo.
rpc Read(ReadRequest) returns (ReadResponse) {}
// Subscribe reads a range of log entries specified by SubscribeRequest.
//
// It returns the following gRPC errors:
// - NotFound: The log stream replica specified by the SubscribeRequest does
// not exist in the storage node. Note that it does not mean that the log
// stream does not exist in the cluster.
// - Unavailable: The storage node is shutting down.
// - InvalidArgument: The range is invalid; for example, the beginning of the
// range is greater than or equal to the end.
// - OutOfRange: The parts or whole range are already trimmed.
rpc Subscribe(SubscribeRequest) returns (stream SubscribeResponse) {}
// SubscribeTo is similar to Subscribe except that it specifies the range with
// LLSN.
rpc SubscribeTo(SubscribeToRequest) returns (stream SubscribeToResponse) {}
rpc TrimDeprecated(TrimDeprecatedRequest) returns (google.protobuf.Empty) {}
// LogStreamReplicaMetadata returns metadata of the log stream replica
// specified by the LogStreamReplicaMetadataRequest.
rpc LogStreamReplicaMetadata(LogStreamReplicaMetadataRequest)
returns (LogStreamReplicaMetadataResponse) {}
}