Interface JpaManifestItemRepo

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<ManifestItem,​Long>, org.springframework.data.jpa.repository.JpaRepository<ManifestItem,​Long>, org.springframework.data.repository.PagingAndSortingRepository<ManifestItem,​Long>, org.springframework.data.repository.query.QueryByExampleExecutor<ManifestItem>, org.springframework.data.repository.Repository<ManifestItem,​Long>

    @Repository("manifestItemRepo")
    public interface JpaManifestItemRepo
    extends org.springframework.data.jpa.repository.JpaRepository<ManifestItem,​Long>
    Author:
    Daniel Bernstein
    • Method Detail

      • findByAccountAndStoreIdAndSpaceIdAndDeletedFalseOrderByContentIdAsc

        org.springframework.data.domain.Page<ManifestItem> findByAccountAndStoreIdAndSpaceIdAndDeletedFalseOrderByContentIdAsc​(String account,
                                                                                                                               String storeId,
                                                                                                                               String spaceId,
                                                                                                                               org.springframework.data.domain.Pageable pageable)
        Parameters:
        account -
        storeId -
        spaceId -
        pageable -
        Returns:
      • findByAccountAndStoreIdAndSpaceIdAndDeletedFalse

        @Query(nativeQuery=true,
               value="select * from manifest_item where account = ?1 and store_id=?2 and space_id = ?3 and deleted = false and id > ?4 order by id limit ?5")
        List<ManifestItem> findByAccountAndStoreIdAndSpaceIdAndDeletedFalse​(String account,
                                                                            String storeId,
                                                                            String spaceId,
                                                                            long lastId,
                                                                            int limit)
        Parameters:
        account -
        storeId -
        spaceId -
        lastId - The last id of the previous page. If there was no previous page, we recommend that you use the minimum id minus 1 in the unpaged set for optimum performance.
        limit -
        Returns:
      • getMinId

        @Query(nativeQuery=true,
               value="select ifnull(min(id),0) from manifest_item where account = ?1 and store_id=?2 and space_id = ?3 and deleted = false")
        long getMinId​(String account,
                      String storeId,
                      String spaceId)
        Returns the minimum id value for the specified data set.
        Parameters:
        account -
        storeId -
        spaceId -
        Returns:
      • findByAccountAndStoreIdAndSpaceIdAndContentId

        ManifestItem findByAccountAndStoreIdAndSpaceIdAndContentId​(String account,
                                                                   String storeId,
                                                                   String spaceId,
                                                                   String contentId)
        Parameters:
        account -
        storeId -
        spaceId -
        contentId -
        Returns:
      • deleteFirst50000ByDeletedTrueAndModifiedBefore

        @Modifying
        @Query(nativeQuery=true,
               value="delete from manifest_item where deleted = true and modified < ?1 limit 50000")
        int deleteFirst50000ByDeletedTrueAndModifiedBefore​(Date expiration)
        Parameters:
        expiration -
      • deleteByAccountAndStoreIdAndSpaceId

        void deleteByAccountAndStoreIdAndSpaceId​(String account,
                                                 String storeId,
                                                 String spaceId)
      • getStorageStatsByAccountAndStoreIdAndSpaceId

        @Query(nativeQuery=true,
               value="select count(*) objectCount, sum(content_size) as byteCount from manifest_item where account = :account and store_id = :storeId and space_id= :spaceId and deleted=false")
        Object[] getStorageStatsByAccountAndStoreIdAndSpaceId​(@Param("account")
                                                              String account,
                                                              @Param("storeId")
                                                              String storeId,
                                                              @Param("spaceId")
                                                              String spaceId)
        Returns an array with the following values: [item_count,byte_count]
        Parameters:
        account -
        storeId -
        spaceId -
        Returns: