Search in sources :

Example 1 with MessageReply

use of org.dcache.cells.MessageReply in project dcache by dCache.

the class QoSMessageHandler method messageArrived.

/**
 * Returns whether replica exists, the status of its system sticky flag and whether its state
 * allows for reading and removal.
 */
public Reply messageArrived(ReplicaStatusMessage message) {
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        PnfsId pnfsId = message.getPnfsId();
        try {
            CacheEntry entry = repository.getEntry(pnfsId);
            message.setExists(true);
            switch(entry.getState()) {
                case FROM_CLIENT:
                case FROM_POOL:
                case FROM_STORE:
                    message.setWaiting(true);
                    break;
                case CACHED:
                    message.setReadable(true);
                    message.setRemovable(true);
                    break;
                case BROKEN:
                    message.setBroken(true);
                    message.setRemovable(true);
                    break;
                case PRECIOUS:
                    message.setReadable(true);
                    message.setPrecious(true);
                    break;
                default:
                    break;
            }
            Collection<StickyRecord> records = entry.getStickyRecords();
            for (StickyRecord record : records) {
                if (record.owner().equals(SYSTEM_OWNER) && record.isNonExpiring()) {
                    message.setSystemSticky(true);
                    break;
                }
            }
            reply.reply(message);
        } catch (FileNotInCacheException e) {
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, e);
        }
    });
    return reply;
}
Also used : StickyRecord(org.dcache.pool.repository.StickyRecord) ChangePreciousBitMessage(org.dcache.vehicles.qos.ChangePreciousBitMessage) Message(diskCacheV111.vehicles.Message) ChangeStickyBitMessage(org.dcache.vehicles.qos.ChangeStickyBitMessage) ReplicaStatusMessage(org.dcache.vehicles.qos.ReplicaStatusMessage) MessageReply(org.dcache.cells.MessageReply) PnfsId(diskCacheV111.util.PnfsId) CacheEntry(org.dcache.pool.repository.CacheEntry) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException)

Example 2 with MessageReply

use of org.dcache.cells.MessageReply in project dcache by dCache.

the class ResilienceMessageHandler method messageArrived.

/**
 * <p>Returns whether replica exists, the status of its system sticky flag
 * and whether its state allows for reading and removal.</p>
 */
public Reply messageArrived(ReplicaStatusMessage message) {
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        PnfsId pnfsId = message.getPnfsId();
        if (pnfsId == null) {
            reply.fail(message, new IllegalArgumentException("no pnfsid"));
            return;
        }
        try {
            CacheEntry entry = repository.getEntry(pnfsId);
            message.setExists(true);
            switch(entry.getState()) {
                case FROM_CLIENT:
                case FROM_POOL:
                case FROM_STORE:
                    message.setWaiting(true);
                    break;
                case CACHED:
                    message.setReadable(true);
                    message.setRemovable(true);
                    break;
                case BROKEN:
                    message.setBroken(true);
                    message.setRemovable(true);
                    break;
                case PRECIOUS:
                    message.setReadable(true);
                    break;
                default:
                    break;
            }
            Collection<StickyRecord> records = entry.getStickyRecords();
            for (StickyRecord record : records) {
                if (record.owner().equals(SYSTEM_OWNER) && record.isNonExpiring()) {
                    message.setSystemSticky(true);
                    break;
                }
            }
            reply.reply(message);
        } catch (FileNotInCacheException e) {
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, e);
        }
    });
    return reply;
}
Also used : StickyRecord(org.dcache.pool.repository.StickyRecord) RemoveReplicaMessage(org.dcache.vehicles.resilience.RemoveReplicaMessage) ReplicaStatusMessage(org.dcache.vehicles.resilience.ReplicaStatusMessage) Message(diskCacheV111.vehicles.Message) ForceSystemStickyBitMessage(org.dcache.vehicles.resilience.ForceSystemStickyBitMessage) MessageReply(org.dcache.cells.MessageReply) PnfsId(diskCacheV111.util.PnfsId) CacheEntry(org.dcache.pool.repository.CacheEntry) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException) FileNotInCacheException(diskCacheV111.util.FileNotInCacheException)

