Package fr.gouv.vitam.common.storage.cas.container.api

# Interface ContentAddressableStorage

All Superinterfaces:
  `AutoCloseable`, `VitamAutoCloseable`

All Known Implementing Classes:
  `AmazonS3V2`, `ContentAddressableStorageAbstract`, `ContentAddressableStorageJcloudsAbstract`, `FileSystem`, `HashFileSystem`, `OpenstackSwift`, `Swift`, `TapeLibraryContentAddressableStorage`

public interface ContentAddressableStorage extends VitamAutoCloseable
The ContentAddressableStorage interface.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `default Map<String,AccessRequestStatus>`
  `checkAccessRequestStatuses(List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed)`
  Checks status of access requests by id.
  `default boolean`
  `checkObjectAvailability(String containerName, List<String> objectNames)`
  Check object availability for async offers.
  `void`
  `checkObjectDigestAndStoreDigest(String containerName, String objectName, String objectDigest, DigestType digestType, long size)`
  Checks objet digest invalid input: '&' update persist its digest in object metadata
  `default String`
  `createAccessRequest(String containerName, List<String> objectNames)`
  Create an access request for objects (asynchronous read from tape to local FS).
  `void`
  `createContainer(String containerName)`
  Creates a container
  `void`
  `deleteObject(String containerName, String objectName)`
  Deletes a object representing the data at location containerName/objectName
  `ContainerInformation`
  `getContainerInformation(String containerName)`
  Get container information like capacity
  `ObjectContent`
  `getObject(String containerName, String objectName)`
  Retrieves an object representing the data at location containerName/objectName
  `String`
  `getObjectDigest(String containerName, String objectName, DigestType algo, boolean noCache)`
  compute Object Digest using a defined algorithm
  `MetadatasObject`
  `getObjectMetadata(String containerName, String objectId, boolean noCache)`
  get metadata of the object
  `boolean`
  `isExistingContainer(String containerName)`
  Determines if a container exists
  `boolean`
  `isExistingObject(String containerName, String objectName)`
  Determines if an object exists
  `void`
  `listContainer(String containerName, ObjectListingListener objectListingListener)`
  List container objects
  `default String`
  `putObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size)`
  `default void`
  `removeAccessRequest(String accessRequestId, boolean adminCrossTenantAccessRequestAllowed)`
  Delete access request.
  `void`
  `writeObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size)`
  Adds an object representing the data at location containerName/objectName

  ### Methods inherited from interface fr.gouv.vitam.common.model.VitamAutoCloseable

  `close`

