use of org.apache.storm.generated.LSTopoHistory 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 = ConfigUtils.getTopoLogsUsers(topoConf);
List<String> groups = ConfigUtils.getTopoLogsGroups(topoConf);
synchronized (topologyHistoryLock) {
state.addTopologyHistory(new LSTopoHistory(topoId, Time.currentTimeSecs(), users, groups));
}
}
use of org.apache.storm.generated.LSTopoHistory 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<String> ret = new ArrayList<>();
for (LSTopoHistory history : state.getTopoHistoryList()) {
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.generated.LSTopoHistory in project storm by apache.
the class LocalState method addTopologyHistory.
public void addTopologyHistory(LSTopoHistory lsTopoHistory) {
LSTopoHistoryList lsTopoHistoryListWrapper = (LSTopoHistoryList) get(LS_TOPO_HISTORY);
List<LSTopoHistory> currentTopoHistoryList = new ArrayList<>();
if (null != lsTopoHistoryListWrapper) {
currentTopoHistoryList.addAll(lsTopoHistoryListWrapper.get_topo_history());
}
currentTopoHistoryList.add(lsTopoHistory);
put(LS_TOPO_HISTORY, new LSTopoHistoryList(currentTopoHistoryList));
}
use of org.apache.storm.generated.LSTopoHistory in project storm by apache.
the class LocalState method filterOldTopologies.
/**
* Remove topologies from local state which are older than cutOffAge.
* @param cutOffAge
*/
public void filterOldTopologies(long cutOffAge) {
LSTopoHistoryList lsTopoHistoryListWrapper = (LSTopoHistoryList) get(LS_TOPO_HISTORY);
List<LSTopoHistory> filteredTopoHistoryList = new ArrayList<>();
if (null != lsTopoHistoryListWrapper) {
for (LSTopoHistory topoHistory : lsTopoHistoryListWrapper.get_topo_history()) {
if (topoHistory.get_time_stamp() > cutOffAge) {
filteredTopoHistoryList.add(topoHistory);
}
}
}
put(LS_TOPO_HISTORY, new LSTopoHistoryList(filteredTopoHistoryList));
}
Aggregations