public class SegmentedStoreUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SegmentedStoreUtils.FilterOptions |
Modifier and Type | Field and Description |
---|---|
static java.lang.Long |
MINIMUM_FREE_SCRATCH_SPACE |
Constructor and Description |
---|
SegmentedStoreUtils() |
Modifier and Type | Method and Description |
---|---|
static long |
calculateTotalSize(java.util.List<ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription> dataSets) |
static void |
cleanUp(ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO dataSet,
java.io.File storeRoot,
java.lang.String newShareId,
ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Deletes specified data set in the old share if it is already in the new one or in the new one if it is still in the old one.
|
static void |
deleteDataSet(ch.systemsx.cisd.openbis.generic.shared.basic.dto.IDatasetLocation dataSet,
ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider dataSetDirectoryProvider,
ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Deletes specified data set.
|
static void |
deleteDataSetInstantly(java.lang.String dataSetCode,
java.io.File dataSetDirInStore,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Deletes specified data set at specified location.
|
static java.lang.String |
findIncomingShare(java.io.File incomingFolder,
java.io.File storeRoot,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Returns first the id of the first incoming share folder of specified store root which allows to move a file from specified incoming folder to
the incoming share.
|
static void |
freeSpace(Share unarchivingScratchShare,
ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service,
java.util.List<ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription> dataSets,
ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider dataSetDirectoryProvider,
ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Frees space in specified share for unarchived data sets.
|
static java.io.File[] |
getShares(java.io.File storeRootDir)
Lists all folders in specified store root directory which match share pattern.
|
static java.util.List<Share> |
getSharesWithDataSets(java.io.File storeRoot,
java.lang.String dataStoreCode,
SegmentedStoreUtils.FilterOptions filterOptions,
java.util.Set<java.lang.String> incomingShares,
ch.systemsx.cisd.common.filesystem.IFreeSpaceProvider freeSpaceProvider,
ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service,
ch.systemsx.cisd.common.logging.ISimpleLogger log)
Gets a list of all shares of specified store root directory.
|
static void |
moveDataSetToAnotherShare(java.io.File dataSetDirInStore,
java.io.File share,
ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service,
ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager,
ch.systemsx.cisd.openbis.dss.generic.shared.IChecksumProvider checksumProvider,
ch.systemsx.cisd.common.logging.ISimpleLogger logger)
Moves the specified data set to the specified share.
|
public static final java.lang.Long MINIMUM_FREE_SCRATCH_SPACE
public static java.io.File[] getShares(java.io.File storeRootDir)
public static java.lang.String findIncomingShare(java.io.File incomingFolder, java.io.File storeRoot, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
public static java.util.List<Share> getSharesWithDataSets(java.io.File storeRoot, java.lang.String dataStoreCode, SegmentedStoreUtils.FilterOptions filterOptions, java.util.Set<java.lang.String> incomingShares, ch.systemsx.cisd.common.filesystem.IFreeSpaceProvider freeSpaceProvider, ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service, ch.systemsx.cisd.common.logging.ISimpleLogger log)
dataStoreCode
- Code of the data store to which the root belongs.filterOptions
- Specifies what kind of shares should be filtered out from the resultincomingShares
- Set of IDs of incoming shares. Will be used to mark Share
object in the returned list.freeSpaceProvider
- Provider of free space used for all shares.service
- Access to openBIS API in order to get all data sets and to update data set size.log
- Logger for logging size calculations.public static void freeSpace(Share unarchivingScratchShare, ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service, java.util.List<ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription> dataSets, ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider dataSetDirectoryProvider, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
DatasetDescription
objects. Data sets with oldest modification date are removed first. The archiving status of these data sets are set
back to ARCHIVED.dataSets
- The data sets which should be kept (if already in the specified share). In addition they specify the amount of space to be
freed.public static long calculateTotalSize(java.util.List<ch.systemsx.cisd.openbis.generic.shared.dto.DatasetDescription> dataSets)
public static void moveDataSetToAnotherShare(java.io.File dataSetDirInStore, java.io.File share, ch.systemsx.cisd.openbis.dss.generic.shared.IEncapsulatedOpenBISService service, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.openbis.dss.generic.shared.IChecksumProvider checksumProvider, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
share
. Its name is the share id.
This method works as follows:
service
- to access openBIS AS.checksumProvider
- public static void deleteDataSet(ch.systemsx.cisd.openbis.generic.shared.basic.dto.IDatasetLocation dataSet, ch.systemsx.cisd.openbis.dss.generic.shared.IDataSetDirectoryProvider dataSetDirectoryProvider, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
public static void deleteDataSetInstantly(java.lang.String dataSetCode, java.io.File dataSetDirInStore, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
public static void cleanUp(ch.systemsx.cisd.openbis.generic.shared.dto.SimpleDataSetInformationDTO dataSet, java.io.File storeRoot, java.lang.String newShareId, ch.systemsx.cisd.openbis.dss.generic.shared.IShareIdManager shareIdManager, ch.systemsx.cisd.common.logging.ISimpleLogger logger)
shareIdManager
- provides the current share.