-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Skip deleted blobs before BigQuery.Load from PubSub (#1263)
- Loading branch information
Showing
6 changed files
with
79 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...k/src/main/java/com/mozilla/telemetry/ingestion/sink/transform/BlobIdToPubsubMessage.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.mozilla.telemetry.ingestion.sink.transform; | ||
|
||
import com.google.cloud.storage.BlobId; | ||
import com.google.pubsub.v1.PubsubMessage; | ||
|
||
public class BlobIdToPubsubMessage { | ||
|
||
public static final String BUCKET = "bucket"; | ||
public static final String NAME = "name"; | ||
|
||
/** | ||
* Convert contents of a {@link BlobId} into a {@link PubsubMessage}. | ||
*/ | ||
public static PubsubMessage encode(BlobId blobId) { | ||
return PubsubMessage.newBuilder().putAttributes(BUCKET, blobId.getBucket()) | ||
.putAttributes(NAME, blobId.getName()).build(); | ||
} | ||
|
||
/** | ||
* Read the contents of a {@link PubsubMessage} into a {@link BlobId}. | ||
*/ | ||
public static BlobId decode(PubsubMessage message) { | ||
return BlobId.of(message.getAttributesOrThrow(BUCKET), message.getAttributesOrThrow(NAME)); | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
...src/main/java/com/mozilla/telemetry/ingestion/sink/transform/BlobInfoToPubsubMessage.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters