use of org.smartdata.model.DetailedRuleInfo in project SSM by Intel-bigdata.
the class MetaStore method listSyncRules.
public List<DetailedRuleInfo> listSyncRules() throws MetaStoreException {
List<RuleInfo> ruleInfos = getRuleInfo();
List<DetailedRuleInfo> detailedRuleInfos = new ArrayList<>();
for (RuleInfo ruleInfo : ruleInfos) {
if (ruleInfo.getState() == RuleState.DELETED) {
continue;
}
int lastIndex = ruleInfo.getRuleText().lastIndexOf("|");
String lastPart = ruleInfo.getRuleText().substring(lastIndex + 1);
if (lastPart.contains("sync")) {
DetailedRuleInfo detailedRuleInfo = new DetailedRuleInfo(ruleInfo);
// Add sync progress
BackUpInfo backUpInfo = getBackUpInfo(ruleInfo.getId());
// Get total matched files
if (backUpInfo != null) {
detailedRuleInfo.setBaseProgress(getFilesByPrefix(backUpInfo.getSrc()).size());
long count = fileDiffDao.getPendingDiff(backUpInfo.getSrc()).size();
count += fileDiffDao.getByState(backUpInfo.getSrc(), FileDiffState.RUNNING).size();
if (count > detailedRuleInfo.baseProgress) {
count = detailedRuleInfo.baseProgress;
}
detailedRuleInfo.setRunningProgress(count);
} else {
detailedRuleInfo.setBaseProgress(0);
detailedRuleInfo.setRunningProgress(0);
}
if (detailedRuleInfo.getState() != RuleState.DELETED) {
detailedRuleInfos.add(detailedRuleInfo);
}
}
}
return detailedRuleInfos;
}
use of org.smartdata.model.DetailedRuleInfo 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