Class DefaultOfferServiceImpl
- java.lang.Object
-
- fr.gouv.vitam.storage.offers.core.DefaultOfferServiceImpl
-
- All Implemented Interfaces:
DefaultOfferService
public class DefaultOfferServiceImpl extends java.lang.Object implements DefaultOfferService
-
-
Field Summary
-
Fields inherited from interface fr.gouv.vitam.storage.offers.core.DefaultOfferService
STORAGE_CONF_FILE_NAME
-
-
Constructor Summary
Constructors Constructor Description DefaultOfferServiceImpl(ContentAddressableStorage defaultStorage, ReadRequestReferentialRepository readRequestReferentialRepository, OfferLogCompactionDatabaseService offerLogCompactionDatabaseService, OfferLogDatabaseService offerDatabaseService, OfferSequenceDatabaseService offerSequenceDatabaseService, StorageConfiguration configuration, OfferLogCompactionConfiguration offerLogCompactionConfig, OfferLogAndCompactedOfferLogService offerLogAndCompactedOfferLogService, int maxBatchThreadPoolSize, int batchMetadataComputationTimeout)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StorageBulkPutResult
bulkPutObjects(java.lang.String containerName, java.util.List<java.lang.String> objectIds, MultiplexedStreamReader multiplexedStreamReader, DataCategory type, DigestType digestType)
void
checkOfferPath(java.lang.String... paths)
void
compactOfferLogs()
java.lang.String
createObject(java.lang.String containerName, java.lang.String objectId, java.io.InputStream objectPart, DataCategory type, java.lang.Long size, DigestType digestType)
Create object on container with objectId Receive object part of object.java.util.Optional<TapeReadRequestReferentialEntity>
createReadOrderRequest(java.lang.String containerName, java.util.List<java.lang.String> objectsIds)
create read order (asynchronous read from tape to local FS) for the given @containerName and objects list.void
deleteObject(java.lang.String containerName, java.lang.String objectId, DataCategory type)
Deletes a object representing the data at location containerName/objectNameStorageBulkMetadataResult
getBulkMetadata(java.lang.String containerName, java.util.List<java.lang.String> objectIds, java.lang.Boolean noCache)
ContainerInformation
getCapacity(java.lang.String containerName)
Get container capacityStorageMetadataResult
getMetadata(java.lang.String containerName, java.lang.String objectId, boolean noCache)
Get MetadataObjectContent
getObject(java.lang.String containerName, java.lang.String objectId)
Get object on offer as an inputStreamjava.lang.String
getObjectDigest(java.lang.String containerName, java.lang.String objectId, DigestType digestAlgorithm)
Get offer storage digest of objectjava.util.List<OfferLog>
getOfferLogs(java.lang.String containerName, java.lang.Long offset, int limit, Order order)
Get the offer log of objects created in offer containerjava.util.Optional<TapeReadRequestReferentialEntity>
getReadOrderRequest(java.lang.String readRequestID)
boolean
isObjectExist(java.lang.String containerName, java.lang.String objectId)
Check if object existsvoid
listObjects(java.lang.String containerName, ObjectListingListener objectListingListener)
List container objectsvoid
log(com.google.common.base.Stopwatch timer, java.lang.String action, java.lang.String task)
void
removeReadOrderRequest(java.lang.String readRequestID)
-
-
-
Constructor Detail
-
DefaultOfferServiceImpl
public DefaultOfferServiceImpl(ContentAddressableStorage defaultStorage, ReadRequestReferentialRepository readRequestReferentialRepository, OfferLogCompactionDatabaseService offerLogCompactionDatabaseService, OfferLogDatabaseService offerDatabaseService, OfferSequenceDatabaseService offerSequenceDatabaseService, StorageConfiguration configuration, OfferLogCompactionConfiguration offerLogCompactionConfig, OfferLogAndCompactedOfferLogService offerLogAndCompactedOfferLogService, int maxBatchThreadPoolSize, int batchMetadataComputationTimeout)
-
-
Method Detail
-
getObjectDigest
public java.lang.String getObjectDigest(java.lang.String containerName, java.lang.String objectId, DigestType digestAlgorithm) throws ContentAddressableStorageException
Description copied from interface:DefaultOfferService
Get offer storage digest of object- Specified by:
getObjectDigest
in interfaceDefaultOfferService
- Parameters:
containerName
- the container with the objectobjectId
- the object name / iddigestAlgorithm
- the digest algorithm- Returns:
- the offer computed digest
- Throws:
ContentAddressableStorageException
- thrown on storage error
-
getObject
public ObjectContent getObject(java.lang.String containerName, java.lang.String objectId) throws ContentAddressableStorageException
Description copied from interface:DefaultOfferService
Get object on offer as an inputStream- Specified by:
getObject
in interfaceDefaultOfferService
- Parameters:
containerName
- the container containing the objectobjectId
- the object id- Returns:
- the object included in a response
- Throws:
ContentAddressableStorageNotFoundException
- thrown when object does not existsContentAddressableStorageException
- thrown when a server error occurs
-
createReadOrderRequest
public java.util.Optional<TapeReadRequestReferentialEntity> createReadOrderRequest(java.lang.String containerName, java.util.List<java.lang.String> objectsIds) throws ContentAddressableStorageException
Description copied from interface:DefaultOfferService
create read order (asynchronous read from tape to local FS) for the given @containerName and objects list. Return read order ID- Specified by:
createReadOrderRequest
in interfaceDefaultOfferService
- Parameters:
containerName
- the container containing the objectobjectsIds
- the objects ids- Returns:
- readOrder entity
- Throws:
ContentAddressableStorageNotFoundException
- thrown when object does not existsContentAddressableStorageException
- thrown when a server error occurs
-
getReadOrderRequest
public java.util.Optional<TapeReadRequestReferentialEntity> getReadOrderRequest(java.lang.String readRequestID) throws ContentAddressableStorageException
- Specified by:
getReadOrderRequest
in interfaceDefaultOfferService
- Throws:
ContentAddressableStorageException
-
removeReadOrderRequest
public void removeReadOrderRequest(java.lang.String readRequestID) throws ContentAddressableStorageException
- Specified by:
removeReadOrderRequest
in interfaceDefaultOfferService
- Throws:
ContentAddressableStorageException
-
createObject
public java.lang.String createObject(java.lang.String containerName, java.lang.String objectId, java.io.InputStream objectPart, DataCategory type, java.lang.Long size, DigestType digestType) throws ContentAddressableStorageException
Description copied from interface:DefaultOfferService
Create object on container with objectId Receive object part of object. Actually these parts HAVE TO be send in the great order.- Specified by:
createObject
in interfaceDefaultOfferService
- Parameters:
containerName
- the container nameobjectId
- the offer objectId to createobjectPart
- the part of the object to create (chunk style)type
- the object type to createsize
- inputstream sizedigestType
- digest of object- Returns:
- the digest of the complete file or the digest of the chunk
- Throws:
ContentAddressableStorageException
- if the container does not exist
-
bulkPutObjects
public StorageBulkPutResult bulkPutObjects(java.lang.String containerName, java.util.List<java.lang.String> objectIds, MultiplexedStreamReader multiplexedStreamReader, DataCategory type, DigestType digestType) throws ContentAddressableStorageException, java.io.IOException
- Specified by:
bulkPutObjects
in interfaceDefaultOfferService
- Throws:
ContentAddressableStorageException
java.io.IOException
-
isObjectExist
public boolean isObjectExist(java.lang.String containerName, java.lang.String objectId) throws ContentAddressableStorageServerException
Description copied from interface:DefaultOfferService
Check if object exists- Specified by:
isObjectExist
in interfaceDefaultOfferService
- Parameters:
containerName
- the container suppose to contain the objectobjectId
- the objectId to check- Returns:
- true if object exists, false otherwise
- Throws:
ContentAddressableStorageServerException
-
getCapacity
public ContainerInformation getCapacity(java.lang.String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Description copied from interface:DefaultOfferService
Get container capacity- Specified by:
getCapacity
in interfaceDefaultOfferService
- Parameters:
containerName
- the container name- Returns:
- Json with usableSpace information
- Throws:
ContentAddressableStorageNotFoundException
- thrown if the container does not existContentAddressableStorageServerException
-
deleteObject
public void deleteObject(java.lang.String containerName, java.lang.String objectId, DataCategory type) throws ContentAddressableStorageException
Description copied from interface:DefaultOfferService
Deletes a object representing the data at location containerName/objectName- Specified by:
deleteObject
in interfaceDefaultOfferService
- Parameters:
containerName
- container where this exists.objectId
- the objectId to deletetype
- the object type to delete- Throws:
ContentAddressableStorageNotFoundException
- Thrown when the container cannot be located or the blob cannot be located in the container.ContentAddressableStorageException
- Thrown when delete action failed due some other failure
-
getMetadata
public StorageMetadataResult getMetadata(java.lang.String containerName, java.lang.String objectId, boolean noCache) throws ContentAddressableStorageException, java.io.IOException
Description copied from interface:DefaultOfferService
Get Metadata- Specified by:
getMetadata
in interfaceDefaultOfferService
- Returns:
- StorageMetadataResult
- Throws:
ContentAddressableStorageException
java.io.IOException
-
getBulkMetadata
public StorageBulkMetadataResult getBulkMetadata(java.lang.String containerName, java.util.List<java.lang.String> objectIds, java.lang.Boolean noCache) throws ContentAddressableStorageException
- Specified by:
getBulkMetadata
in interfaceDefaultOfferService
- Throws:
ContentAddressableStorageException
-
listObjects
public void listObjects(java.lang.String containerName, ObjectListingListener objectListingListener) throws java.io.IOException, ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
Description copied from interface:DefaultOfferService
List container objects- Specified by:
listObjects
in interfaceDefaultOfferService
- Parameters:
containerName
- the container nameobjectListingListener
- a listener to which are reported found object entries- Throws:
java.io.IOException
ContentAddressableStorageNotFoundException
ContentAddressableStorageServerException
-
getOfferLogs
public java.util.List<OfferLog> getOfferLogs(java.lang.String containerName, java.lang.Long offset, int limit, Order order) throws ContentAddressableStorageDatabaseException
Description copied from interface:DefaultOfferService
Get the offer log of objects created in offer container- Specified by:
getOfferLogs
in interfaceDefaultOfferService
- Parameters:
containerName
- container the container nameoffset
- the offset of the object before the wanted listlimit
- number of objects wantedorder
- order of search- Returns:
- list of object informations
- Throws:
ContentAddressableStorageDatabaseException
- Database error
-
checkOfferPath
public void checkOfferPath(java.lang.String... paths) throws java.io.IOException
- Specified by:
checkOfferPath
in interfaceDefaultOfferService
- Throws:
java.io.IOException
-
compactOfferLogs
public void compactOfferLogs() throws java.lang.Exception
- Specified by:
compactOfferLogs
in interfaceDefaultOfferService
- Throws:
java.lang.Exception
-
log
public void log(com.google.common.base.Stopwatch timer, java.lang.String action, java.lang.String task)
-
-