diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java index 7b7ffb15ab..5c1fe9c5b2 100644 --- a/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java +++ b/src/main/java/com/google/devtools/build/lib/buildeventstream/BuildEventArtifactUploader.java @@ -13,26 +13,32 @@ // limitations under the License. package com.google.devtools.build.lib.buildeventstream; +import com.google.common.util.concurrent.Futures; +import com.google.common.util.concurrent.ListenableFuture; import com.google.devtools.build.lib.buildeventstream.PathConverter.FileUriPathConverter; import com.google.devtools.build.lib.vfs.Path; -import java.io.IOException; import java.util.Set; /** Uploads artifacts referenced by the Build Event Protocol (BEP). */ public interface BuildEventArtifactUploader { - public static final BuildEventArtifactUploader LOCAL_FILES_UPLOADER = - new BuildEventArtifactUploader() { + BuildEventArtifactUploader LOCAL_FILES_UPLOADER = new BuildEventArtifactUploader() { + private final ListenableFuture<PathConverter> completedPathConverter = + Futures.immediateFuture(new FileUriPathConverter()); + @Override - public PathConverter upload(Set<Path> files) { - return new FileUriPathConverter(); + public ListenableFuture<PathConverter> upload(Set<Path> files) { + return completedPathConverter; } }; /** - * Uploads a set of files referenced by the protobuf representation of a {@link BuildEvent}. + * Asynchronously uploads a set of files referenced by the protobuf representation of a + * {@link BuildEvent}. This method is expected to return quickly. * - * <p>Returns a {@link PathConverter} that must provide a name for each uploaded file as it should - * appear in the BEP. + * <p>This method must not throw any exceptions. + * + * <p>Returns a future to a {@link PathConverter} that must provide a name for each uploaded file + * as it should appear in the BEP. */ - PathConverter upload(Set<Path> files) throws IOException, InterruptedException; + ListenableFuture<PathConverter> upload(Set<Path> files); } |