Example 3 with MessageReply

use of org.dcache.cells.MessageReply in project dcache by dCache.

the class PoolInfoRequestHandler method messageArrived.

/**
 * <p>Gathers diagnostic and detail information about various
 * cell components for the pool, including migration jobs.</p>
 */
public Reply messageArrived(PoolDataRequestMessage message) {
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        try {
            PoolData request = new PoolData();
            request.setCellData(getCellInfoRequest());
            request.setDetailsData(pool.getDataObject());
            request.setCsmData(checksumModule.getDataObject());
            request.setFlushData(flushController.getDataObject());
            request.setHsmFlushQMData(hsmFlushQueueManager.getDataObject());
            request.setJtmData(jobTimeoutManager.getDataObject());
            MigrationData client = migrationClient.getDataObject();
            MigrationData service = migrationServer.getDataObject();
            client.setServerRequests(service.getServerRequests());
            request.setMigrationData(client);
            request.setPpData(p2pClient.getDataObject());
            request.setRepositoryData(repositoryProvider.getDataObject());
            request.setStorageHandlerData(storageHandler.getDataObject());
            request.setTransferServicesData(transferServices.getDataObject());
            request.setSpaceByStorageUnit(statisticsListener.toJson());
            message.setData(request);
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, handleRuntimeException(e));
        }
    });
    return reply;
}
Also used : MigrationData(org.dcache.pool.migration.json.MigrationData) Message(diskCacheV111.vehicles.Message) PoolRemoveListingMessage(org.dcache.vehicles.pool.PoolRemoveListingMessage) PoolStageListingMessage(org.dcache.vehicles.pool.PoolStageListingMessage) PoolFlushListingMessage(org.dcache.vehicles.pool.PoolFlushListingMessage) CacheEntryInfoMessage(org.dcache.vehicles.pool.CacheEntryInfoMessage) PoolMoverListingMessage(org.dcache.vehicles.pool.PoolMoverListingMessage) PoolDataRequestMessage(org.dcache.vehicles.pool.PoolDataRequestMessage) PoolLiveDataForHistoriesMessage(org.dcache.vehicles.pool.PoolLiveDataForHistoriesMessage) PoolP2PListingMessage(org.dcache.vehicles.pool.PoolP2PListingMessage) MessageReply(org.dcache.cells.MessageReply) PoolData(org.dcache.pool.json.PoolData)

Example 4 with MessageReply

use of org.dcache.cells.MessageReply in project dcache by dCache.

the class PoolInfoRequestHandler method messageArrived.

/**
 * <p>Gets cache information from the repository for a given pnfsid.</p>
 */
public Reply messageArrived(CacheEntryInfoMessage message) {
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        try {
            PnfsId pnfsId = message.getPnfsId();
            message.setRepositoryListing(repository.getEntry(pnfsId).toString());
            message.setInfo(pool.getCacheRepositoryEntryInfo(message.getPnfsId()));
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, handleRuntimeException(e));
        }
    });
    return reply;
}
Also used : Message(diskCacheV111.vehicles.Message) PoolRemoveListingMessage(org.dcache.vehicles.pool.PoolRemoveListingMessage) PoolStageListingMessage(org.dcache.vehicles.pool.PoolStageListingMessage) PoolFlushListingMessage(org.dcache.vehicles.pool.PoolFlushListingMessage) CacheEntryInfoMessage(org.dcache.vehicles.pool.CacheEntryInfoMessage) PoolMoverListingMessage(org.dcache.vehicles.pool.PoolMoverListingMessage) PoolDataRequestMessage(org.dcache.vehicles.pool.PoolDataRequestMessage) PoolLiveDataForHistoriesMessage(org.dcache.vehicles.pool.PoolLiveDataForHistoriesMessage) PoolP2PListingMessage(org.dcache.vehicles.pool.PoolP2PListingMessage) MessageReply(org.dcache.cells.MessageReply) PnfsId(diskCacheV111.util.PnfsId)

