OLD | NEW |
| (Empty) |
1 // Copyright 2016 The LUCI Authors. All rights reserved. | |
2 // Use of this source code is governed under the Apache License, Version 2.0 | |
3 // that can be found in the LICENSE file. | |
4 | |
5 // This describes the interface a Swarming bot can use to contact an Isolate | |
6 // server over a gRPC proxy. It essentially duplicates the portions of the | |
7 // "native" Isolate REST API that's used by the bot. | |
8 // | |
9 // This proto is *not yet stable* and *will* change over time in non-backward- | |
10 // compatible ways. | |
11 | |
12 syntax = "proto3"; | |
13 | |
14 package luci.swarming.bot; | |
15 | |
16 // FileService exposes the main operations of an Isolate server | |
17 // to upload and download blobs. | |
18 service FileService { | |
19 // Unlike in the native Isolate API, it is not *necessary* to | |
20 // call Contains prior to pushing a blob, as Contains does not | |
21 // return "upload tickets." The BlobStatus returned by Contains | |
22 // will have succeeded = True if all digests were found, and | |
23 // false for any other reason (missing blobs, network error, | |
24 // etc.) | |
25 rpc Contains(ContainsRequest) returns (ContainsReply); | |
26 | |
27 // PushBlobs can push one or more blobs at a time (serially), | |
28 // with each blob transmitted as one or more chunks. At the | |
29 // beginning of a new blob, the chunk offset should be zero | |
30 // and the digest must be provided. The function returns true | |
31 // only if all blobs are successfully received, and returns | |
32 // as soon as an error occurs. | |
33 rpc PushBlobs(stream PushBlobsRequest) returns (PushBlobsReply); | |
34 | |
35 // FetchBlobs takes a list of digests and returns them all as | |
36 // a stream of BlobChunks. | |
37 rpc FetchBlobs(FetchBlobsRequest) returns (stream FetchBlobsReply); | |
38 } | |
39 | |
40 message ContainsRequest { | |
41 repeated ContentDigest digest = 1; | |
42 } | |
43 | |
44 message ContainsReply { | |
45 BlobStatus status = 1; | |
46 } | |
47 | |
48 message PushBlobsRequest { | |
49 BlobChunk data = 1; | |
50 } | |
51 | |
52 message PushBlobsReply { | |
53 BlobStatus status = 1; | |
54 } | |
55 | |
56 message FetchBlobsRequest { | |
57 repeated ContentDigest digest = 1; | |
58 } | |
59 | |
60 message FetchBlobsReply { | |
61 BlobStatus status = 1; | |
62 BlobChunk data = 2; | |
63 } | |
64 | |
65 message BlobChunk { | |
66 // The digest is optional for all chunks except | |
67 // the first that represents a blob. | |
68 ContentDigest digest = 1; | |
69 int64 offset = 2; | |
70 bytes data = 3; | |
71 } | |
72 | |
73 message ContentDigest { | |
74 // At present, "digest" is a 20-byte SHA1 hash. | |
75 bytes digest = 1; | |
76 | |
77 // size_bytes is the size of the blob during uploads. | |
78 // During requests to FetchBlobs, the size is ignored. | |
79 int64 size_bytes = 2; | |
80 | |
81 // Currently "0" to represents the SHA1 hash; may | |
82 // be incremented to allow other hash functions. | |
83 int32 version = 3; | |
84 } | |
85 | |
86 message BlobStatus { | |
87 // True if the entire function succeeded. | |
88 bool succeeded = 1; | |
89 | |
90 // "error" will be set to one of the following if succeeded is false. | |
91 enum ErrorCode { | |
92 // Typically an internal proxy error; error_detail may have more | |
93 // information. | |
94 UNKNOWN = 0; | |
95 | |
96 // The client behaved incorrectly. error_detail should have more | |
97 // information. | |
98 INVALID_ARGUMENT = 1; | |
99 | |
100 // Isolate is missing the nodes specified by missing_digest. | |
101 MISSING_DIGEST = 2; | |
102 | |
103 // Upload only error, when requested digest does not match the | |
104 // server side computed one. | |
105 DIGEST_MISMATCH = 3; | |
106 } | |
107 ErrorCode error = 2; | |
108 | |
109 // Human-readable error text | |
110 string error_detail = 3; | |
111 | |
112 // If error is MISSIN_DIGEST, this will be populated with the | |
113 // digests that are missing. | |
114 repeated ContentDigest missing_digest = 4; | |
115 } | |
116 | |
OLD | NEW |