use of org.smartdata.model.CmdletInfo in project SSM by Intel-bigdata.
the class MetaStore method getActions.
public List<ActionInfo> getActions(long rid, long start, long offset) throws MetaStoreException {
long mark = 0;
long count = 0;
List<CmdletInfo> cmdletInfos = cmdletDao.getByRid(rid);
List<ActionInfo> totalActions = new ArrayList<>();
for (CmdletInfo cmdletInfo : cmdletInfos) {
List<Long> aids = cmdletInfo.getAids();
if (mark + aids.size() >= start + 1) {
long gap;
gap = start - mark;
for (Long aid : aids) {
if (gap > 0) {
gap--;
mark++;
continue;
}
if (count < offset) {
ActionInfo actionInfo = getActionById(aid);
totalActions.add(actionInfo);
count++;
mark++;
} else {
return totalActions;
}
}
} else {
mark += aids.size();
}
}
return totalActions;
}
use of org.smartdata.model.CmdletInfo in project SSM by Intel-bigdata.
the class MetaStore method listMoveRules.
public List<DetailedRuleInfo> listMoveRules() throws MetaStoreException {
List<RuleInfo> ruleInfos = getRuleInfo();
List<DetailedRuleInfo> detailedRuleInfos = new ArrayList<>();
for (RuleInfo ruleInfo : ruleInfos) {
int lastIndex = ruleInfo.getRuleText().lastIndexOf("|");
String lastPart = ruleInfo.getRuleText().substring(lastIndex + 1);
if (lastPart.contains("sync")) {
continue;
} else if (lastPart.contains("allssd") || lastPart.contains("onessd") || lastPart.contains("archive") || lastPart.contains("alldisk") || lastPart.contains("onedisk") || lastPart.contains("ramdisk")) {
DetailedRuleInfo detailedRuleInfo = new DetailedRuleInfo(ruleInfo);
// Add mover progress
List<CmdletInfo> cmdletInfos = cmdletDao.getByRid(ruleInfo.getId());
int currPos = 0;
for (CmdletInfo cmdletInfo : cmdletInfos) {
if (cmdletInfo.getState().getValue() <= 4) {
break;
}
currPos += 1;
}
int countRunning = 0;
for (CmdletInfo cmdletInfo : cmdletInfos) {
if (cmdletInfo.getState().getValue() <= 4) {
countRunning++;
}
}
detailedRuleInfo.setBaseProgress(cmdletInfos.size() - currPos);
detailedRuleInfo.setRunningProgress(countRunning);
if (detailedRuleInfo.getState() != RuleState.DELETED) {
detailedRuleInfos.add(detailedRuleInfo);
}
}
}
return detailedRuleInfos;
}
Aggregations