aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java
diff options
context:
space:
mode:
authorGravatar Klaus Aehlig <aehlig@google.com>2016-09-28 12:13:17 +0000
committerGravatar Yun Peng <pcloudy@google.com>2016-09-28 14:01:14 +0000
commitf009901a502fd7d45ee79c53612cad54ed3ecb9b (patch)
treeb2bd04732e4703f1061c534e08a90c39599c544a /src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java
parentbbab9ed571129201763e0f1175920c5a7df98284 (diff)
Add interfaces for the build event protocol
Bazel in the will provide a machine-readable stream of important build events. These interfaces set up the framework and expectations about the produced events and the entities distributing those events. -- Change-Id: If2c3b2e11c31b0136b57eadeef2d2f8f8fe5e2e7 Reviewed-on: https://bazel-review.googlesource.com/#/c/6272 MOS_MIGRATED_REVID=134522369
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java')
-rw-r--r--src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java
new file mode 100644
index 0000000000..3fdf22c3ba
--- /dev/null
+++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/ChainableEvent.java
@@ -0,0 +1,50 @@
+// Copyright 2016 The Bazel Authors. All rights reserved.
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.devtools.build.lib.buildeventstream;
+
+import java.util.Collection;
+
+/**
+ * Interface for objects organised in a DAG-like fashion.
+ *
+ * <p>When objects that are naturally organised in a directed acyclic graph are sent sequentially
+ * over some channel, the graph-structure needs to represented in some way. We chose the
+ * representation that each node knows its immediate sucessor nodes (rather than its predecessors)
+ * to suit the * properties of the event stream: new parents of a node might be discovered late,
+ * e.g., if a test suite is only expanded after one of its tests is already finished as it was also
+ * needed for another target.
+ */
+public interface ChainableEvent {
+
+ /**
+ * Provide the identifier of the event.
+ *
+ * <p>Event identifiers have to be unique within the set of events belonging to the same build
+ * invocation.
+ */
+ BuildEventId getEventId();
+
+ /**
+ * Provide the children of the event.
+ *
+ * <p>It is a requirement of a well-formed event stream that for every event that does not
+ * indicate the beginning of a new build, at least one parent be present before the event itself.
+ * However, more parents might appear later in the stream (e.g., if a test suite expanded later
+ * discovers that a test that is already completed belongs to it).
+ *
+ * <p>A build-event stream is finished if and only if all announced children have occurred.
+ */
+ Collection<BuildEventId> getChildrenEvents();
+}