Package fr.gouv.vitam.workspace.common

# Interface WorkspaceContentAddressableStorage

All Known Implementing Classes:
  `WorkspaceFileSystem`

public interface WorkspaceContentAddressableStorage

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `computeObjectDigest(String containerName, String objectName, DigestType algo)`
  compute Object Digest using a defined algorithm
  `void`
  `createContainer(String containerName)`
  Creates a container
  `void`
  `createFolder(String containerName, String folderName)`
  Creates a folder (or a directory) marker depending on the service
  `void`
  `deleteContainer(String containerName, boolean recursive)`
  Deletes everything inside a container recursively.
  `void`
  `deleteFolder(String containerName, String folderName)`
  Deletes a folder (or a directory) marker depending on the service
  `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
  `Map<String,FileParams>`
  `getFilesWithParamsFromFolder(String containerName, String folderName)`
  `List<URI>`
  `getListUriDigitalObjectFromFolder(String containerName, String folderName, int limit)`
  Retrieves recursively the uri list of object inside a folder rootFolder/subfolder/ with batch size
  `jakarta.ws.rs.core.Response`
  `getObject(String containerName, String objectName, Long chunkOffset, Long maxChunkSize)`
  Retrieves an object representing the data at location containerName/objectName
  `com.fasterxml.jackson.databind.JsonNode`
  `getObjectInformation(String containerName, String objectName)`
  Retrieves information about an object at location containerName/objectName
  `boolean`
  `isExistingContainer(String containerName)`
  Determines if a container exists
  `boolean`
  `isExistingFolder(String containerName, String folderName)`
  Determines if a folder (or a directory) exists
  `boolean`
  `isExistingObject(String containerName, String objectName)`
  Determines if an object exists
  `void`
  `moveObjects(String containerName, List<BulkMoveEntry> entries)`
  Bulk move objects of a container
  `void`
  `purgeContainer(String containerName)`
  Deletes the contents of a container at its root path without deleting the container
  `void`
  `purgeOldFilesInContainer(String containerName, TimeToLive timeToLive)`
  `void`
  `putAtomicObject(String containerName, String objectName, InputStream stream, long size)`
  `void`
  `putObject(String containerName, String objectName, InputStream stream)`
  Adds an object representing the data at location containerName/objectName
  `void`
  `uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject)`
  create container: will be identified by GUID and extract objects and push it on the container

- ## Method Details

  - ### createContainer

    void createContainer(String containerName) throws ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
    Creates a container
    Parameters:
      `containerName` - name of container to create
    Throws:
      `ContentAddressableStorageAlreadyExistException` - Thrown when creating a container while it (containerName) already exists
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### purgeContainer

    void purgeContainer(String containerName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
    Deletes the contents of a container at its root path without deleting the container

    Note: this function will delete everything inside a container recursively.

    Parameters:
      `containerName` - name of container to purge
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### deleteContainer

    void deleteContainer(String containerName, boolean recursive) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
    Deletes everything inside a container recursively.
    Parameters:
      `containerName` - name of the container to delete
      `recursive` - false : deletes a container if it is empty, true : deletes everything recursively
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### isExistingContainer

    boolean isExistingContainer(String containerName)
    Determines if a container exists
    Parameters:
      `containerName` - name of container
    Returns:
      boolean type
    Throws:
      `ContentAddressableStorageServerException`

  - ### createFolder

    void createFolder(String containerName, String folderName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageAlreadyExistException, ContentAddressableStorageServerException
    Creates a folder (or a directory) marker depending on the service
    Parameters:
      `containerName` - container to create the directory in
      `folderName` - full path to the folder (or directory)
    Throws:
      `ContentAddressableStorageAlreadyExistException` - Thrown when creating a directory while it already exists
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### deleteFolder

    void deleteFolder(String containerName, String folderName) throws ContentAddressableStorageNotFoundException, ContentAddressableStorageServerException
    Deletes a folder (or a directory) marker depending on the service
    Parameters:
      `containerName` - container to delete the folder from
      `folderName` - full path to the folder to delete
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the directory cannot be located.
      `ContentAddressableStorageServerException` - Thrown when internal server error happens

  - ### isExistingFolder

    boolean isExistingFolder(String containerName, String folderName)
    Determines if a folder (or a directory) exists
    Parameters:
      `containerName` - container where the folder resides
      `folderName` - full path to the folder
    Returns:
      boolean type

  - ### getListUriDigitalObjectFromFolder

    List<URI> getListUriDigitalObjectFromFolder(String containerName, String folderName, int limit) throws ContentAddressableStorageException
    Retrieves recursively the uri list of object inside a folder rootFolder/subfolder/ with batch size
    Parameters:
      `containerName` - not null allowed container where this exists.
      `folderName` - not null allowed fully qualified folder name relative to the container.
      `limit` - the maximum number of URIs to return
    Returns:
      a list of URI limited by the batch size
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure

  - ### uncompressObject

    void uncompressObject(String containerName, String folderName, String archiveMimeType, InputStream inputStreamObject) throws ContentAddressableStorageException
    create container: will be identified by GUID and extract objects and push it on the container
    Parameters:
      `containerName` - : the container name (will be Guid created in ingest module)
      `folderName` - : the folder name
      `archiveMimeType` - : the archive type (zip, tar, tar.gz, tar.bz2)
      `inputStreamObject` - : SIP input stream
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located
      `ContentAddressableStorageAlreadyExistException` - Thrown when folder exists
      `ContentAddressableStorageServerException` - Thrown when internal server error happens
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure
      `ContentAddressableStorageCompressedFileException` - Thrown when the file is not a zip or an empty zip

  - ### putObject

    void putObject(String containerName, String objectName, InputStream stream) 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.
      `stream` - the data
    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

  - ### putAtomicObject

    void putAtomicObject(String containerName, String objectName, InputStream stream, long size) throws ContentAddressableStorageException
    Throws:
      `ContentAddressableStorageException`

  - ### getObject

    jakarta.ws.rs.core.Response getObject(String containerName, String objectName, Long chunkOffset, Long maxChunkSize) throws ContentAddressableStorageException
    Retrieves an object representing the data at location containerName/objectName

    WARNING : use this method only if the response has to be consumed right away.

    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.
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure
      `ContentAddressableStorageAlreadyExistException` - Thrown when object creating exists

  - ### deleteObject

    void deleteObject(String containerName, String objectName) throws 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 get action failed due some other failure

  - ### isExistingObject

    boolean isExistingObject(String containerName, String objectName)
    Determines if an object exists
    Parameters:
      `containerName` - container where the object resides
      `objectName` - fully qualified name relative to the container.
    Returns:
      boolean type

  - ### computeObjectDigest

    String computeObjectDigest(String containerName, String objectName, DigestType algo) throws 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
    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 storage is not available or container does not exist
      `ContentAddressableStorageServerException`

  - ### getObjectInformation

    com.fasterxml.jackson.databind.JsonNode getObjectInformation(String containerName, String objectName) throws ContentAddressableStorageException
    Retrieves information about an object at location containerName/objectName
    Parameters:
      `containerName` - container where the object is.
      `objectName` - fully qualified name relative to the container.
    Returns:
      the object informations as a JsonNode object
    Throws:
      `ContentAddressableStorageNotFoundException` - Thrown when the container cannot be located.
      `ContentAddressableStorageException` - Thrown when get action failed due some other failure

  - ### purgeOldFilesInContainer

    void purgeOldFilesInContainer(String containerName, TimeToLive timeToLive) throws ContentAddressableStorageException
    Throws:
      `ContentAddressableStorageException`

  - ### getFilesWithParamsFromFolder

    Map<String,FileParams> getFilesWithParamsFromFolder(String containerName, String folderName) throws ContentAddressableStorageException
    Throws:
      `ContentAddressableStorageException`

  - ### moveObjects

    void moveObjects(String containerName, List<BulkMoveEntry> entries) throws ContentAddressableStorageException
    Bulk move objects of a container
    Parameters:
      `containerName` - the container name in which data is persisted
      `entries` - list of source/destination object name pairs
    Throws:
      `ContentAddressableStorageException`