File tree Expand file tree Collapse file tree 5 files changed +99
-0
lines changed
cli/src/main/java/com/scalar/db/dataloader/cli/command/dataexport
core/src/main/java/com/scalar/db/dataloader/core/dataexport Expand file tree Collapse file tree 5 files changed +99
-0
lines changed Original file line number Diff line number Diff line change @@ -132,6 +132,21 @@ private void validateOutputDirectory() throws DirectoryValidationException {
132132 }
133133 }
134134
135+ /**
136+ * Creates a {@link TableMetadataService} instance based on the specified {@link ScalarDbMode} and
137+ * ScalarDB configuration file.
138+ *
139+ * <p>If the mode is {@code TRANSACTION}, this method initializes a {@link TransactionFactory} and
140+ * uses its transaction admin to create a {@link TableMetadataTransactionService}. Otherwise, it
141+ * initializes a {@link StorageFactory} and creates a {@link TableMetadataStorageService} using
142+ * its storage admin.
143+ *
144+ * @param scalarDbMode the mode ScalarDB is running in (either {@code STORAGE} or {@code
145+ * TRANSACTION})
146+ * @param scalarDbPropertiesFilePath the path to the ScalarDB properties file
147+ * @return an appropriate {@link TableMetadataService} based on the mode
148+ * @throws IOException if reading the ScalarDB properties file fails
149+ */
135150 private TableMetadataService createTableMetadataService (
136151 ScalarDbMode scalarDbMode , String scalarDbPropertiesFilePath ) throws IOException {
137152 if (scalarDbMode .equals (ScalarDbMode .TRANSACTION )) {
Original file line number Diff line number Diff line change 1313import java .util .List ;
1414
1515public class CsvExportManager extends ExportManager {
16+ /**
17+ * Constructs a {@code CsvExportManager} for exporting data using a {@link DistributedStorage}
18+ * instance.
19+ *
20+ * <p>This constructor is used when exporting data in non-transactional (storage) mode.
21+ *
22+ * @param distributedStorage the {@link DistributedStorage} used to read data directly from
23+ * storage
24+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
25+ * @param producerTaskFactory the factory used to create producer tasks for generating
26+ * CSV-formatted output
27+ */
1628 public CsvExportManager (
1729 DistributedStorage distributedStorage ,
1830 ScalarDbDao dao ,
1931 ProducerTaskFactory producerTaskFactory ) {
2032 super (distributedStorage , dao , producerTaskFactory );
2133 }
2234
35+ /**
36+ * Constructs a {@code CsvExportManager} for exporting data using a {@link
37+ * DistributedTransactionManager}.
38+ *
39+ * @param distributedTransactionManager the transaction manager used to read data with
40+ * transactional guarantees
41+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
42+ * @param producerTaskFactory the factory used to create producer tasks for generating
43+ * CSV-formatted output
44+ */
2345 public CsvExportManager (
2446 DistributedTransactionManager distributedTransactionManager ,
2547 ScalarDbDao dao ,
Original file line number Diff line number Diff line change @@ -42,6 +42,15 @@ public abstract class ExportManager {
4242 private final ProducerTaskFactory producerTaskFactory ;
4343 private final Object lock = new Object ();
4444
45+ /**
46+ * Constructs an {@code ExportManager} that uses a {@link DistributedStorage} instance for
47+ * non-transactional data export operations.
48+ *
49+ * @param distributedStorage the {@link DistributedStorage} used to read data directly from
50+ * storage
51+ * @param dao the {@link ScalarDbDao} used to perform data operations
52+ * @param producerTaskFactory the factory for creating producer tasks to format the exported data
53+ */
4554 public ExportManager (
4655 DistributedStorage distributedStorage ,
4756 ScalarDbDao dao ,
@@ -52,6 +61,15 @@ public ExportManager(
5261 this .producerTaskFactory = producerTaskFactory ;
5362 }
5463
64+ /**
65+ * Constructs an {@code ExportManager} that uses a {@link DistributedTransactionManager} instance
66+ * for transactional data export operations.
67+ *
68+ * @param distributedTransactionManager the {@link DistributedTransactionManager} used to read
69+ * data with transactional guarantees
70+ * @param dao the {@link ScalarDbDao} used to perform data operations
71+ * @param producerTaskFactory the factory for creating producer tasks to format the exported data
72+ */
5573 public ExportManager (
5674 DistributedTransactionManager distributedTransactionManager ,
5775 ScalarDbDao dao ,
Original file line number Diff line number Diff line change 99import java .io .Writer ;
1010
1111public class JsonExportManager extends ExportManager {
12+ /**
13+ * Constructs a {@code JsonExportManager} for exporting data using a {@link DistributedStorage}
14+ * instance.
15+ *
16+ * <p>This constructor is used when exporting data in non-transactional (storage) mode.
17+ *
18+ * @param distributedStorage the {@link DistributedStorage} used to read data directly from
19+ * storage
20+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
21+ * @param producerTaskFactory the factory used to create producer tasks for generating
22+ * CSV-formatted output
23+ */
1224 public JsonExportManager (
1325 DistributedStorage distributedStorage ,
1426 ScalarDbDao dao ,
1527 ProducerTaskFactory producerTaskFactory ) {
1628 super (distributedStorage , dao , producerTaskFactory );
1729 }
1830
31+ /**
32+ * Constructs a {@code JsonExportManager} for exporting data using a {@link
33+ * DistributedTransactionManager}.
34+ *
35+ * @param distributedTransactionManager the transaction manager used to read data with
36+ * transactional guarantees
37+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
38+ * @param producerTaskFactory the factory used to create producer tasks for generating
39+ * CSV-formatted output
40+ */
1941 public JsonExportManager (
2042 DistributedTransactionManager distributedTransactionManager ,
2143 ScalarDbDao dao ,
Original file line number Diff line number Diff line change 99import java .io .Writer ;
1010
1111public class JsonLineExportManager extends ExportManager {
12+ /**
13+ * Constructs a {@code JsonLineExportManager} for exporting data using a {@link
14+ * DistributedStorage} instance.
15+ *
16+ * <p>This constructor is used when exporting data in non-transactional (storage) mode.
17+ *
18+ * @param distributedStorage the {@link DistributedStorage} used to read data directly from
19+ * storage
20+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
21+ * @param producerTaskFactory the factory used to create producer tasks for generating
22+ * CSV-formatted output
23+ */
1224 public JsonLineExportManager (
1325 DistributedStorage distributedStorage ,
1426 ScalarDbDao dao ,
1527 ProducerTaskFactory producerTaskFactory ) {
1628 super (distributedStorage , dao , producerTaskFactory );
1729 }
1830
31+ /**
32+ * Constructs a {@code JsonLineExportManager} for exporting data using a {@link
33+ * DistributedTransactionManager}.
34+ *
35+ * @param distributedTransactionManager the transaction manager used to read data with
36+ * transactional guarantees
37+ * @param dao the {@link ScalarDbDao} used to interact with ScalarDB for exporting data
38+ * @param producerTaskFactory the factory used to create producer tasks for generating
39+ * CSV-formatted output
40+ */
1941 public JsonLineExportManager (
2042 DistributedTransactionManager distributedTransactionManager ,
2143 ScalarDbDao dao ,
You can’t perform that action at this time.
0 commit comments