@Override public void setupErrors(String stormId, Map<String, Object> topoConf) { stateStorage.mkdirs(ClusterUtils.ERRORS_SUBTREE, defaultAcls); stateStorage.mkdirs(ClusterUtils.errorStormRoot(stormId), ClusterUtils.mkTopoReadWriteAcls(topoConf)); }
@Override public ErrorInfo lastError(String stormId, String componentId) { String path = ClusterUtils.lastErrorPath(stormId, componentId); if (stateStorage.node_exists(path, false)) { ErrorInfo errorInfo = ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), ErrorInfo.class); return errorInfo; } return null; }
@Override public List<String> blobstoreInfo(String blobKey) { String path = ClusterUtils.blobstorePath(blobKey); stateStorage.sync_path(path); return stateStorage.get_children(path, false); }
@Override public void removeStorm(String stormId) { stateStorage.delete_node(ClusterUtils.assignmentPath(stormId)); this.assignmentsBackend.clearStateForStorm(stormId); stateStorage.delete_node(ClusterUtils.credentialsPath(stormId)); stateStorage.delete_node(ClusterUtils.logConfigPath(stormId)); stateStorage.delete_node(ClusterUtils.profilerConfigPath(stormId)); removeStormBase(stormId); }
private static IStormClusterState makeStormClusterState(Map<String, Object> conf) throws Exception { return ClusterUtils.mkStormClusterState(conf, new ClusterStateContext(DaemonType.NIMBUS, conf)); }
@Override public void setupHeatbeats(String stormId, Map<String, Object> topoConf) { stateStorage.mkdirs(ClusterUtils.WORKERBEATS_SUBTREE, defaultAcls); stateStorage.mkdirs(ClusterUtils.workerbeatStormRoot(stormId), ClusterUtils.mkTopoReadWriteAcls(topoConf)); }
@Override public void setupBackpressure(String stormId, Map<String, Object> topoConf) { stateStorage.mkdirs(ClusterUtils.BACKPRESSURE_SUBTREE, defaultAcls); stateStorage.mkdirs(ClusterUtils.backpressureStormRoot(stormId), ClusterUtils.mkTopoReadWriteAcls(topoConf)); }
@Override public ClusterWorkerHeartbeat getWorkerHeartbeat(String stormId, String node, Long port) { byte[] bytes = stateStorage.get_worker_hb(ClusterUtils.workerbeatPath(stormId, node, port), false); return ClusterUtils.maybeDeserialize(bytes, ClusterWorkerHeartbeat.class); }
@Override public void removeWorkerBackpressure(String stormId, String node, Long port) { String path = ClusterUtils.backpressurePath(stormId, node, port); boolean existed = stateStorage.node_exists(path, false); if (existed) { stateStorage.delete_node(path); } }
@Override public SupervisorInfo supervisorInfo(String supervisorId) { String path = ClusterUtils.supervisorPath(supervisorId); return ClusterUtils.maybeDeserialize(stateStorage.get_data(path, false), SupervisorInfo.class); }
public IStormClusterState mkStormClusterStateImpl(Object stateStorage, ILocalAssignmentsBackend backend, ClusterStateContext context) throws Exception { if (stateStorage instanceof IStateStorage) { return new StormClusterStateImpl((IStateStorage) stateStorage, backend, context, false); } else { IStateStorage Storage = _instance.mkStateStorageImpl((Map<String, Object>) stateStorage, (Map<String, Object>) stateStorage, context); return new StormClusterStateImpl(Storage, backend, context, true); } }
@Override public void removeWorkerHeartbeat(String stormId, String node, Long port) { String path = ClusterUtils.workerbeatPath(stormId, node, port); stateStorage.delete_worker_hb(path); }
@Override public void removeStormBase(String stormId) { stateStorage.delete_node(ClusterUtils.stormPath(stormId)); }
@Override public void removeKeyVersion(String blobKey) { stateStorage.delete_node(ClusterUtils.blobstoreMaxKeySequenceNumberPath(blobKey)); }
/** * Get all of the supervisors with the ID as the key. */ default Map<String, SupervisorInfo> allSupervisorInfo() { return allSupervisorInfo(null); }
/** * Get ZK ACLs for a topology to have read/write access. * * @param topoConf the topology config. * @return the ACLs. */ public static List<ACL> mkTopoReadWriteAcls(Map<String, Object> topoConf) { return mkTopoAcls(topoConf, ZooDefs.Perms.ALL); }
@Override public void delete_node_blobstore(String path, String nimbusHostPortInfo) { stateStorage.delete_node_blobstore(path, nimbusHostPortInfo); } }
/** * Get the path to a specific secret key. * * @param type the service the secret is for. * @param topologyId the topology the secret is for. * @param version the version the secret is for. * @return the path to the secret. */ public static String secretKeysPath(WorkerTokenServiceType type, String topologyId, long version) { return secretKeysPath(type, topologyId) + ZK_SEPERATOR + version; }
/** * Decide if the assignments is synchronized. * * @return true if assignments have been synchronized from remote state store */ private boolean isAssignmentsRecovered() { return stormClusterState.isAssignmentsBackendSynchronized(); }
@Override public void close() throws Exception { ClusterUtils.resetInstance(); } }