aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main
diff options
context:
space:
mode:
authorGravatar Ola Rozenfeld <olaola@google.com>2016-09-15 13:50:57 +0000
committerGravatar Dmitry Lomov <dslomov@google.com>2016-09-15 15:43:07 +0000
commitb276a722c4975578a249eb1b7908324f979544e0 (patch)
tree2850a138159353b9ca5a7512b8334aed1790554e /src/main
parentcd708c3e68256ada53ed2a477a66621aad106e0d (diff)
Cosmetic changes to the remote execution proto, and fixing a minor bug in
ContentDigests function. -- MOS_MIGRATED_REVID=133256094
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/com/google/devtools/build/lib/remote/ContentDigests.java14
-rw-r--r--src/main/protobuf/remote_protocol.proto30
2 files changed, 30 insertions, 14 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/remote/ContentDigests.java b/src/main/java/com/google/devtools/build/lib/remote/ContentDigests.java
index b9a653a125..2a7b794201 100644
--- a/src/main/java/com/google/devtools/build/lib/remote/ContentDigests.java
+++ b/src/main/java/com/google/devtools/build/lib/remote/ContentDigests.java
@@ -41,17 +41,15 @@ public final class ContentDigests {
/**
* Computes a digest of the given proto message. Currently, we simply rely on message output as
* bytes, but this implementation relies on the stability of the proto encoding, in particular
- * between different platforms and languages.
- * TODO(olaola): upgrade to a better implementation!
+ * between different platforms and languages. TODO(olaola): upgrade to a better implementation!
*/
public static ContentDigest computeDigest(Message message) {
return computeDigest(message.toByteArray());
}
/**
- * A special type of ContentDigest that is used only as a remote action cache key.
- * This is a separate type in order to prevent accidentally using other ContentDigests
- * as action keys.
+ * A special type of ContentDigest that is used only as a remote action cache key. This is a
+ * separate type in order to prevent accidentally using other ContentDigests as action keys.
*/
public static final class ActionKey {
private final ContentDigest digest;
@@ -68,7 +66,7 @@ public final class ContentDigests {
public static ActionKey computeActionKey(Action action) {
return new ActionKey(computeDigest(action));
}
-
+
public static ContentDigest buildDigest(byte[] digest, long size) {
ContentDigest.Builder b = ContentDigest.newBuilder();
b.setDigest(ByteString.copyFrom(digest)).setSizeBytes(size);
@@ -76,7 +74,9 @@ public final class ContentDigests {
}
public static String toHexString(ContentDigest digest) {
- return HashCode.fromBytes(digest.getDigest().toByteArray()).toString();
+ return digest.getSizeBytes() > 0
+ ? HashCode.fromBytes(digest.getDigest().toByteArray()).toString()
+ : "";
}
public static String toString(ContentDigest digest) {
diff --git a/src/main/protobuf/remote_protocol.proto b/src/main/protobuf/remote_protocol.proto
index a6bf95fad8..a9dd6a9ed1 100644
--- a/src/main/protobuf/remote_protocol.proto
+++ b/src/main/protobuf/remote_protocol.proto
@@ -110,10 +110,12 @@ message CasStatus {
bool cache_hit = 2; // Cache hit or not on download requests.
enum ErrorCode {
UNKNOWN = 0;
- MISSING_DIGEST = 1; // Missing a node on tree download.
- DIGEST_MISMATCH = 2; // Upload only error, when requested digest does not
+ INVALID_ARGUMENT = 1; // The client behaved incorrectly. error_detail should
+ // have more information.
+ MISSING_DIGEST = 2; // Missing a node on tree download.
+ DIGEST_MISMATCH = 3; // Upload only error, when requested digest does not
// match the server side computed one.
- NODE_PARSE_ERROR = 3; // Failed to parse digested data as node.
+ NODE_PARSE_ERROR = 4; // Failed to parse digested data as node.
// more errors...
}
ErrorCode error = 3;
@@ -213,6 +215,10 @@ message CasDownloadBlobRequest {
service ExecutionCacheService {
// Gets results of a cached action.
rpc GetCachedResult(ExecutionCacheRequest) returns (ExecutionCacheReply) { }
+ // Set results of a cached action. This requires reproducible builds on
+ // connected machines!
+ rpc SetCachedResult(ExecutionCacheSetRequest) returns
+ (ExecutionCacheSetReply) {}
}
message ExecutionCacheRequest {
@@ -234,6 +240,15 @@ message ExecutionCacheReply {
ActionResult result = 2;
}
+message ExecutionCacheSetRequest {
+ ContentDigest action_digest = 1;
+ ActionResult result = 2;
+}
+
+message ExecutionCacheSetReply {
+ ExecutionCacheStatus status = 1;
+}
+
service ExecuteService {
// Executes an action remotely.
rpc Execute(ExecuteRequest) returns (stream ExecuteReply) { }
@@ -250,7 +265,7 @@ message ExecuteRequest {
int64 total_input_file_bytes = 4;
// Used for monitoring and scheduling.
BuildInfo build_info = 5;
- // Timeout seconds for running this action.
+ // Timeout milliseconds for running this action.
int64 timeout_millis = 6; // Maybe add io_timeout as well, per
// Marc Antoine's suggestion.
// Add other fields such as required cores, RAM, etc, that affect scheduling,
@@ -287,9 +302,10 @@ message ExecutionStatus {
bool succeeded = 2; // Whether the action succeeded.
enum ErrorCode {
UNKNOWN_ERROR = 0;
- MISSING_INPUT = 1; // Missing one of the inputs in CAS.
- DEADLINE_EXCEEDED = 2;
- EXEC_FAILED = 3; // Action returned non-zero.
+ MISSING_COMMAND = 1; // Missing command digest in CAS.
+ MISSING_INPUT = 2; // Missing one of the inputs in CAS.
+ DEADLINE_EXCEEDED = 3;
+ EXEC_FAILED = 4; // Action returned non-zero.
// Other server errors. Some of these errors are client-retriable, and some
// not; will have to comment clearly what will happen on each error.
}