Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Custom Part Metadata Decorator to ParallelCompositeUploadConfig #2434

Merged
merged 24 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Prev Previous commit
Next Next commit
lint
  • Loading branch information
sydney-munro committed Mar 15, 2024
commit 746b5815d78c6a79bedeb23bb53113f02b1bdac5
Original file line number Diff line number Diff line change
Expand Up @@ -704,7 +704,9 @@ private static final class CustomTimeInFuture extends PartMetadataFieldDecorator
@Override
PartMetadataFieldDecoratorInstance newInstance(Clock clock) {
return builder -> {
OffsetDateTime futureTime = OffsetDateTime.from(clock.instant().plus(duration).atZone(clock.getZone()).toOffsetDateTime());
OffsetDateTime futureTime =
OffsetDateTime.from(
clock.instant().plus(duration).atZone(clock.getZone()).toOffsetDateTime());
return builder.setCustomTimeOffsetDateTime(futureTime);
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,7 @@
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.rules.TestRule;
import org.junit.runner.Description;
import org.junit.runner.RunWith;
import org.junit.runners.model.Statement;

@RunWith(StorageITRunner.class)
@CrossRun(
Expand Down Expand Up @@ -116,7 +113,8 @@ public void setUp() throws Exception {
.withBufferAllocationStrategy(BufferAllocationStrategy.simple(_1MiB))
.withPartNamingStrategy(PartNamingStrategy.prefix("prefix-a"))
// Write customTime 30 seconds in the future
.withPartMetadataFieldDecorator(PartMetadataFieldDecorator.setCustomTimeInFuture(Duration.ofSeconds(30)))
.withPartMetadataFieldDecorator(
PartMetadataFieldDecorator.setCustomTimeInFuture(Duration.ofSeconds(30)))
// let our fixtures take care of cleaning things
.withPartCleanupStrategy(PartCleanupStrategy.never());

Expand Down Expand Up @@ -151,10 +149,7 @@ public static void afterClass() {
@Test
public void partFilesCreatedWithCustomTimeWritten() throws IOException {
doTest(bucket, 10 * _1MiB + 37, ImmutableList.of(), ImmutableList.of(), ImmutableList.of());
Page<Blob> blobs =
storage.list(
bucket.getName(),
Storage.BlobListOption.prefix("prefix-a"));
Page<Blob> blobs = storage.list(bucket.getName(), Storage.BlobListOption.prefix("prefix-a"));
for (Blob blob : blobs.iterateAll()) {
assertThat(blob.getCustomTimeOffsetDateTime()).isNotNull();
}
Expand Down