Search in sources :

Example 1 with StateUpdate

use of org.dcache.services.info.base.StateUpdate in project dcache by dCache.

the class ReservationByDescMaintainerTests method setUp.

@Before
public void setUp() {
    _exhibitor = new TestStateExhibitor();
    _watcher = new ReservationByDescMaintainer();
    _sum = new QueuingStateUpdateManager();
    _update = new StateUpdate();
    _transition = new MalleableStateTransition();
}
Also used : MalleableStateTransition(org.dcache.services.info.base.MalleableStateTransition) StateUpdate(org.dcache.services.info.base.StateUpdate) QueuingStateUpdateManager(org.dcache.services.info.base.QueuingStateUpdateManager) TestStateExhibitor(org.dcache.services.info.base.TestStateExhibitor) Before(org.junit.Before)

Example 2 with StateUpdate

use of org.dcache.services.info.base.StateUpdate in project dcache by dCache.

the class PoolGroupInfoMsgHandler method process.

@Override
public void process(Object msgPayload, long metricLifetime) {
    LOGGER.trace("processing new poolgroup information");
    if (!msgPayload.getClass().isArray()) {
        LOGGER.error("Pool group info, received a message that isn't an array");
        return;
    }
    Object[] array = (Object[]) msgPayload;
    if (array.length != 4) {
        LOGGER.error("Pool group info, unexpected array size: {}", array.length);
        return;
    }
    // Map the array into slightly more meaningful components.
    String poolgroupName = (String) array[0];
    Object[] poolNames = (Object[]) array[1];
    Object[] linkNames = (Object[]) array[2];
    Boolean resilient = (Boolean) array[3];
    StateUpdate update = new StateUpdate();
    StatePath thisPoolGroupPath = POOLGROUPS_PATH.newChild(poolgroupName);
    if (poolNames.length + linkNames.length == 0) {
        // Add an entry, even though this poolgroup is empty.
        update.appendUpdate(thisPoolGroupPath, new StateComposite(metricLifetime));
    } else {
        addItems(update, thisPoolGroupPath.newChild("pools"), poolNames, metricLifetime);
        addItems(update, thisPoolGroupPath.newChild("links"), linkNames, metricLifetime);
        update.appendUpdate(thisPoolGroupPath.newChild("resilient"), new BooleanStateValue(resilient, metricLifetime));
    }
    applyUpdates(update);
}
Also used : StateComposite(org.dcache.services.info.base.StateComposite) StateUpdate(org.dcache.services.info.base.StateUpdate) BooleanStateValue(org.dcache.services.info.base.BooleanStateValue) StatePath(org.dcache.services.info.base.StatePath)

Example 3 with StateUpdate

use of org.dcache.services.info.base.StateUpdate in project dcache by dCache.

the class UGroupInfoMsgHandler method process.

@Override
public void process(Object msgPayload, long metricLifetime) {
    if (!msgPayload.getClass().isArray()) {
        LOGGER.error("unexpected received non-array payload");
        return;
    }
    Object[] array = (Object[]) msgPayload;
    if (array.length != 3) {
        LOGGER.error("unexpected array size: {}", array.length);
        return;
    }
    /**
     * array[0] = group name
     * array[1] = unit list
     * array[2] = link list
     */
    String unitGroupName = (String) array[0];
    StatePath thisUGroupPath = UNITGROUP_PATH.newChild(unitGroupName);
    StateUpdate update = new StateUpdate();
    addItems(update, thisUGroupPath.newChild("units"), (Object[]) array[1], metricLifetime);
    addItems(update, thisUGroupPath.newChild("links"), (Object[]) array[2], metricLifetime);
    applyUpdates(update);
}
Also used : StateUpdate(org.dcache.services.info.base.StateUpdate) StatePath(org.dcache.services.info.base.StatePath)

Example 4 with StateUpdate

use of org.dcache.services.info.base.StateUpdate in project dcache by dCache.

