Skip to content

Commit 5b6f86a

Browse files
committed
Removed unused code and udpated java doc comments
1 parent 36ff32f commit 5b6f86a

File tree

4 files changed

+33
-156
lines changed

4 files changed

+33
-156
lines changed

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDbDao.java

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.scalar.db.dataloader.core.dataimport.dao;
22

3-
import com.scalar.db.api.DistributedStorage;
43
import com.scalar.db.api.DistributedTransaction;
54
import com.scalar.db.api.DistributedTransactionManager;
65
import com.scalar.db.api.Get;
@@ -10,16 +9,13 @@
109
import com.scalar.db.api.Result;
1110
import com.scalar.db.api.Scan;
1211
import com.scalar.db.api.ScanBuilder;
13-
import com.scalar.db.api.Scanner;
1412
import com.scalar.db.api.TransactionManagerCrudOperable;
1513
import com.scalar.db.dataloader.core.DataLoaderError;
1614
import com.scalar.db.dataloader.core.ScanRange;
17-
import com.scalar.db.exception.storage.ExecutionException;
1815
import com.scalar.db.exception.transaction.CrudException;
1916
import com.scalar.db.exception.transaction.UnknownTransactionStatusException;
2017
import com.scalar.db.io.Column;
2118
import com.scalar.db.io.Key;
22-
import java.io.IOException;
2319
import java.util.ArrayList;
2420
import java.util.List;
2521
import java.util.NoSuchElementException;
@@ -162,43 +158,6 @@ public void put(
162158
}
163159
}
164160

165-
/**
166-
* Scan a ScalarDB table
167-
*
168-
* @param namespace ScalarDB namespace
169-
* @param table ScalarDB table name
170-
* @param partitionKey Partition key used in ScalarDB scan
171-
* @param range Optional range to set ScalarDB scan start and end values
172-
* @param sorts Optional scan clustering key sorting values
173-
* @param projections List of column projection to use during scan
174-
* @param limit Scan limit value
175-
* @param storage Distributed storage for ScalarDB connection that is running in storage mode
176-
* @return List of ScalarDB scan results
177-
* @throws ScalarDbDaoException if scan fails
178-
*/
179-
public List<Result> scan(
180-
String namespace,
181-
String table,
182-
Key partitionKey,
183-
ScanRange range,
184-
List<Scan.Ordering> sorts,
185-
List<String> projections,
186-
int limit,
187-
DistributedStorage storage)
188-
throws ScalarDbDaoException {
189-
// Create scan
190-
Scan scan = createScan(namespace, table, partitionKey, range, sorts, projections, limit);
191-
192-
// scan data
193-
try {
194-
try (Scanner scanner = storage.scan(scan)) {
195-
return scanner.all();
196-
}
197-
} catch (ExecutionException | IOException e) {
198-
throw new ScalarDbDaoException(DataLoaderError.ERROR_SCAN.buildMessage(e.getMessage()), e);
199-
}
200-
}
201-
202161
/**
203162
* Scan a ScalarDB table
204163
*

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDbStorageManager.java

Lines changed: 0 additions & 49 deletions
This file was deleted.

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/dao/ScalarDbTransactionManager.java

Lines changed: 0 additions & 35 deletions
This file was deleted.

data-loader/core/src/main/java/com/scalar/db/dataloader/core/dataimport/task/ImportStorageTask.java

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package com.scalar.db.dataloader.core.dataimport.task;
22

3-
import com.scalar.db.api.DistributedStorage;
43
import com.scalar.db.api.DistributedTransactionManager;
54
import com.scalar.db.api.Result;
65
import com.scalar.db.dataloader.core.dataimport.dao.ScalarDbDaoException;
@@ -10,54 +9,56 @@
109
import 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
*/
3029
public 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

Comments
 (0)