Package fr.gouv.vitam.storage.driver
Interface Connection
-
- All Superinterfaces:
java.lang.AutoCloseable
- All Known Implementing Classes:
AbstractConnection
,ConnectionImpl
,FakeDriverImpl.FakeConnectionImpl
public interface Connection extends java.lang.AutoCloseable
Represents a connection to the distant storage offer service that is provided by the driver when calling the connect method:myDriver.connect(serviceUrl, parameters);
AutoCloseable
so the connection implementation MUST provide a close() method which responsibility is to cleanly close and remove.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description StorageBulkPutResult
bulkPutObjects(StorageBulkPutRequest request)
Bulk put object files into the storage offer.java.util.Map<java.lang.String,AccessRequestStatus>
checkAccessRequestStatuses(java.util.List<java.lang.String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed)
Check access request statuses of asynchronous offer.boolean
checkObjectAvailability(StorageCheckObjectAvailabilityRequest request)
Check immediate availability of objects from asynchronous storage offer.void
close()
Override AutoCloseable implementation to specify the exceptionjava.lang.String
createAccessRequest(StorageAccessRequestCreationRequest request)
Create an access request for retrieving objects from asynchronous storage offer.StorageBulkMetadataResult
getBulkMetadata(StorageGetBulkMetadataRequest request)
Bulk get metadata of objectsStorageMetadataResult
getMetadatas(StorageGetMetadataRequest request)
Get metadata of objectStorageGetResult
getObject(StorageObjectRequest request)
Retrieve an object from the storage offer based on criterias defined in request argument.RequestResponse<OfferLog>
getOfferLogs(StorageOfferLogRequest request)
Get a listing of offer logs on a container typeStorageCapacityResult
getStorageCapacity(java.lang.Integer tenantId)
Retrieve the remaining storage capacity available on the distant offer.CloseableIterator<ObjectEntry>
listObjects(StorageListRequest request)
List object on a container typeboolean
objectExistsInOffer(StorageObjectRequest request)
Check if an object is present in the offerStoragePutResult
putObject(StoragePutRequest request)
Put the object file into the storage offer based on criteria defined in request argument and underlying connection parameters.void
removeAccessRequest(java.lang.String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed)
Removes (cancel / delete) and access request for an asynchronous offer.StorageRemoveResult
removeObject(StorageRemoveRequest request)
Delete an object on the distant storage offer.
-
-
-
Method Detail
-
getStorageCapacity
StorageCapacityResult getStorageCapacity(java.lang.Integer tenantId) throws StorageDriverPreconditionFailedException, StorageDriverNotFoundException, StorageDriverException
Retrieve the remaining storage capacity available on the distant offer. Return values MUST in bytes- Parameters:
tenantId
- the tenant id needed to get storage capacity- Returns:
- the usable and used space in bytes and a remind of the given tenantId
- Throws:
StorageDriverPreconditionFailedException
- if a bad request is encounteredStorageDriverNotFoundException
- if container is not foundStorageDriverException
- if any problem occurs during request
-
getObject
StorageGetResult getObject(StorageObjectRequest request) throws StorageDriverException
Retrieve an object from the storage offer based on criterias defined in request argument.- Parameters:
request
- the request to send. It contains informations needed to retrieve a given object.- Returns:
- a result that may contains metadatas as well as the binary file
- Throws:
StorageDriverException
- if any problem occurs during requestjava.lang.IllegalArgumentException
- if request is wrong
-
createAccessRequest
java.lang.String createAccessRequest(StorageAccessRequestCreationRequest request) throws StorageDriverException
Create an access request for retrieving objects from asynchronous storage offer.- Parameters:
request
- the request to send. It contains information needed to prepare a given object.- Returns:
- an AccessRequestId that can be used to check the status of the AccessRequest, and to remove it
- Throws:
StorageDriverException
- if any problem occurs during requestjava.lang.IllegalArgumentException
- if request is wrong
-
checkAccessRequestStatuses
java.util.Map<java.lang.String,AccessRequestStatus> checkAccessRequestStatuses(java.util.List<java.lang.String> accessRequestIds, int tenant, boolean adminCrossTenantAccessRequestAllowed) throws StorageDriverException
Check access request statuses of asynchronous offer.- Parameters:
accessRequestIds
- the accessRequestIds whose status is to be checkedtenant
- the tenant IdadminCrossTenantAccessRequestAllowed
- whentrue
, access to access requests of other tenants is allowed from Admin tenant- Returns:
- a Map of
AccessRequestStatus
by access request Id - Throws:
StorageDriverException
- if any problem occurs during request
-
removeAccessRequest
void removeAccessRequest(java.lang.String accessRequestId, int tenant, boolean adminCrossTenantAccessRequestAllowed) throws StorageDriverException
Removes (cancel / delete) and access request for an asynchronous offer. Does nothing is access request id does not exist (idempotency)- Parameters:
tenant
- the tenant IdaccessRequestId
- the accessRequestId to removeadminCrossTenantAccessRequestAllowed
- whentrue
, removing access requests of other tenants is allowed from Admin tenant- Throws:
StorageDriverException
- if any problem occurs during request
-
checkObjectAvailability
boolean checkObjectAvailability(StorageCheckObjectAvailabilityRequest request) throws StorageDriverException
Check immediate availability of objects from asynchronous storage offer.- Parameters:
request
- the request to send. It contains information needed to check object availability.- Returns:
true
if ALL objects are available, otherwisefalse
.- Throws:
StorageDriverException
- if any problem occurs during requestjava.lang.IllegalArgumentException
- if request is wrong
-
putObject
StoragePutResult putObject(StoragePutRequest request) throws StorageDriverException
Put the object file into the storage offer based on criteria defined in request argument and underlying connection parameters.- Parameters:
request
- the request to send. It may contain information needed to store the file.- Returns:
- a result that may contain metadata or statistics about the object put operation.
- Throws:
StorageDriverException
- if any problem occurs during request
-
bulkPutObjects
StorageBulkPutResult bulkPutObjects(StorageBulkPutRequest request) throws StorageDriverException
Bulk put object files into the storage offer.- Throws:
StorageDriverException
- if any problem occurs during request
-
removeObject
StorageRemoveResult removeObject(StorageRemoveRequest request) throws StorageDriverException
Delete an object on the distant storage offer.- Parameters:
request
- the request to send, it contains information needed to delete an object on the distant store- Returns:
- a result that may contains metadatas or statistics about the object removal operation.
- Throws:
StorageDriverException
- if any problem occurs during request
-
objectExistsInOffer
boolean objectExistsInOffer(StorageObjectRequest request) throws StorageDriverException
Check if an object is present in the offer- Parameters:
request
- the request to send. It contains informations needed to retrieve a given object.- Returns:
- true if exists, else false
- Throws:
StorageDriverException
- if any problem occurs during request
-
getMetadatas
StorageMetadataResult getMetadatas(StorageGetMetadataRequest request) throws StorageDriverException
Get metadata of object- Parameters:
request
-- Returns:
- a result that may contain information about the storage metadata
- Throws:
StorageDriverException
-
getBulkMetadata
StorageBulkMetadataResult getBulkMetadata(StorageGetBulkMetadataRequest request) throws StorageDriverException, InvalidParseOperationException
Bulk get metadata of objects- Parameters:
request
-- Returns:
- a result that may contain information about the storage metadata
- Throws:
StorageDriverException
InvalidParseOperationException
-
listObjects
CloseableIterator<ObjectEntry> listObjects(StorageListRequest request) throws StorageDriverException, StorageDriverNotFoundException
List object on a container type- Parameters:
request
- the request contains data needed to list container type- Returns:
- an iterator with each object metadata
- Throws:
StorageDriverException
StorageDriverNotFoundException
-
getOfferLogs
RequestResponse<OfferLog> getOfferLogs(StorageOfferLogRequest request) throws StorageDriverException
Get a listing of offer logs on a container type- Parameters:
request
- the request contains data needed to retrieve the listing of the container- Returns:
- the listing of last objects save according to the request
- Throws:
StorageDriverException
- to be thrown in case of any driver exception
-
close
void close() throws StorageDriverException
Override AutoCloseable implementation to specify the exception- Specified by:
close
in interfacejava.lang.AutoCloseable
- Throws:
StorageDriverException
- to be thrown in case of any driver exception
-
-