the class UnitInfoMsgHandler method process.

@Override
public void process(Object msgPayload, long metricLifetime) {
    if (!msgPayload.getClass().isArray()) {
        LOGGER.error("Unit info, unexpected received non-array payload");
        return;
    }
    Object[] array = (Object[]) msgPayload;
    if (array.length > 5 || array.length < 3) {
        LOGGER.error("Unit info, unexpected array size: {}", array.length);
        return;
    }
    /*
         * array[0] = name
         * array[1] = type
         * array[2] = list of unitgroups.
         *
         * for storage,
         *    array[3] = required (number of copies)
         *    array[4] = list of tags for partitioning copies
         */
    String unitName = array[0].toString();
    String unitType = array[1].toString();
    StatePath thisUnitPath = UNITS_PATH.newChild(unitName);
    StateUpdate update = new StateUpdate();
    update.appendUpdate(thisUnitPath.newChild("type"), new StringStateValue(unitType, metricLifetime));
    addItems(update, thisUnitPath.newChild("unitgroups"), (Object[]) array[2], metricLifetime);
    if ("store".equals(unitType)) {
        if (array.length == 5) {
            if (array[3] != null) {
                addItems(update, thisUnitPath.newChild("required"), (Object[]) array[3], metricLifetime);
            }
            if (array[4] != null) {
                addItems(update, thisUnitPath.newChild("oneCopyPer"), (Object[]) array[4], metricLifetime);
            }
        }
    }
    applyUpdates(update);
}
Also used : StateUpdate(org.dcache.services.info.base.StateUpdate) StatePath(org.dcache.services.info.base.StatePath) StringStateValue(org.dcache.services.info.base.StringStateValue)

Example 5 with StateUpdate

use of org.dcache.services.info.base.StateUpdate in project dcache by dCache.

the class PseudoPoolDga method trigger.

/**
 * When we've been triggered.
 */
@Override
public void trigger() {
    updateSpace();
    StateUpdate update = new StateUpdate();
    // Renew our membership of default poolgroup
    update.appendUpdate(_ourPgMembership, new StateComposite(_metricLifetime));
    _spaceInfo.addMetrics(update, _ourSpacePath, _metricLifetime);
    _sum.enqueueUpdate(update);
}
Also used : StateComposite(org.dcache.services.info.base.StateComposite) StateUpdate(org.dcache.services.info.base.StateUpdate)

Aggregations

StateUpdate (org.dcache.services.info.base.StateUpdate)21 StatePath (org.dcache.services.info.base.StatePath)11 StateComposite (org.dcache.services.info.base.StateComposite)5 StringStateValue (org.dcache.services.info.base.StringStateValue)4 Date (java.util.Date)3 BooleanStateValue (org.dcache.services.info.base.BooleanStateValue)3 IntegerStateValue (org.dcache.services.info.base.IntegerStateValue)3 PoolCostInfo (diskCacheV111.pools.PoolCostInfo)2 CellInfo (dmg.cells.nucleus.CellInfo)2 MalleableStateTransition (org.dcache.services.info.base.MalleableStateTransition)2 QueuingStateUpdateManager (org.dcache.services.info.base.QueuingStateUpdateManager)2 TestStateExhibitor (org.dcache.services.info.base.TestStateExhibitor)2 Before (org.junit.Before)2 LinkGroup (diskCacheV111.services.space.LinkGroup)1 Space (diskCacheV111.services.space.Space)1 GetLinkGroupNamesMessage (diskCacheV111.services.space.message.GetLinkGroupNamesMessage)1 GetLinkGroupsMessage (diskCacheV111.services.space.message.GetLinkGroupsMessage)1 GetSpaceTokensMessage (diskCacheV111.services.space.message.GetSpaceTokensMessage)1 VOInfo (diskCacheV111.util.VOInfo)1 CostModulePoolInfoTable (diskCacheV111.vehicles.CostModulePoolInfoTable)1