Package fr.gouv.vitam.storage.offers.core

# Class DefaultOfferServiceImpl

java.lang.Object
fr.gouv.vitam.storage.offers.core.DefaultOfferServiceImpl

All Implemented Interfaces:
  `DefaultOfferService`

public class DefaultOfferServiceImpl extends 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, OfferLogCompactionDatabaseService offerLogCompactionDatabaseService, OfferLogDatabaseService offerDatabaseService, OfferSequenceDatabaseService offerSequenceDatabaseService, StorageConfiguration configuration, OfferLogCompactionConfiguration offerLogCompactionConfig, OfferLogAndCompactedOfferLogService offerLogAndCompactedOfferLogService, int maxBatchThreadPoolSize, int batchMetadataComputationTimeout, boolean cleanupObjectsOnWriteError)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `StorageBulkPutResult`
  `bulkPutObjects(String containerName, List<String> objectIds, MultiplexedStreamReader multiplexedStreamReader, DataCategory type, DigestType digestType)`
  `Map<String,AccessRequestStatus>`
  `checkAccessRequestStatuses(List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed)`
  `boolean`
  `checkObjectAvailability(String containerName, List<String> objectNames)`
  `void`
  `compactOfferLogs()`
  `String`
  `createAccessRequest(String containerName, List<String> objectNames)`
  Create access request (asynchronous read from tape to local FS) for the given @containerName and objects list.
  `String`
  `createObject(String containerName, String objectId, InputStream objectPart, DataCategory type, long size, DigestType digestType)`
  Create object on container with objectId Receive object part of object.
  `void`
  `deleteObject(String containerName, String objectId, DataCategory type)`
  Deletes a object representing the data at location containerName/objectName
  `StorageBulkMetadataResult`
  `getBulkMetadata(String containerName, List<String> objectIds, Boolean noCache)`
  `ContainerInformation`
  `getCapacity(String containerName)`
  Get container capacity
  `StorageMetadataResult`
  `getMetadata(String containerName, String objectId, boolean noCache)`
  Get Metadata
  `ObjectContent`
  `getObject(String containerName, String objectId)`
  Get object on offer as an inputStream
  `String`
  `getObjectDigest(String containerName, String objectId, DigestType digestAlgorithm)`
  Get offer storage digest of object
  `List<OfferLog>`
  `getOfferLogs(String containerName, Long offset, int limit, Order order)`
  Get the offer log of objects created in offer container
  `boolean`
  `isObjectExist(String containerName, String objectId)`
  Check if object exists
  `void`
  `listObjects(String containerName, ObjectListingListener objectListingListener)`
  List container objects
  `void`
  `log(com.google.common.base.Stopwatch timer, String action, String task)`
  `void`
  `removeAccessRequest(String accessRequestId, boolean adminCrossTenantAccessRequestAllowed)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### DefaultOfferServiceImpl

    public DefaultOfferServiceImpl(ContentAddressableStorage defaultStorage, OfferLogCompactionDatabaseService offerLogCompactionDatabaseService, OfferLogDatabaseService offerDatabaseService, OfferSequenceDatabaseService offerSequenceDatabaseService, StorageConfiguration configuration, OfferLogCompactionConfiguration offerLogCompactionConfig, OfferLogAndCompactedOfferLogService offerLogAndCompactedOfferLogService, int maxBatchThreadPoolSize, int batchMetadataComputationTimeout, boolean cleanupObjectsOnWriteError)

- ## Method Details

  - ### getObjectDigest

    public String getObjectDigest(String containerName, String objectId, DigestType digestAlgorithm) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Get offer storage digest of object
    Specified by:
      `getObjectDigest` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container with the object
      `objectId` - the object name / id
      `digestAlgorithm` - the digest algorithm
    Returns:
      the offer computed digest
    Throws:
      `ContentAddressableStorageException` - thrown on storage error

  - ### getObject

    public ObjectContent getObject(String containerName, String objectId) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Get object on offer as an inputStream
    Specified by:
      `getObject` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container containing the object
      `objectId` - the object id
    Returns:
      the object included in a response
    Throws:
      `ContentAddressableStorageException` - thrown when a server error occurs

  - ### createAccessRequest

    public String createAccessRequest(String containerName, List<String> objectNames) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Create access request (asynchronous read from tape to local FS) for the given @containerName and objects list. Return access request id
    Specified by:
      `createAccessRequest` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container containing the object
      `objectNames` - the objects ids
    Returns:
      acess request id
    Throws:
      `ContentAddressableStorageException` - thrown when a server error occurs

  - ### checkAccessRequestStatuses

    public Map<String,AccessRequestStatus> checkAccessRequestStatuses(List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed) throws ContentAddressableStorageException
    Specified by:
      `checkAccessRequestStatuses` in interface `DefaultOfferService`
    Throws:
      `ContentAddressableStorageException`

  - ### removeAccessRequest

    public void removeAccessRequest(String accessRequestId, boolean adminCrossTenantAccessRequestAllowed) throws ContentAddressableStorageException
    Specified by:
      `removeAccessRequest` in interface `DefaultOfferService`
    Throws:
      `ContentAddressableStorageException`

  - ### checkObjectAvailability

    public boolean checkObjectAvailability(String containerName, List<String> objectNames) throws ContentAddressableStorageException
    Specified by:
      `checkObjectAvailability` in interface `DefaultOfferService`
    Throws:
      `ContentAddressableStorageException`

  - ### createObject

    public String createObject(String containerName, String objectId, InputStream objectPart, DataCategory type, 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 interface `DefaultOfferService`
    Parameters:
      `containerName` - the container name
      `objectId` - the offer objectId to create
      `objectPart` - the part of the object to create (chunk style)
      `type` - the object type to create
      `size` - inputstream size
      `digestType` - 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(String containerName, List<String> objectIds, MultiplexedStreamReader multiplexedStreamReader, DataCategory type, DigestType digestType) throws ContentAddressableStorageException, IOException
    Specified by:
      `bulkPutObjects` in interface `DefaultOfferService`
    Throws:
      `ContentAddressableStorageException`
      `IOException`

  - ### isObjectExist

    public boolean isObjectExist(String containerName, String objectId) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Check if object exists
    Specified by:
      `isObjectExist` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container suppose to contain the object
      `objectId` - the objectId to check
    Returns:
      true if object exists, false otherwise
    Throws:
      `ContentAddressableStorageException`

  - ### getCapacity

    public ContainerInformation getCapacity(String containerName) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Get container capacity
    Specified by:
      `getCapacity` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container name
    Returns:
      Json with usableSpace information
    Throws:
      `ContentAddressableStorageException`

  - ### deleteObject

    public void deleteObject(String containerName, 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 interface `DefaultOfferService`
    Parameters:
      `containerName` - container where this exists.
      `objectId` - the objectId to delete
      `type` - the object type to delete
    Throws:
      `ContentAddressableStorageException` - Thrown when delete action failed due some other failure

  - ### getMetadata

    public StorageMetadataResult getMetadata(String containerName, String objectId, boolean noCache) throws ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    Get Metadata
    Specified by:
      `getMetadata` in interface `DefaultOfferService`
    Parameters:
      `containerName` -
      `objectId` -
      `noCache` -
    Returns:
      StorageMetadataResult
    Throws:
      `ContentAddressableStorageException`

  - ### getBulkMetadata

    public StorageBulkMetadataResult getBulkMetadata(String containerName, List<String> objectIds, Boolean noCache) throws ContentAddressableStorageException
    Specified by:
      `getBulkMetadata` in interface `DefaultOfferService`
    Throws:
      `ContentAddressableStorageException`

  - ### listObjects

    public void listObjects(String containerName, ObjectListingListener objectListingListener) throws IOException, ContentAddressableStorageException
    Description copied from interface: `DefaultOfferService`
    List container objects
    Specified by:
      `listObjects` in interface `DefaultOfferService`
    Parameters:
      `containerName` - the container name
      `objectListingListener` - a listener to which are reported found object entries
    Throws:
      `IOException`
      `ContentAddressableStorageException`

  - ### getOfferLogs

    public List<OfferLog> getOfferLogs(String containerName, 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 interface `DefaultOfferService`
    Parameters:
      `containerName` - container the container name
      `offset` - the offset of the object before the wanted list
      `limit` - number of objects wanted
      `order` - order of search
    Returns:
      list of object informations
    Throws:
      `ContentAddressableStorageDatabaseException` - Database error

  - ### compactOfferLogs

    public void compactOfferLogs() throws Exception
    Specified by:
      `compactOfferLogs` in interface `DefaultOfferService`
    Throws:
      `Exception`

  - ### log

    public void log(com.google.common.base.Stopwatch timer, String action, String task)