- ## Method Details

  - ### createContainer

    void createContainer(String containerName) throws ContentAddressableStorageServerException
    Creates a container
    Parameters:
      `containerName` - name of container to create
    Throws:
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### isExistingContainer

    boolean isExistingContainer(String containerName) throws ContentAddressableStorageServerException
    Determines if a container exists
    Parameters:
      `containerName` - name of container
    Returns:
      boolean type
    Throws:
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### writeObject

    void writeObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size) throws ContentAddressableStorageException
    Adds an object representing the data at location containerName/objectName
    Parameters:
      `containerName` - container to place the object.
      `objectName` - fully qualified object name relative to the container.
      `inputStream` - the data
      `digestType` - parameter to compute an hash.
      `size` - size off the input stream
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageException` - Thrown when put action failed due some other failure
      `ContentAddressableStorageAlreadyExistException` - Thrown when object creating exists

  - ### checkObjectDigestAndStoreDigest

    void checkObjectDigestAndStoreDigest(String containerName, String objectName, String objectDigest, DigestType digestType, long size) throws ContentAddressableStorageException
    Checks objet digest invalid input: '&' update persist its digest in object metadata
    Parameters:
      `containerName` - container to place the object.
      `objectName` - fully qualified object name relative to the container.
      `objectDigest` - object digest value
      `digestType` - object digest type
      `size` - size off the input stream
    Throws:
      `ContentAddressableStorageException`

  - ### putObject

    default String putObject(String containerName, String objectName, InputStream inputStream, DigestType digestType, long size) throws ContentAddressableStorageException
    Throws:
      `ContentAddressableStorageException`

  - ### getObject

    ObjectContent getObject(String containerName, String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageException, ContentAddressableStorageUnavailableDataFromAsyncOfferException
    Retrieves an object representing the data at location containerName/objectName

    Parameters:
      `containerName` - container where this exists.
      `objectName` - fully qualified name relative to the container.
    Returns:
      the object you intended to receive
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageUnavailableDataFromAsyncOfferException` - Thrown when object cannot be read due to missing access request on AsyncRead ContentAddressableStorage
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure

  - ### createAccessRequest

    default String createAccessRequest(String containerName, List<String> objectNames) throws ContentAddressableStorageException
    Create an access request for objects (asynchronous read from tape to local FS). Return access request identifier
    Parameters:
      `containerName` - container where this exists.
      `objectNames` - list of objects names for which access is requested
    Returns:
      access request identifier
    Throws:
      `ContentAddressableStorageException`

  - ### checkAccessRequestStatuses

    default Map<String,AccessRequestStatus> checkAccessRequestStatuses(List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed) throws ContentAddressableStorageException
    Checks status of access requests by id.
    Parameters:
      `accessRequestIds` - the identifiers of the access requests to check
      `adminCrossTenantAccessRequestAllowed` - when `true`, access to access requests of other tenants is allowed from Admin tenant
    Returns:
      `AccessRequestStatus` representing access request status
    Throws:
      `ContentAddressableStorageException`

  - ### removeAccessRequest

    default void removeAccessRequest(String accessRequestId, boolean adminCrossTenantAccessRequestAllowed) throws ContentAddressableStorageException
    Delete access request. Ignored if no access request found (not exists, expired or already canceled).
    Parameters:
      `accessRequestId` - the identifier of the access request to cancel.
      `adminCrossTenantAccessRequestAllowed` - when `true`, removing access requests of other tenants is allowed from Admin tenant
    Throws:
      `ContentAddressableStorageException`

  - ### checkObjectAvailability

    default boolean checkObjectAvailability(String containerName, List<String> objectNames) throws ContentAddressableStorageException
    Check object availability for async offers.
    Parameters:
      `containerName` - container where this exists.
      `objectNames` - list of objects names for which availability is to be checked.
    Returns:
      `true` if ALL objects are available, otherwise `false`.
    Throws:
      `ContentAddressableStorageException`

  - ### deleteObject

    void deleteObject(String containerName, String objectName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageException
    Deletes a object representing the data at location containerName/objectName
    Parameters:
      `containerName` - container where this exists.
      `objectName` - fully qualified name relative to the container.
    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

  - ### isExistingObject

    boolean isExistingObject(String containerName, String objectName) throws ContentAddressableStorageException
    Determines if an object exists
    Parameters:
      `containerName` - container where the object resides
      `objectName` - fully qualified name relative to the container.
    Returns:
      boolean type
    Throws:
      `ContentAddressableStorageServerException` - Thrown when internal server error happens
      `ContentAddressableStorageException`

  - ### getObjectDigest

    String getObjectDigest(String containerName, String objectName, DigestType algo, boolean noCache) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException, ContentAddressableStorageException
    compute Object Digest using a defined algorithm
    Parameters:
      `containerName` - container where this exists.
      `objectName` - fully qualified name relative to the container.
      `algo` - Digest algo
      `noCache` - forces full digest computation
    Returns:
      the digest object as String
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container or the object cannot be located
      `ContentAddressableStorageServerException` - Thrown when internal server error happens
      `ContentAddressableStorageException` - Thrown when put action failed due some other failure

  - ### getContainerInformation

    ContainerInformation getContainerInformation(String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
    Get container information like capacity
    Parameters:
      `containerName` - the container name
    Returns:
      container information like usableSpace
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### getObjectMetadata

    MetadatasObject getObjectMetadata(String containerName, String objectId, boolean noCache) throws ContentAddressableStorageException
    get metadata of the object
    Parameters:
      `containerName` - the container name
      `objectId` - the objectId to check
    Returns:
      MetadatasObjectResult
    Throws:
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure
      `IOException` - if an IOException is encountered with files
      `IllegalArgumentException` - thrown when containerName or objectId is null

  - ### listContainer

    void listContainer(String containerName, ObjectListingListener objectListingListener) throws ContentAddressableStorageException, IOException
    List container objects
    Parameters:
      `containerName` - the container name
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens
      `ContentAddressableStorageException`
      `IOException`