Skip to content

Commit

Permalink
comments & format
Browse files Browse the repository at this point in the history
  • Loading branch information
zdong2 committed Sep 19, 2024
1 parent f68f166 commit 6eb5a77
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1121,34 +1121,38 @@ <R extends CommonResource> void removeTagForResource(
//region Tag APIs

/**
* Delete all tags from the database that aren't referenced which were created between the supplied thresholds.
* Delete all tags from the database that aren't referenced which were created between the
* supplied threshold bounds.
*
* @param createdThresholdLowerBound The instant in time when tags created after this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when tags created before this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdLowerBound The instant in time when tags created after this time that
* aren't referenced will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when tags created before this time that
* aren't referenced will be selected. Inclusive.
* @param batchSize The maximum number of tags to delete in a single transaction
* @return The number of tags deleted
*/
long deleteUnusedTags(@NotNull Instant createdThresholdLowerBound,
@NotNull Instant createdThresholdUpperBound,
@Min(1) int batchSize);
long deleteUnusedTags(
@NotNull Instant createdThresholdLowerBound,
@NotNull Instant createdThresholdUpperBound,
@Min(1) int batchSize);
//endregion

//region File APIs

/**
* Delete all files from the database that aren't referenced which were created between the supplied thresholds.
* Delete all files from the database that aren't referenced which were created between the
* supplied threshold bounds.
*
* @param createdThresholdLowerBound The instant in time when files created after this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when files created before this time that aren't referenced
* will be selected. Inclusive.
* @param batchSize The maximum number of files to delete in a single transaction
* @param createdThresholdLowerBound The instant in time when files created after this time that
* aren't referenced will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when files created before this time that
* aren't referenced will be selected. Inclusive.
* @param batchSize The maximum number of files to delete in a single transaction
* @return The number of files deleted
*/
long deleteUnusedFiles(@NotNull Instant createdThresholdLowerBound,
@NotNull Instant createdThresholdUpperBound,
@Min(1) int batchSize);
long deleteUnusedFiles(
@NotNull Instant createdThresholdLowerBound,
@NotNull Instant createdThresholdUpperBound,
@Min(1) int batchSize);
//endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -2301,9 +2301,11 @@ public <R extends CommonResource> void removeTagForResource(
*/
@Override
@Transactional(isolation = Isolation.READ_COMMITTED)
public long deleteUnusedTags(@NotNull final Instant createdThresholdLowerBound,
@NotNull final Instant createdThresholdUpperBound,
@Min(1) final int batchSize) {
public long deleteUnusedTags(
@NotNull final Instant createdThresholdLowerBound,
@NotNull final Instant createdThresholdUpperBound,
@Min(1) final int batchSize
) {
log.debug(
"[deleteUnusedTags] Called to delete unused tags created between {} and {}",
createdThresholdLowerBound,
Expand All @@ -2326,9 +2328,11 @@ public long deleteUnusedTags(@NotNull final Instant createdThresholdLowerBound,
*/
@Override
@Transactional(isolation = Isolation.READ_COMMITTED)
public long deleteUnusedFiles(@NotNull final Instant createdThresholdLowerBound,
@NotNull final Instant createdThresholdUpperBound,
@Min(1) final int batchSize) {
public long deleteUnusedFiles(
@NotNull final Instant createdThresholdLowerBound,
@NotNull final Instant createdThresholdUpperBound,
@Min(1) final int batchSize
) {
log.debug(
"[deleteUnusedFiles] Called to delete unused files created between {} and {}",
createdThresholdLowerBound,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ public interface JpaFileRepository extends JpaIdRepository<FileEntity> {
Set<FileEntity> findByFileIn(Set<String> files);

/**
* Find the ids of all files from the database that aren't referenced which were created between the supplied
* thresholds.
* Find the ids of all files from the database that aren't referenced which were created
* between the supplied threshold bounds.
*
* @param createdThresholdLowerBound The instant in time when files created after this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when files created before this time that aren't referenced
* will be selected. Inclusive.
* @param limit The maximum number of file ids to retrieve
* @param createdThresholdLowerBound The instant in time when files created after this time that
* aren't referenced will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when files created before this time that
* aren't referenced will be selected. Inclusive.
* @param limit The maximum number of file ids to retrieve
* @return The ids of the files which should be deleted
*/
@Query(value = SELECT_FOR_UPDATE_UNUSED_FILES_SQL, nativeQuery = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,13 @@ public interface JpaTagRepository extends JpaIdRepository<TagEntity> {
Set<TagEntity> findByTagIn(Set<String> tags);

/**
* Find all tags from the database that aren't referenced which were created between the supplied thresholds.
* Find all tags from the database that aren't referenced which were created between the
* supplied threshold bounds.
*
* @param createdThresholdLowerBound The instant in time when tags created after this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when tags created before this time that aren't referenced
* will be selected. Inclusive.
* @param createdThresholdLowerBound The instant in time when tags created after this time that
* aren't referenced will be selected. Inclusive.
* @param createdThresholdUpperBound The instant in time when tags created before this time that
* aren't referenced will be selected. Inclusive.
* @param limit Maximum number of IDs to return
* @return The number of tags deleted
*/
Expand Down

0 comments on commit 6eb5a77

Please sign in to comment.