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();
}
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);
}
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);
}
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);
}
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);
}
Aggregations