@@ -27,6 +27,7 @@ public class OptOutCloudSync implements ICloudSync {
2727 private static final Logger LOGGER = LoggerFactory .getLogger (OptOutCloudSync .class );
2828
2929 private final boolean fullSync ;
30+ private final boolean uploadOnly ;
3031 private final String cloudFolder ;
3132 private final String deltaConsumerDir ;
3233 private final String partitionConsumerDir ;
@@ -48,7 +49,12 @@ public class OptOutCloudSync implements ICloudSync {
4849 private AtomicReference <List <Consumer <Collection <String >>>> handlersNewCloudPaths = new AtomicReference <>(new ArrayList <>());
4950
5051 public OptOutCloudSync (JsonObject jsonConfig , boolean fullSync ) {
52+ this (jsonConfig , fullSync , false );
53+ }
54+
55+ public OptOutCloudSync (JsonObject jsonConfig , boolean fullSync , boolean uploadOnly ) {
5156 this .fullSync = fullSync ;
57+ this .uploadOnly = uploadOnly ;
5258 this .cloudFolder = CloudUtils .normalizDirPath (jsonConfig .getString (Const .Config .OptOutS3FolderProp ));
5359 this .deltaConsumerDir = OptOutUtils .getDeltaConsumerDir (jsonConfig );
5460 this .partitionConsumerDir = OptOutUtils .getPartitionConsumerDir (jsonConfig );
@@ -84,6 +90,19 @@ public OptOutCloudSync(JsonObject jsonConfig, boolean fullSync) {
8490 this .mkdirsBlocking ();
8591 }
8692
93+ /**
94+ * Creates an upload-only OptOutCloudSync instance.
95+ * This skips all download/refresh operations.
96+ */
97+ public static OptOutCloudSync createUploadOnly (JsonObject jsonConfig , boolean fullSync ) {
98+ return new OptOutCloudSync (jsonConfig , fullSync , true );
99+ }
100+
101+ @ Override
102+ public boolean isUploadOnly () {
103+ return this .uploadOnly ;
104+ }
105+
87106 @ Override
88107 public String toCloudPath (String path ) {
89108 if (OptOutUtils .isDeltaFile (path )) {
@@ -121,6 +140,11 @@ public String toLocalPath(String path) {
121140
122141 @ Override
123142 public boolean refresh (Instant now , ICloudStorage fsCloud , ICloudStorage fsLocal , Consumer <Set <String >> handleDownloads , Consumer <Set <String >> handleDeletes ) throws CloudStorageException {
143+ // In upload-only mode, skip all download/sync operations
144+ if (uploadOnly ) {
145+ return true ;
146+ }
147+
124148 // list local cached paths
125149 List <String > cachedPathList = new ArrayList <>();
126150 localListFiles (fsLocal , this .deltaConsumerDir , OptOutUtils .prefixDeltaFile , cachedPathList );
0 commit comments