Example 5 with MessageReply

use of org.dcache.cells.MessageReply in project dcache by dCache.

the class PoolInfoRequestHandler method messageArrived.

public Reply messageArrived(PoolLiveDataForHistoriesMessage message) {
    MessageReply<Message> reply = new MessageReply<>();
    executor.execute(() -> {
        try {
            message.setPoolCostData(new PoolCostData(pool.getPoolCostInfo()));
            /*
                 *  NB:  sweeper data is obtained by the history service
                 *  on behalf of the pool service on the frontend.
                 */
            message.setSweeperData(sweeper.getDataObject());
            reply.reply(message);
        } catch (Exception e) {
            reply.fail(message, handleRuntimeException(e));
        }
    });
    return reply;
}
Also used : Message(diskCacheV111.vehicles.Message) PoolRemoveListingMessage(org.dcache.vehicles.pool.PoolRemoveListingMessage) PoolStageListingMessage(org.dcache.vehicles.pool.PoolStageListingMessage) PoolFlushListingMessage(org.dcache.vehicles.pool.PoolFlushListingMessage) CacheEntryInfoMessage(org.dcache.vehicles.pool.CacheEntryInfoMessage) PoolMoverListingMessage(org.dcache.vehicles.pool.PoolMoverListingMessage) PoolDataRequestMessage(org.dcache.vehicles.pool.PoolDataRequestMessage) PoolLiveDataForHistoriesMessage(org.dcache.vehicles.pool.PoolLiveDataForHistoriesMessage) PoolP2PListingMessage(org.dcache.vehicles.pool.PoolP2PListingMessage) PoolCostData(diskCacheV111.pools.json.PoolCostData) MessageReply(org.dcache.cells.MessageReply)

Aggregations

MessageReply (org.dcache.cells.MessageReply)10 Message (diskCacheV111.vehicles.Message)9 PnfsId (diskCacheV111.util.PnfsId)5 FileNotInCacheException (diskCacheV111.util.FileNotInCacheException)4 CacheEntryInfoMessage (org.dcache.vehicles.pool.CacheEntryInfoMessage)3 PoolDataRequestMessage (org.dcache.vehicles.pool.PoolDataRequestMessage)3 PoolFlushListingMessage (org.dcache.vehicles.pool.PoolFlushListingMessage)3 PoolLiveDataForHistoriesMessage (org.dcache.vehicles.pool.PoolLiveDataForHistoriesMessage)3 PoolMoverListingMessage (org.dcache.vehicles.pool.PoolMoverListingMessage)3 PoolP2PListingMessage (org.dcache.vehicles.pool.PoolP2PListingMessage)3 PoolRemoveListingMessage (org.dcache.vehicles.pool.PoolRemoveListingMessage)3 PoolStageListingMessage (org.dcache.vehicles.pool.PoolStageListingMessage)3 ChangePreciousBitMessage (org.dcache.vehicles.qos.ChangePreciousBitMessage)3 ChangeStickyBitMessage (org.dcache.vehicles.qos.ChangeStickyBitMessage)3 ReplicaStatusMessage (org.dcache.vehicles.qos.ReplicaStatusMessage)3 CacheEntry (org.dcache.pool.repository.CacheEntry)2 StickyRecord (org.dcache.pool.repository.StickyRecord)2 PoolCostData (diskCacheV111.pools.json.PoolCostData)1 IoJobInfo (diskCacheV111.vehicles.IoJobInfo)1 TransferStatusQueryMessage (diskCacheV111.vehicles.transferManager.TransferStatusQueryMessage)1