Skip to content

Commit

Permalink
Change cleanup user to return void, add java doc for storage dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
calvinjia committed Jul 8, 2015
1 parent b323841 commit 072f697
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
Expand Up @@ -328,21 +328,13 @@ public synchronized void resizeTempBlockMeta(TempBlockMeta tempBlockMeta, long n
* Cleans up the meta data of temp blocks created by the given user. * Cleans up the meta data of temp blocks created by the given user.
* *
* @param userId the ID of the user * @param userId the ID of the user
* @return A list of temp blocks created by the user in this block store
*/ */
public synchronized List<TempBlockMeta> cleanupUser(long userId) { public synchronized void cleanupUser(long userId) {
List<TempBlockMeta> ret = new ArrayList<TempBlockMeta>();
for (StorageTier tier : mTiers) { for (StorageTier tier : mTiers) {
for (StorageDir dir : tier.getStorageDirs()) { for (StorageDir dir : tier.getStorageDirs()) {
List<TempBlockMeta> blocksToRemove = dir.cleanupUser(userId); List<TempBlockMeta> blocksToRemove = dir.cleanupUser(userId);
if (blocksToRemove != null) {
for (TempBlockMeta block : blocksToRemove) {
ret.add(block);
}
}
} }
} }
return ret;
} }


/** /**
Expand Down
Expand Up @@ -416,6 +416,13 @@ public List<TempBlockMeta> cleanupUser(long userId) {
return blocksToRemove; return blocksToRemove;
} }


/**
* Gets the temporary blocks associated with a user in this StorageDir, an empty list is returned
* if the user has no temporary blocks in this StorageDir.
*
* @param userId the ID of the user
* @return A list of temporary blocks the user is associated with in this StorageDir
*/
public List<TempBlockMeta> getUserTempBlocks(long userId) { public List<TempBlockMeta> getUserTempBlocks(long userId) {
Set<Long> userTempBlockIds = mUserIdToTempBlockIdsMap.get(userId); Set<Long> userTempBlockIds = mUserIdToTempBlockIdsMap.get(userId);
List<TempBlockMeta> userTempBlocks = new ArrayList<TempBlockMeta>(); List<TempBlockMeta> userTempBlocks = new ArrayList<TempBlockMeta>();
Expand Down

0 comments on commit 072f697

Please sign in to comment.