@Override public void delete_worker_hb(String path) { delete_node(path); }
@Override public List<String> get_worker_hb_children(String path, boolean watch) { return get_children(path, watch); }
@Override public void set_worker_hb(String path, byte[] data, List<ACL> acls) { set_data(path, data, acls); }
public ZKStateStorage(Map<String, Object> conf, Map<String, Object> authConf, ClusterStateContext context) throws Exception { this.conf = conf; this.authConf = authConf; if (context.getDaemonType().equals(DaemonType.NIMBUS)) { this.isNimbus = true; } // just mkdir STORM_ZOOKEEPER_ROOT dir CuratorFramework zkTemp = mkZk(context.getDaemonType()); String rootPath = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_ROOT)); ClientZookeeper.mkdirs(zkTemp, rootPath, context.getDefaultZkAcls()); zkTemp.close(); active = new AtomicBoolean(true); zkWriter = mkZk(new ZkWatcherCallBack(), context.getDaemonType()); if (isNimbus) { zkReader = mkZk(new ZkWatcherCallBack(), context.getDaemonType()); } else { zkReader = zkWriter; } }
@Override public IStateStorage mkStore(Map<String, Object> config, Map<String, Object> auth_conf, ClusterStateContext context) { try { return new ZKStateStorage(config, auth_conf, context); } catch (Exception e) { throw Utils.wrapInRuntime(e); } } }
public ZKStateStorage(Map<Object, Object> conf, Map authConf, List<ACL> acls, ClusterStateContext context) throws Exception { this.conf = conf; this.authConf = authConf; if (context.getDaemonType().equals(DaemonType.NIMBUS)) this.isNimbus = true; // just mkdir STORM_ZOOKEEPER_ROOT dir CuratorFramework zkTemp = mkZk(acls); String rootPath = String.valueOf(conf.get(Config.STORM_ZOOKEEPER_ROOT)); Zookeeper.mkdirs(zkTemp, rootPath, acls); zkTemp.close(); active = new AtomicBoolean(true); zkWriter = mkZk(acls, new ZkWatcherCallBack()); if (isNimbus) { zkReader = mkZk(acls, new ZkWatcherCallBack()); } else { zkReader = zkWriter; } }
@Override public void set_worker_hb(String path, byte[] data, List<ACL> acls) { set_data(path, data, acls); }
@Override public List<String> get_worker_hb_children(String path, boolean watch) { return get_children(path, watch); }
@Override public void delete_worker_hb(String path) { delete_node(path); }