Java Code Examples for com.google.cloud.storage.Blob#getUpdateTime()
The following examples show how to use
com.google.cloud.storage.Blob#getUpdateTime() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: GoogleCloudStorageSource.java From datacollector with Apache License 2.0 | 5 votes |
private boolean isBlobEligible(Blob blob, long minTimeStamp, String currentBlobGeneratedId, String currentFileOffset) { String blobName = blob.getName(); String prefixToMatch = blobName.substring( GcsUtil.normalizePrefix(gcsOriginConfig.commonPrefix).length(), blobName.length()); return blob.getSize() > 0 && //blob update time > current offset time (blob.getUpdateTime() > minTimeStamp //blob offset time = current offset time, but lexicographically greater than current offset || (blob.getUpdateTime() == minTimeStamp && blob.getGeneratedId().compareTo(currentBlobGeneratedId) > 0) //blob id same as current id and did not read till end of the file || blob.getGeneratedId().equals(currentBlobGeneratedId) && !END_FILE_OFFSET.equals(currentFileOffset)) && antPathMatcher.match(gcsOriginConfig.prefixPattern, prefixToMatch); }
Example 2
Source File: GcsPinotFS.java From incubator-pinot with Apache License 2.0 | 5 votes |
@Override public boolean touch(URI uri) throws IOException { try { Blob blob = getBlob(uri); long updateTime = blob.getUpdateTime(); storage.update(blob.toBuilder().setMetadata(blob.getMetadata()).build()); long newUpdateTime = getBlob(uri).getUpdateTime(); return newUpdateTime > updateTime; } catch (StorageException e) { throw new IOException(e); } }