use of org.apache.storm.utils.LocalState in project storm by apache.
the class Nimbus method readTopologyHistory.
private List<String> readTopologyHistory(String user, Collection<String> adminUsers) throws IOException {
LocalState state = topologyHistoryState;
List<LSTopoHistory> topoHistoryList = state.getTopoHistoryList();
if (topoHistoryList == null || topoHistoryList.isEmpty()) {
return Collections.emptyList();
}
List<String> ret = new ArrayList<>();
for (LSTopoHistory history : topoHistoryList) {
if (// Security off
user == null || // is admin
adminUsers.contains(user) || // is in allowed group
isUserPartOf(user, history.get_groups()) || history.get_users().contains(user)) {
// is an allowed user
ret.add(history.get_topology_id());
}
}
return ret;
}
use of org.apache.storm.utils.LocalState in project storm by apache.
the class Nimbus method addTopoToHistoryLog.
private void addTopoToHistoryLog(String topoId, Map<String, Object> topoConf) {
LOG.info("Adding topo to history log: {}", topoId);
LocalState state = topologyHistoryState;
List<String> users = ServerConfigUtils.getTopoLogsUsers(topoConf);
List<String> groups = ServerConfigUtils.getTopoLogsGroups(topoConf);
synchronized (topologyHistoryLock) {
state.addTopologyHistory(new LSTopoHistory(topoId, Time.currentTimeSecs(), users, groups));
}
}
Aggregations