-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbatch.proto
More file actions
77 lines (71 loc) · 2.45 KB
/
Copy pathbatch.proto
File metadata and controls
77 lines (71 loc) · 2.45 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
74
75
76
77
syntax = "proto3";
package protocol.batch.v1;
// AnyRequest is a generic message supporting any unary request.
message AnyRequest {
// The endpoint to which the request is being sent.
string endpoint = 1;
// The request data.
bytes request = 2;
}
// Used in `Batch` endpoint.
message BatchRequest {
// The list of requests to be executed in the batch.
repeated AnyRequest requests = 1;
}
// Used in `Batch` endpoint.
message BatchResponse {
// The list of responses to the requests.
repeated bytes responses = 1;
}
// Used in `BatchSame` endpoint.
message BatchSameRequest {
// The endpoint to call for all requests.
string endpoint = 1;
// The list of requests to be executed in the batch.
repeated bytes requests = 2;
}
// Used in `BatchSame` endpoint.
message BatchSameResponse {
// The list of responses to the requests.
repeated bytes responses = 1;
}
// Service to batch requests.
//
// Note that:
//
// - This does not support batching stream requests.
// - Responses will be returned in the order the requests were given.
// - If an error occurs, the endpoint will short-circuit and return
// an error.
//
// Not all endpoints can be batched. A list of endpoints that can be
// batched is given below:
//
// - Endpoints that do not modify data:
// - "protocol.profile.v1.ProfileService.GetProfile"
// - "protocol.chat.v1.ChatService.QueryHasPermission"
// - "protocol.chat.v1.ChatService.GetUserRoles"
// - "protocol.chat.v1.ChatService.GetGuildRoles"
// - "protocol.chat.v1.ChatService.GetGuild"
// - "protocol.chat.v1.ChatService.GetGuildChannels"
// - "protocol.chat.v1.ChatService.GetPermissions"
// - "protocol.chat.v1.ChatService.GetGuildMembers"
// - "protocol.mediaproxy.v1.MediaProxyService.FetchLinkMetadata"
// - "protocol.mediaproxy.v1.MediaProxyService.InstantView"
// - "protocol.mediaproxy.v1.MediaProxyService.CanInstantView"
service BatchService {
// Batch requests.
//
// Servers should limit the amount of requests that can be batched
// to 20.
rpc Batch(BatchRequest) returns (BatchResponse) {}
// Allows batching for requests using the same endpoint.
//
// This allows for additional network optimizations since the endpoint doesn't
// have to be sent for every request.
//
// Servers should limit the amount of requests that can be batched
// to 100 for endpoints that do not modify data, and 20 for endpoints
// that modify data.
rpc BatchSame(BatchSameRequest) returns (BatchSameResponse) {}
}