Skip to content

Commit 915fa05

Browse files
committed
add javadoc
1 parent 0338c4b commit 915fa05

File tree

6 files changed

+187
-0
lines changed

6 files changed

+187
-0
lines changed

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/AsyncErasureCoding.java

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@
4444
import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.asyncApply;
4545
import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.asyncReturn;
4646

47+
/**
48+
* Provides asynchronous operations for erasure coding in HDFS Federation.
49+
* This class extends {@link org.apache.hadoop.hdfs.server.federation.router.ErasureCoding}
50+
* and overrides its methods to perform erasure coding operations in a non-blocking manner,
51+
* allowing for concurrent execution and improved performance.
52+
*/
4753
public class AsyncErasureCoding extends ErasureCoding {
4854
/** RPC server to receive client calls. */
4955
private final RouterRpcServer rpcServer;
@@ -59,6 +65,16 @@ public AsyncErasureCoding(RouterRpcServer server) {
5965
this.namenodeResolver = this.rpcClient.getNamenodeResolver();
6066
}
6167

68+
/**
69+
* Asynchronously get an array of all erasure coding policies.
70+
* This method checks the operation category and then invokes the
71+
* getErasureCodingPolicies method concurrently across all namespaces.
72+
* <p>
73+
* The results are merged and returned as an array of ErasureCodingPolicyInfo.
74+
*
75+
* @return Array of ErasureCodingPolicyInfo.
76+
* @throws IOException If an I/O error occurs.
77+
*/
6278
@Override
6379
public ErasureCodingPolicyInfo[] getErasureCodingPolicies()
6480
throws IOException {
@@ -76,6 +92,16 @@ public ErasureCodingPolicyInfo[] getErasureCodingPolicies()
7692
return asyncReturn(ErasureCodingPolicyInfo[].class);
7793
}
7894

95+
/**
96+
* Asynchronously get the erasure coding codecs available.
97+
* This method checks the operation category and then invokes the
98+
* getErasureCodingCodecs method concurrently across all namespaces.
99+
* <p>
100+
* The results are merged into a single map of codec names to codec properties.
101+
*
102+
* @return Map of erasure coding codecs.
103+
* @throws IOException If an I/O error occurs.
104+
*/
79105
@Override
80106
public Map<String, String> getErasureCodingCodecs() throws IOException {
81107
rpcServer.checkOperation(NameNode.OperationCategory.READ);
@@ -103,6 +129,17 @@ public Map<String, String> getErasureCodingCodecs() throws IOException {
103129
return asyncReturn(Map.class);
104130
}
105131

132+
/**
133+
* Asynchronously add an array of erasure coding policies.
134+
* This method checks the operation category and then invokes the
135+
* addErasureCodingPolicies method concurrently across all namespaces.
136+
* <p>
137+
* The results are merged and returned as an array of AddErasureCodingPolicyResponse.
138+
*
139+
* @param policies Array of erasure coding policies to add.
140+
* @return Array of AddErasureCodingPolicyResponse.
141+
* @throws IOException If an I/O error occurs.
142+
*/
106143
@Override
107144
public AddErasureCodingPolicyResponse[] addErasureCodingPolicies(
108145
ErasureCodingPolicy[] policies) throws IOException {
@@ -123,6 +160,17 @@ public AddErasureCodingPolicyResponse[] addErasureCodingPolicies(
123160
return asyncReturn(AddErasureCodingPolicyResponse[].class);
124161
}
125162

163+
/**
164+
* Asynchronously get the erasure coding policy for a given source path.
165+
* This method checks the operation category and then invokes the
166+
* getErasureCodingPolicy method sequentially for the given path.
167+
* <p>
168+
* The result is returned as an ErasureCodingPolicy object.
169+
*
170+
* @param src Source path to get the erasure coding policy for.
171+
* @return ErasureCodingPolicy for the given path.
172+
* @throws IOException If an I/O error occurs.
173+
*/
126174
@Override
127175
public ErasureCodingPolicy getErasureCodingPolicy(String src)
128176
throws IOException {
@@ -142,6 +190,17 @@ public ErasureCodingPolicy getErasureCodingPolicy(String src)
142190
return asyncReturn(ErasureCodingPolicy.class);
143191
}
144192

193+
/**
194+
* Asynchronously get the EC topology result for the given policies.
195+
* This method checks the operation category and then invokes the
196+
* getECTopologyResultForPolicies method concurrently across all namespaces.
197+
* <p>
198+
* The results are merged and the first unsupported result is returned.
199+
*
200+
* @param policyNames Array of policy names to check.
201+
* @return ECTopologyVerifierResult for the policies.
202+
* @throws IOException If an I/O error occurs.
203+
*/
145204
@Override
146205
public ECTopologyVerifierResult getECTopologyResultForPolicies(
147206
String[] policyNames) throws IOException {
@@ -168,6 +227,16 @@ public ECTopologyVerifierResult getECTopologyResultForPolicies(
168227
return asyncReturn(ECTopologyVerifierResult.class);
169228
}
170229

230+
/**
231+
* Asynchronously get the erasure coding block group statistics.
232+
* This method checks the operation category and then invokes the
233+
* getECBlockGroupStats method concurrently across all namespaces.
234+
* <p>
235+
* The results are merged and returned as an ECBlockGroupStats object.
236+
*
237+
* @return ECBlockGroupStats for the erasure coding block groups.
238+
* @throws IOException If an I/O error occurs.
239+
*/
171240
@Override
172241
public ECBlockGroupStats getECBlockGroupStats() throws IOException {
173242
rpcServer.checkOperation(NameNode.OperationCategory.READ);

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/AsyncQuota.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.asyncApply;
3636
import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.asyncReturn;
3737

38+
/**
39+
* Provides asynchronous operations for managing quotas in HDFS Federation.
40+
* This class extends {@link org.apache.hadoop.hdfs.server.federation.router.Quota}
41+
* and overrides its methods to perform quota operations in a non-blocking manner,
42+
* allowing for concurrent execution and improved performance.
43+
*/
3844
public class AsyncQuota extends Quota {
3945

4046
/** RPC server to receive client calls. */

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncCacheAdmin.java

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ public RouterAsyncCacheAdmin(RouterRpcServer server) {
4747
super(server);
4848
}
4949

50+
/**
51+
* Asynchronously adds a new cache directive with the given path and flags.
52+
* This method invokes the addCacheDirective method concurrently across all
53+
* namespaces, and returns the first response as a long value representing the
54+
* directive ID.
55+
*
56+
* @param path The cache directive path.
57+
* @param flags The cache flags.
58+
* @return The ID of the newly added cache directive.
59+
* @throws IOException If an I/O error occurs.
60+
*/
5061
@Override
5162
public long addCacheDirective(
5263
CacheDirectiveInfo path, EnumSet<CacheFlag> flags) throws IOException {
@@ -56,6 +67,17 @@ public long addCacheDirective(
5667
return asyncReturn(Long.class);
5768
}
5869

70+
/**
71+
* Asynchronously lists cache directives based on the provided previous ID and filter.
72+
* This method invokes the listCacheDirectives method concurrently across all
73+
* namespaces, and returns the first response as a BatchedEntries object containing
74+
* the cache directive entries.
75+
*
76+
* @param prevId The previous ID from which to start listing.
77+
* @param filter The filter to apply to the cache directives.
78+
* @return BatchedEntries of cache directive entries.
79+
* @throws IOException If an I/O error occurs.
80+
*/
5981
@Override
6082
public BatchedEntries<CacheDirectiveEntry> listCacheDirectives(
6183
long prevId, CacheDirectiveInfo filter) throws IOException {
@@ -66,6 +88,16 @@ public BatchedEntries<CacheDirectiveEntry> listCacheDirectives(
6688
return asyncReturn(BatchedEntries.class);
6789
}
6890

91+
/**
92+
* Asynchronously lists cache pools starting from the provided key.
93+
* This method invokes the listCachePools method concurrently across all namespaces,
94+
* and returns the first response as a BatchedEntries object containing the cache
95+
* pool entries.
96+
*
97+
* @param prevKey The previous key from which to start listing.
98+
* @return BatchedEntries of cache pool entries.
99+
* @throws IOException If an I/O error occurs.
100+
*/
69101
@Override
70102
public BatchedEntries<CachePoolEntry> listCachePools(String prevKey) throws IOException {
71103
invokeListCachePools(prevKey);

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncSnapshot.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,16 @@ public RouterAsyncSnapshot(RouterRpcServer server) {
6363
this.namenodeResolver = rpcServer.getNamenodeResolver();
6464
}
6565

66+
/**
67+
* Asynchronously creates a snapshot with the given root and name.
68+
* This method checks the operation category and then invokes the createSnapshot
69+
* method concurrently across all namespaces, returning the first successful response.
70+
*
71+
* @param snapshotRoot The root path of the snapshot.
72+
* @param snapshotName The name of the snapshot.
73+
* @return The path of the created snapshot.
74+
* @throws IOException If an I/O error occurs.
75+
*/
6676
@Override
6777
public String createSnapshot(String snapshotRoot, String snapshotName) throws IOException {
6878
rpcServer.checkOperation(NameNode.OperationCategory.WRITE);
@@ -95,6 +105,15 @@ public String createSnapshot(String snapshotRoot, String snapshotName) throws IO
95105
return asyncReturn(String.class);
96106
}
97107

108+
/**
109+
* Asynchronously get an array of snapshottable directory listings.
110+
* This method checks the operation category and then invokes the
111+
* getSnapshottableDirListing method concurrently across all namespaces, merging
112+
* the results into a single array.
113+
*
114+
* @return Array of SnapshottableDirectoryStatus.
115+
* @throws IOException If an I/O error occurs.
116+
*/
98117
@Override
99118
public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOException {
100119
rpcServer.checkOperation(NameNode.OperationCategory.READ);
@@ -109,6 +128,16 @@ public SnapshottableDirectoryStatus[] getSnapshottableDirListing() throws IOExce
109128
return asyncReturn(SnapshottableDirectoryStatus[].class);
110129
}
111130

131+
/**
132+
* Asynchronously get an array of snapshot listings for the given snapshot root.
133+
* This method checks the operation category and then invokes the
134+
* getSnapshotListing method, either sequentially or concurrently based on the
135+
* configuration, and returns the merged results.
136+
*
137+
* @param snapshotRoot The root path of the snapshots.
138+
* @return Array of SnapshotStatus.
139+
* @throws IOException If an I/O error occurs.
140+
*/
112141
@Override
113142
public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOException {
114143
rpcServer.checkOperation(NameNode.OperationCategory.READ);
@@ -151,6 +180,18 @@ public SnapshotStatus[] getSnapshotListing(String snapshotRoot) throws IOExcepti
151180
return asyncReturn(SnapshotStatus[].class);
152181
}
153182

183+
/**
184+
* Asynchronously get a snapshot diff report for the given root and snapshot names.
185+
* This method checks the operation category and then invokes the
186+
* getSnapshotDiffReport method, either sequentially or concurrently based on the
187+
* configuration, and returns the result.
188+
*
189+
* @param snapshotRoot The root path of the snapshot.
190+
* @param earlierSnapshotName The name of the earlier snapshot.
191+
* @param laterSnapshotName The name of the later snapshot.
192+
* @return SnapshotDiffReport for the snapshots.
193+
* @throws IOException If an I/O error occurs.
194+
*/
154195
@Override
155196
public SnapshotDiffReport getSnapshotDiffReport(
156197
String snapshotRoot, String earlierSnapshotName,
@@ -175,6 +216,20 @@ public SnapshotDiffReport getSnapshotDiffReport(
175216
}
176217
}
177218

219+
/**
220+
* Asynchronously get a snapshot diff report listing for the given root and snapshot names.
221+
* This method checks the operation category and then invokes the
222+
* getSnapshotDiffReportListing method, either sequentially or concurrently based
223+
* on the configuration, and returns the result.
224+
*
225+
* @param snapshotRoot The root path of the snapshot.
226+
* @param earlierSnapshotName The name of the earlier snapshot.
227+
* @param laterSnapshotName The name of the later snapshot.
228+
* @param startPath The starting path for the diff report.
229+
* @param index The index for the diff report listing.
230+
* @return SnapshotDiffReportListing for the snapshots.
231+
* @throws IOException If an I/O error occurs.
232+
*/
178233
@Override
179234
public SnapshotDiffReportListing getSnapshotDiffReportListing(
180235
String snapshotRoot, String earlierSnapshotName, String laterSnapshotName,

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncStoragePolicy.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@
3131

3232
import static org.apache.hadoop.hdfs.server.federation.router.async.utils.AsyncUtil.asyncReturn;
3333

34+
/**
35+
* Module that implements all the asynchronous RPC calls in
36+
* {@link org.apache.hadoop.hdfs.protocol.ClientProtocol} related to
37+
* Storage Policy in the {@link RouterRpcServer}.
38+
*/
3439
public class RouterAsyncStoragePolicy extends RouterStoragePolicy {
3540
/** RPC server to receive client calls. */
3641
private final RouterRpcServer rpcServer;
@@ -43,6 +48,15 @@ public RouterAsyncStoragePolicy(RouterRpcServer server) {
4348
this.rpcClient = this.rpcServer.getRPCClient();
4449
}
4550

51+
/**
52+
* Asynchronously get the storage policy for a given path.
53+
* This method checks the operation category and then invokes the
54+
* getStoragePolicy method sequentially for the given path.
55+
*
56+
* @param path The path for which to retrieve the storage policy.
57+
* @return The BlockStoragePolicy for the given path.
58+
* @throws IOException If an I/O error occurs.
59+
*/
4660
@Override
4761
public BlockStoragePolicy getStoragePolicy(String path)
4862
throws IOException {
@@ -57,6 +71,14 @@ public BlockStoragePolicy getStoragePolicy(String path)
5771
return asyncReturn(BlockStoragePolicy.class);
5872
}
5973

74+
/**
75+
* Asynchronously get an array of all available storage policies.
76+
* This method checks the operation category and then invokes the
77+
* getStoragePolicies method across all available namespaces.
78+
*
79+
* @return An array of BlockStoragePolicy.
80+
* @throws IOException If an I/O error occurs.
81+
*/
6082
@Override
6183
public BlockStoragePolicy[] getStoragePolicies() throws IOException {
6284
rpcServer.checkOperation(NameNode.OperationCategory.READ);

hadoop-hdfs-project/hadoop-hdfs-rbf/src/main/java/org/apache/hadoop/hdfs/server/federation/router/async/RouterAsyncUserProtocol.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ public RouterAsyncUserProtocol(RouterRpcServer server) {
6767

6868
/**
6969
* Asynchronously refresh user to group mappings.
70+
*
7071
* @throws IOException raised on errors performing I/O.
7172
*/
7273
@Override
@@ -86,6 +87,7 @@ public void refreshUserToGroupsMappings() throws IOException {
8687

8788
/**
8889
* Asynchronously refresh superuser proxy group list.
90+
*
8991
* @throws IOException raised on errors performing I/O.
9092
*/
9193
@Override
@@ -105,6 +107,7 @@ public void refreshSuperUserGroupsConfiguration() throws IOException {
105107

106108
/**
107109
* Asynchronously get the groups which are mapped to the given user.
110+
*
108111
* @param user The user to get the groups for.
109112
* @return The set of groups the user belongs to.
110113
* @throws IOException raised on errors performing I/O.

0 commit comments

Comments
 (0)