11package com .scalar .db .dataloader .core .dataimport .task ;
22
3- import com .scalar .db .api .DistributedStorage ;
43import com .scalar .db .api .DistributedTransactionManager ;
54import com .scalar .db .api .Result ;
65import com .scalar .db .dataloader .core .dataimport .dao .ScalarDbDaoException ;
109import java .util .Optional ;
1110
1211/**
13- * An import task that interacts with a {@link DistributedStorage} for data retrieval and manager
14- * operations.
12+ * An import task that performs data operations using a {@link DistributedTransactionManager}.
1513 *
16- * <p>This class extends {@link ImportTask} and provides concrete implementations for fetching and
17- * storing records using a {@link DistributedStorage } instance. It acts as a bridge between the
18- * import process and the underlying distributed manager system .
14+ * <p>This class extends {@link ImportTask} and provides concrete implementations for retrieving and
15+ * storing records using a {@link DistributedTransactionManager } instance. It serves as a bridge
16+ * between the import process and the underlying transactional data management layer in ScalarDB .
1917 *
20- * <p>The task handles both read and write operations:
18+ * <p>The task supports both read and write operations:
2119 *
2220 * <ul>
23- * <li>Reading existing records using partition and clustering keys
24- * <li>Storing new or updated records with their associated columns
21+ * <li>Retrieving existing records using partition and optional clustering keys.
22+ * <li>Inserting or updating records with their associated column values.
2523 * </ul>
2624 *
27- * <p>All manager operations are performed through the provided {@link DistributedStorage} instance,
28- * which must be properly initialized before creating this task.
25+ * <p>All data operations are delegated to the DAO configured within {@link ImportTaskParams},
26+ * executed through the provided {@link DistributedTransactionManager}. The manager must be properly
27+ * initialized and connected before creating an instance of this class.
2928 */
3029public class ImportStorageTask extends ImportTask {
3130
3231 private final DistributedTransactionManager manager ;
3332
3433 /**
35- * Constructs an {@code ImportStorageTask} with the specified parameters and manager.
34+ * Constructs an {@code ImportStorageTask} with the specified parameters and transaction manager.
3635 *
3736 * @param params the import task parameters containing configuration and DAO objects
38- * @param manager the distributed manager instance to be used for data operations
39- * @throws NullPointerException if either params or manager is null
37+ * @param manager the {@link DistributedTransactionManager} instance used for transactional data
38+ * operations
39+ * @throws NullPointerException if either {@code params} or {@code manager} is {@code null}
4040 */
4141 public ImportStorageTask (ImportTaskParams params , DistributedTransactionManager manager ) {
4242 super (params );
4343 this .manager = manager ;
4444 }
4545
4646 /**
47- * Retrieves a data record from the distributed manager using the specified keys.
47+ * Retrieves a data record from the database using the specified keys.
4848 *
49- * <p>This method attempts to fetch a single record from the specified table using both partition
50- * and clustering keys. The operation is performed through the configured DAO using the associated
51- * manager instance .
49+ * <p>This method attempts to fetch a single record from the given table using the provided
50+ * partition and optional clustering keys. The retrieval is executed through the DAO configured in
51+ * {@link ImportTaskParams}, utilizing the associated {@link DistributedTransactionManager} .
5252 *
53- * @param namespace the namespace of the table to query
54- * @param tableName the name of the table to query
53+ * @param namespace the ScalarDB namespace of the target table
54+ * @param tableName the name of the target table
5555 * @param partitionKey the partition key identifying the record's partition
56- * @param clusteringKey the clustering key for further record identification within the partition
57- * @return an {@link Optional} containing the {@link Result} if the record exists, otherwise an
58- * empty {@link Optional}
59- * @throws ScalarDbDaoException if an error occurs during the retrieval operation, such as
60- * connection issues or invalid table/namespace
56+ * @param clusteringKey the clustering key for uniquely identifying the record within the
57+ * partition
58+ * @return an {@link Optional} containing the {@link Result} if a record exists, or an empty
59+ * {@link Optional} if no matching record is found
60+ * @throws ScalarDbDaoException if an error occurs during the retrieval operation, such as a
61+ * connection failure or invalid table/namespace
6162 */
6263 @ Override
6364 protected Optional <Result > getDataRecord (
@@ -67,17 +68,18 @@ protected Optional<Result> getDataRecord(
6768 }
6869
6970 /**
70- * Saves a record into the distributed manager with the specified keys and columns .
71+ * Saves or updates a record in the database using the specified keys and column values .
7172 *
7273 * <p>This method writes or updates a record in the specified table using the provided keys and
73- * column values . The operation is performed through the configured DAO using the associated
74- * manager instance .
74+ * columns . The operation is performed through the DAO configured in {@link ImportTaskParams},
75+ * utilizing the associated {@link DistributedTransactionManager} .
7576 *
76- * @param namespace the namespace of the target table
77+ * @param namespace the ScalarDB namespace of the target table
7778 * @param tableName the name of the target table
7879 * @param partitionKey the partition key determining where the record will be stored
79- * @param clusteringKey the clustering key for organizing records within the partition
80- * @param columns the list of columns containing the record's data to be saved
80+ * @param clusteringKey the clustering key for uniquely identifying the record within the
81+ * partition
82+ * @param columns the list of columns containing the data to be stored
8183 * @throws ScalarDbDaoException if an error occurs during the save operation, such as connection
8284 * issues, invalid data types, or constraint violations
8385 */
0 commit comments