Package fr.gouv.vitam.storage.engine.client

# Interface StorageClient

All Superinterfaces:
  `AutoCloseable`, `BasicClient`, `MockOrRestClient`, `VitamAutoCloseable`

All Known Implementing Classes:
  `StorageClientMock`

public interface StorageClient extends BasicClient
Storage Client interface

- ## Field Summary

  ### Fields inherited from interface fr.gouv.vitam.common.client.BasicClient

  `STATUS_URL`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `BulkObjectStoreResponse`
  `bulkStoreFilesFromWorkspace(String strategyId, BulkObjectStoreRequest bulkObjectStoreRequest)`
  Store objects available in workspace into offers
  `Map<String,AccessRequestStatus>`
  `checkAccessRequestStatuses(String strategyId, String offerId, List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed)`
  Check access request statuses of asynchronous offer.
  `BulkObjectAvailabilityResponse`
  `checkBulkObjectAvailability(String strategyId, String offerId, BulkObjectAvailabilityRequest bulkObjectAvailabilityRequest)`
  Checks immediate object availability in storage offer.
  `RequestResponseOK`
  `copyObjectFromOfferToOffer(String objectId, DataCategory category, String source, String destination, String strategyId)`
  `RequestResponseOK`
  `create(String strategyId, String objectId, DataCategory category, InputStream inputStream, Long inputStreamSize, List<String> offerIds)`
  `Optional<String>`
  `createAccessRequestIfRequired(String strategyId, String offerId, DataCategory dataCategory, List<String> objectNames)`
  Create access request if target offer does not support synchronous read (tape library storage).
  `boolean`
  `delete(String strategyId, DataCategory type, String guid)`
  Delete an object of given type in the storage offer strategy
  `boolean`
  `delete(String strategyId, DataCategory type, String guid, List<String> offerIds)`
  Delete an object of given type in the storage offer strategy
  `Map<String,Boolean>`
  `exists(String strategyId, DataCategory type, String guid, List<String> offerIds)`
  Check the existence of an object in storage by its id and type `DataCategory`.
  `RequestResponse<BatchObjectInformationResponse>`
  `getBatchObjectInformation(String strategyId, DataCategory type, Collection<String> offerIds, Collection<String> objectIds)`
  Get object information from objects in storage
  `jakarta.ws.rs.core.Response`
  `getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo)`
  Retrieves a binary object knowing its guid as an inputStream for a specific tenant/strategy
  `jakarta.ws.rs.core.Response`
  `getContainerAsync(String strategyId, String offerId, String objectName, DataCategory type, AccessLogInfoModel logInfo)`
  Retrieves a binary object knowing its guid as an inputStream for a specific tenant/strategy/offerId
  `com.fasterxml.jackson.databind.JsonNode`
  `getInformation(String strategyId, DataCategory type, String guid, List<String> offerIds, boolean noCache)`
  Get object information from objects in storage
  `RequestResponse<OfferLog>`
  `getOfferLogs(String strategyId, String offerId, DataCategory type, Long offset, int limit, Order order)`
  Get offer log .
  `List<String>`
  `getOffers(String strategyId)`
  get List of offers for a strategy
  `String`
  `getReferentOffer(String strategy)`
  Get referent offer of strategy
  `com.fasterxml.jackson.databind.JsonNode`
  `getStorageInformation(String strategyId)`
  Check if the storage of objects could be done, knowing a required size
  `RequestResponse<StorageStrategy>`
  `getStorageStrategies()`
  Get strategies.
  `jakarta.ws.rs.core.Response`
  `launchOfferLogCompaction(VitamContext vitamContext, String offerId)`
  `CloseableIterator<ObjectEntry>`
  `listContainer(String strategyId, String offerId, DataCategory type)`
  List object type in container
  `void`
  `removeAccessRequest(String strategyId, String offerId, String accessRequestId, boolean adminCrossTenantAccessRequestAllowed)`
  Removes (cancel / delete) and access request for an asynchronous offer.
  `RequestResponseOK<StorageLogBackupResult>`
  `storageAccessLogBackup(List<Integer> tenants)`
  Call storage accesslog backup operation.
  `RequestResponseOK<StorageLogBackupResult>`
  `storageLogBackup(List<Integer> tenants)`
  Call storage log backup operation.
  `RequestResponseOK<StorageLogTraceabilityResult>`
  `storageLogTraceability(List<Integer> tenants)`
  Call storage log traceability operation.
  `StoredInfoResult`
  `storeFileFromWorkspace(String strategyId, DataCategory type, String guid, ObjectDescription description)`
  Store an object available in workspace by its vitam guid

  ### Methods inherited from interface fr.gouv.vitam.common.client.MockOrRestClient

  `checkStatus, checkStatus, close, consumeAnyEntityAndClose, getResourcePath, getServiceUrl`

