Search in sources :

Example 1 with SrmReserveSpaceRequest

use of org.dcache.srm.v2_2.SrmReserveSpaceRequest in project dcache by dCache.

the class AxisSrmFileSystem method reserveSpace.

@Nonnull
@Override
public TMetaDataSpace reserveSpace(long size, @Nullable String description, @Nullable TAccessLatency al, TRetentionPolicy rp, @Nullable Integer lifetime) throws SRMException, RemoteException, InterruptedException {
    SrmReserveSpaceResponse response = srm.srmReserveSpace(new SrmReserveSpaceRequest(null, description, new TRetentionPolicyInfo(rp, al), new UnsignedLong(size), new UnsignedLong(size), lifetime, null, null, null));
    while (response.getReturnStatus().getStatusCode() == TStatusCode.SRM_REQUEST_QUEUED || response.getReturnStatus().getStatusCode() == TStatusCode.SRM_REQUEST_INPROGRESS) {
        if (response.getEstimatedProcessingTime() != null) {
            TimeUnit.SECONDS.sleep(response.getEstimatedProcessingTime());
        } else {
            TimeUnit.SECONDS.sleep(2);
        }
        SrmStatusOfReserveSpaceRequestResponse status = srm.srmStatusOfReserveSpaceRequest(new SrmStatusOfReserveSpaceRequestRequest(null, response.getRequestToken()));
        response.setReturnStatus(status.getReturnStatus());
        response.setLifetimeOfReservedSpace(status.getLifetimeOfReservedSpace());
        response.setRetentionPolicyInfo(status.getRetentionPolicyInfo());
        response.setSizeOfGuaranteedReservedSpace(status.getSizeOfGuaranteedReservedSpace());
        response.setSizeOfTotalReservedSpace(status.getSizeOfTotalReservedSpace());
        response.setSpaceToken(status.getSpaceToken());
        response.setEstimatedProcessingTime(status.getEstimatedProcessingTime());
    }
    checkSuccess(response.getReturnStatus(), TStatusCode.SRM_SUCCESS, TStatusCode.SRM_LOWER_SPACE_GRANTED);
    TMetaDataSpace space = new TMetaDataSpace();
    space.setLifetimeAssigned(response.getLifetimeOfReservedSpace());
    space.setRetentionPolicyInfo(response.getRetentionPolicyInfo());
    space.setGuaranteedSize(response.getSizeOfGuaranteedReservedSpace());
    space.setTotalSize(response.getSizeOfTotalReservedSpace());
    space.setSpaceToken(response.getSpaceToken());
    space.setStatus(response.getReturnStatus());
    return space;
}
Also used : SrmReserveSpaceResponse(org.dcache.srm.v2_2.SrmReserveSpaceResponse) TRetentionPolicyInfo(org.dcache.srm.v2_2.TRetentionPolicyInfo) UnsignedLong(org.apache.axis.types.UnsignedLong) SrmReserveSpaceRequest(org.dcache.srm.v2_2.SrmReserveSpaceRequest) SrmStatusOfReserveSpaceRequestRequest(org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestRequest) SrmStatusOfReserveSpaceRequestResponse(org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestResponse) TMetaDataSpace(org.dcache.srm.v2_2.TMetaDataSpace) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)1 UnsignedLong (org.apache.axis.types.UnsignedLong)1 SrmReserveSpaceRequest (org.dcache.srm.v2_2.SrmReserveSpaceRequest)1 SrmReserveSpaceResponse (org.dcache.srm.v2_2.SrmReserveSpaceResponse)1 SrmStatusOfReserveSpaceRequestRequest (org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestRequest)1 SrmStatusOfReserveSpaceRequestResponse (org.dcache.srm.v2_2.SrmStatusOfReserveSpaceRequestResponse)1 TMetaDataSpace (org.dcache.srm.v2_2.TMetaDataSpace)1 TRetentionPolicyInfo (org.dcache.srm.v2_2.TRetentionPolicyInfo)1