Skip to content

Commit 52531c8

Browse files
committed
changed the download manager to get around bucket access issue - needed to pass in storage class
Signed-off-by: Rocky Thind <harpender.t@swirldslabs.com>
1 parent 5b9fda4 commit 52531c8

File tree

1 file changed

+12
-4
lines changed
  • tools-and-tests/tools/src/main/java/org/hiero/block/tools/commands/days/subcommands

1 file changed

+12
-4
lines changed

tools-and-tests/tools/src/main/java/org/hiero/block/tools/commands/days/subcommands/DownloadLive.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
import java.util.regex.Pattern;
2525
import java.util.stream.Stream;
2626

27-
import org.hiero.block.tools.commands.days.download.DownloadConstants;
27+
import com.google.cloud.storage.Storage;
28+
import com.google.cloud.storage.StorageOptions;
2829
import org.hiero.block.tools.commands.days.download.DownloadDayUtil;
2930
import org.hiero.block.tools.commands.days.model.AddressBookRegistry;
3031
import org.hiero.block.tools.commands.mirrornode.BlockInfo;
@@ -36,11 +37,13 @@
3637
import org.hiero.block.tools.records.RecordFileInfo;
3738
import org.hiero.block.tools.utils.Gzip;
3839
import org.hiero.block.tools.utils.gcp.ConcurrentDownloadManager;
39-
import org.hiero.block.tools.utils.gcp.ConcurrentDownloadManagerTransferManager;
40+
import org.hiero.block.tools.utils.gcp.ConcurrentDownloadManagerVirtualThreads;
4041
import picocli.CommandLine;
4142
import picocli.CommandLine.Command;
4243
import picocli.CommandLine.Option;
4344

45+
import static org.hiero.block.tools.commands.days.download.DownloadConstants.GCP_PROJECT_ID;
46+
4447
/**
4548
* CLI implementation for the {@code days download-live} command.
4649
*
@@ -568,7 +571,7 @@ static final class LiveDownloader {
568571
private final int maxConcurrency;
569572
private final Path addressBookPath;
570573
private final AddressBookRegistry addressBookRegistry;
571-
private final ConcurrentDownloadManager downloadManager;
574+
private final ConcurrentDownloadManagerVirtualThreads downloadManager;
572575
// Running previous record-file hash used to validate the block hash chain across files.
573576
private byte[] previousRecordFileHash;
574577
// Single-threaded executor used for background compression of per-day tar files.
@@ -602,7 +605,12 @@ static final class LiveDownloader {
602605
// NOTE: if the actual ConcurrentDownloadManagerTransferManager constructor has a different signature,
603606
// adjust this
604607
// call to match its configuration factory used by the historic download2 tooling.
605-
this.downloadManager = new ConcurrentDownloadManagerTransferManager();
608+
Storage storage = StorageOptions.grpc()
609+
.setAttemptDirectPath(false)
610+
.setProjectId(GCP_PROJECT_ID)
611+
.build()
612+
.getService();
613+
this.downloadManager = ConcurrentDownloadManagerVirtualThreads.newBuilder(storage).build();
606614
this.compressionExecutor = Executors.newSingleThreadExecutor(r -> {
607615
Thread t = new Thread(r, "download-live-compress");
608616
t.setDaemon(true);

0 commit comments

Comments
 (0)