- ## Method Details

  - ### getStorageInformation

    com.fasterxml.jackson.databind.JsonNode getStorageInformation(String strategyId) throws StorageNotFoundClientException, StorageServerClientException
    Check if the storage of objects could be done, knowing a required size
    Parameters:
      `strategyId` - the storage strategy id
    Returns:
      the capacity of the storage
    Throws:
      `StorageNotFoundClientException` - if the Server got a NotFound result
      `StorageServerClientException` - if the Server got an internal error

  - ### getOffers

    List<String> getOffers(String strategyId) throws StorageNotFoundClientException, StorageServerClientException
    get List of offers for a strategy
    Parameters:
      `strategyId` - strategyId
    Returns:
      list id of offers
    Throws:
      `StorageNotFoundClientException`
      `StorageServerClientException`

  - ### storeFileFromWorkspace

    StoredInfoResult storeFileFromWorkspace(String strategyId, DataCategory type, String guid, ObjectDescription description) throws StorageAlreadyExistsClientException, StorageNotFoundClientException, StorageServerClientException
    Store an object available in workspace by its vitam guid
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the type of object collection
      `guid` - vitam guid
      `description` - object description
    Returns:
      the result status of object creation
    Throws:
      `StorageAlreadyExistsClientException` - if the Server got a CONFLICT status result
      `StorageNotFoundClientException` - if the Server got a NotFound result
      `StorageServerClientException` - if the Server got an internal error

  - ### bulkStoreFilesFromWorkspace

    BulkObjectStoreResponse bulkStoreFilesFromWorkspace(String strategyId, BulkObjectStoreRequest bulkObjectStoreRequest) throws StorageAlreadyExistsClientException, StorageNotFoundClientException, StorageServerClientException
    Store objects available in workspace into offers
    Parameters:
      `strategyId` - the storage strategy id
      `bulkObjectStoreRequest` - request
    Returns:
      the result status of object creation
    Throws:
      `StorageAlreadyExistsClientException` - if the Server got a CONFLICT status result
      `StorageNotFoundClientException` - if the Server got a NotFound result
      `StorageServerClientException` - if the Server got an internal error

  - ### exists

    Map<String,Boolean> exists(String strategyId, DataCategory type, String guid, List<String> offerIds) throws StorageServerClientException
    Check the existence of an object in storage by its id and type `DataCategory`.
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the type of object collection
      `guid` - vitam guid
    Returns:
      true/false for each offer
    Throws:
      `StorageServerClientException` - if the Server got an internal error

  - ### delete

    boolean delete(String strategyId, DataCategory type, String guid) throws StorageServerClientException
    Delete an object of given type in the storage offer strategy
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the type of object collection
      `guid` - vitam guid
    Returns:
      true if deleted
    Throws:
      `StorageServerClientException` - if the Server got an internal error

  - ### delete

    boolean delete(String strategyId, DataCategory type, String guid, List<String> offerIds) throws StorageServerClientException
    Delete an object of given type in the storage offer strategy
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the type of object collection
      `guid` - vitam guid
      `offerIds` - offers ids to delete
    Returns:
      true if deleted
    Throws:
      `StorageServerClientException`

  - ### getContainerAsync

    jakarta.ws.rs.core.Response getContainerAsync(String strategyId, String guid, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException, StorageUnavailableDataFromAsyncOfferClientException
    Retrieves a binary object knowing its guid as an inputStream for a specific tenant/strategy
    Parameters:
      `strategyId` - the storage strategy id
      `guid` - vitam guid of the object to be returned
      `type` - the object type to list
      `logInfo` - additional information for accessLog
    Returns:
      the object requested
    Throws:
      `StorageServerClientException` - if the Server got an internal error
      `StorageNotFoundException` - if the Server got a NotFound result, if the container or the object does not exist
      `StorageUnavailableDataFromAsyncOfferClientException` - if object is not available for immediate access from async offer

  - ### getContainerAsync

    jakarta.ws.rs.core.Response getContainerAsync(String strategyId, String offerId, String objectName, DataCategory type, AccessLogInfoModel logInfo) throws StorageServerClientException, StorageNotFoundException, StorageUnavailableDataFromAsyncOfferClientException
    Retrieves a binary object knowing its guid as an inputStream for a specific tenant/strategy/offerId
    Parameters:
      `strategyId` -
      `offerId` -
      `objectName` -
      `type` -
      `logInfo` -
    Returns:
    Throws:
      `StorageServerClientException`
      `StorageNotFoundException`
      `StorageUnavailableDataFromAsyncOfferClientException`

  - ### listContainer

    CloseableIterator<ObjectEntry> listContainer(String strategyId, String offerId, DataCategory type) throws StorageServerClientException, StorageNotFoundClientException
    List object type in container
    Parameters:
      `strategyId` - the strategy ID
      `offerId` - the Offer ID
      `type` - the object type to list
    Returns:
      an iterator with object list
    Throws:
      `StorageServerClientException` - thrown if the server got an internal error
      `StorageNotFoundClientException`

  - ### storageAccessLogBackup

    RequestResponseOK<StorageLogBackupResult> storageAccessLogBackup(List<Integer> tenants) throws StorageServerClientException, InvalidParseOperationException
    Call storage accesslog backup operation.
    Parameters:
      `tenants` - tenants list to backup
    Returns:
      Storage logbook backup response
    Throws:
      `StorageServerClientException`
      `InvalidParseOperationException`

  - ### storageLogBackup

    RequestResponseOK<StorageLogBackupResult> storageLogBackup(List<Integer> tenants) throws StorageServerClientException, InvalidParseOperationException
    Call storage log backup operation.
    Parameters:
      `tenants` - tenants list to backup
    Returns:
      Storage logbook backup response
    Throws:
      `StorageServerClientException` - StorageServerClientException
      `InvalidParseOperationException` - InvalidParseOperationException

  - ### storageLogTraceability

    RequestResponseOK<StorageLogTraceabilityResult> storageLogTraceability(List<Integer> tenants) throws StorageServerClientException, InvalidParseOperationException
    Call storage log traceability operation.
    Parameters:
      `tenants` -
    Returns:
      storage log traceability response
    Throws:
      `StorageServerClientException` - StorageServerClientException
      `InvalidParseOperationException` - InvalidParseOperationException

  - ### getInformation

    com.fasterxml.jackson.databind.JsonNode getInformation(String strategyId, DataCategory type, String guid, List<String> offerIds, boolean noCache) throws StorageServerClientException, StorageNotFoundClientException
    Get object information from objects in storage
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the object type to list
      `guid` - vitam guid
      `offerIds` - offers ids to delete
      `noCache` - noCache forces digest computation.
    Returns:
      informations
    Throws:
      `StorageServerClientException` - StorageServerClientException
      `StorageNotFoundClientException` - StorageNotFoundClientException

  - ### getBatchObjectInformation

    RequestResponse<BatchObjectInformationResponse> getBatchObjectInformation(String strategyId, DataCategory type, Collection<String> offerIds, Collection<String> objectIds) throws StorageServerClientException
    Get object information from objects in storage
    Parameters:
      `strategyId` - the storage strategy id
      `type` - the object type to list
      `offerIds` - offers ids
      `objectIds` - list of object ids
    Returns:
      informations
    Throws:
      `StorageServerClientException` - StorageServerClientException

  - ### copyObjectFromOfferToOffer

    RequestResponseOK copyObjectFromOfferToOffer(String objectId, DataCategory category, String source, String destination, String strategyId) throws StorageServerClientException, InvalidParseOperationException, StorageUnavailableDataFromAsyncOfferClientException
    Parameters:
      `objectId` - objectId
      `category` - category
      `source` - source
      `destination` - destination
      `strategyId` - strategyId
    Returns:
      RequestResponseOK
    Throws:
      `StorageServerClientException` - StorageServerClientException
      `InvalidParseOperationException` - StorageServerClientException
      `StorageUnavailableDataFromAsyncOfferClientException`

  - ### create

    RequestResponseOK create(String strategyId, String objectId, DataCategory category, InputStream inputStream, Long inputStreamSize, List<String> offerIds) throws StorageServerClientException, InvalidParseOperationException
    Parameters:
      `strategyId` - strategyId
      `objectId` - objectId
      `category` - category
      `inputStream` - inputStream
      `inputStreamSize` - inputStreamSize
      `offerIds` - offers ids
    Returns:
      RequestResponseOK
    Throws:
      `StorageServerClientException` - StorageServerClientException
      `InvalidParseOperationException` - InvalidParseOperationException

  - ### getOfferLogs

    RequestResponse<OfferLog> getOfferLogs(String strategyId, String offerId, DataCategory type, Long offset, int limit, Order order) throws StorageServerClientException
    Get offer log .
    Parameters:
      `strategyId` - the strategy to get offers
      `offerId` - the offer Id to read object from
      `type` - the object type to list
      `offset` - offset of the last object before
      `limit` - the number of result wanted
      `order` - the order order
    Returns:
      list of offer log
    Throws:
      `StorageServerClientException`

  - ### getStorageStrategies

    RequestResponse<StorageStrategy> getStorageStrategies() throws StorageServerClientException
    Get strategies.
    Returns:
      strategies available for storage
    Throws:
      `StorageServerClientException`

  - ### createAccessRequestIfRequired

    Optional<String> createAccessRequestIfRequired(String strategyId, String offerId, DataCategory dataCategory, List<String> objectNames) throws StorageServerClientException
    Create access request if target offer does not support synchronous read (tape library storage). If target offer supports synchronous read requests, then no access request is created.
    Parameters:
      `strategyId` - the target storage strategy identifier
      `offerId` - the target offer identifier (Optional). If provided, the offerId must be a valid active offer of the specified strategy. Otherwise, the referent offer of strategy is used.
      `dataCategory` - the data category of objects to which access is requested
      `objectNames` - the object names/ids/guids to which access is requested
    Returns:
      an AccessRequestId if access request is required (async offer), otherwiser `Optional.empty()`
    Throws:
      `StorageServerClientException` - if any problem occurs during request

  - ### checkAccessRequestStatuses

    Map<String,AccessRequestStatus> checkAccessRequestStatuses(String strategyId, String offerId, List<String> accessRequestIds, boolean adminCrossTenantAccessRequestAllowed) throws StorageServerClientException, StorageIllegalOperationClientException
    Check access request statuses of asynchronous offer.
    Parameters:
      `strategyId` - the target storage strategy identifier
      `offerId` - the target offer identifier (Optional). If provided, the offerId must be a valid active offer of the specified strategy. Otherwise, the referent offer of strategy is used.
      `accessRequestIds` - the accessRequestIds whose status is to be checked
      `adminCrossTenantAccessRequestAllowed` - when `true`, access to access requests of other tenants is allowed from Admin tenant
    Returns:
      the statuses of provided access request ids
    Throws:
      `StorageServerClientException` - if any problem occurs during request
      `StorageIllegalOperationClientException`

  - ### removeAccessRequest

    void removeAccessRequest(String strategyId, String offerId, String accessRequestId, boolean adminCrossTenantAccessRequestAllowed) throws StorageServerClientException, StorageIllegalOperationClientException
    Removes (cancel / delete) and access request for an asynchronous offer. Does nothing is access request id does not exist (idempotency)
    Parameters:
      `strategyId` - the target storage strategy identifier
      `offerId` - the target offer identifier (Optional). If provided, the offerId must be a valid active offer of the specified strategy. Otherwise, the referent offer of strategy is used.
      `accessRequestId` - the accessRequestId to remove
      `adminCrossTenantAccessRequestAllowed` - when `true`, removing access requests of other tenants is allowed from Admin tenant
    Throws:
      `StorageServerClientException` - if any problem occurs during request
      `StorageIllegalOperationClientException`

  - ### checkBulkObjectAvailability

    BulkObjectAvailabilityResponse checkBulkObjectAvailability(String strategyId, String offerId, BulkObjectAvailabilityRequest bulkObjectAvailabilityRequest) throws StorageServerClientException
    Checks immediate object availability in storage offer. Synchronous offers have guaranteed immediate availability of objects. Async offers (tape storage) may not be able to serve object immediately.
    Parameters:
      `strategyId` - the target storage strategy identifier
      `offerId` - the target offer identifier (Optional). If provided, the offerId must be a valid active offer of the specified strategy. Otherwise, the referent offer of strategy is used.
      `bulkObjectAvailabilityRequest` - object availability check request
    Returns:
      `true` if ALL objects are available, otherwise `false`.
    Throws:
      `StorageServerClientException`

  - ### getReferentOffer

    String getReferentOffer(String strategy) throws StorageNotFoundClientException, StorageServerClientException
    Get referent offer of strategy
    Parameters:
      `strategy` -
    Returns:
    Throws:
      `StorageNotFoundClientException`
      `StorageServerClientException`

  - ### launchOfferLogCompaction

    jakarta.ws.rs.core.Response launchOfferLogCompaction(VitamContext vitamContext, String offerId) throws StorageServerClientException
    Throws:
      `StorageServerClientException`