zk中的节点配额,配额管理树和状态信息分别是什么
发表于:2026-10-31 作者:千家信息网编辑
千家信息网最后更新 2026年10月31日,本篇内容介绍了"zk中的节点配额,配额管理树和状态信息分别是什么"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够
千家信息网最后更新 2026年10月31日zk中的节点配额,配额管理树和状态信息分别是什么
本篇内容介绍了"zk中的节点配额,配额管理树和状态信息分别是什么"的有关知识,在实际案例的操作过程中,不少人都会遇到这样的困境,接下来就让小编带领大家学习一下如何处理这些情况吧!希望大家仔细阅读,能够学有所成!
Qutas 主要完成配额目录的定义:
限制信息包含某个路径的要求大小
在zk中目录结构为/zookeeper/quota/xxx/zookeeper_limits
状态信息包含对某个路径实际大小
/zookeeper/quota/xxx/zookeeper_stats
以及提供path转换对应的限制path和状态path方法
为处理配额提供定义
Quotas类路径org.apache.zookeeper
属性
/** the zookeeper nodes that acts as the management and status node **/public static final String procZookeeper = "/zookeeper";/** the zookeeper quota node that acts as the quota * management node for zookeeper */public static final String quotaZookeeper = "/zookeeper/quota";/** * the limit node that has the limit of * a subtree */public static final String limitNode = "zookeeper_limits";/** * the stat node that monitors the limit of * a subtree. */public static final String statNode = "zookeeper_stats";方法/** * return the quota path associated with this * prefix * @param path the actual path in zookeeper. * @return the limit quota path */public static String quotaPath(String path) { return quotaZookeeper + path + "/" + limitNode;}/** * return the stat quota path associated with this * prefix. * @param path the actual path in zookeeper * @return the stat quota path */public static String statPath(String path) { return quotaZookeeper + path + "/" + statNode;}PathTrie 字典树完成配额目录的增删查 路径查找内部类TrieNode属性final String value;final Mapchildren;boolean property;//节点设置了配额,属性为true,否则为falseTrieNode parent;方法//添加子节点void addChild(String childName, TrieNode node) { this.children.putIfAbsent(childName, node);}/** * Delete child from this node. *删除子节点 * @param childName the name of the child to be deleted */void deleteChild(String childName) { this.children.computeIfPresent(childName, (key, childNode) -> { // Node no longer has an external property associated childNode.setProperty(false); // Delete it if it has no children (is a leaf node) if (childNode.isLeafNode()) { childNode.setParent(null); return null; } return childNode; });} 构造方法:public PathTrie() { this.rootNode = new TrieNode(null, "/");}方法/** * Add a path to the path trie. All paths are relative to the root node. * * @param path the path to add to the trie */public void addPath(final String path) { Objects.requireNonNull(path, "Path cannot be null"); final String[] pathComponents = StringUtils.split(path, '/'); if (pathComponents.length == 0) { throw new IllegalArgumentException("Invalid path: " + path); } writeLock.lock(); try { TrieNode parent = rootNode; for (final String part : pathComponents) { TrieNode child = parent.getChild(part); if (child == null) { child = new TrieNode(parent, part); parent.addChild(part, child); } parent = child; } parent.setProperty(true); } finally { writeLock.unlock(); }}/** * Return true if the given path exists in the trie, otherwise return false; * All paths are relative to the root node. * * @param path the input path * @return the largest prefix for the */public boolean existsNode(final String path) { Objects.requireNonNull(path, "Path cannot be null"); final String[] pathComponents = StringUtils.split(path, '/'); if (pathComponents.length == 0) { throw new IllegalArgumentException("Invalid path: " + path); } readLock.lock(); try { TrieNode parent = rootNode; for (final String part : pathComponents) { if (parent.getChild(part) == null) { // the path does not exist return false; } parent = parent.getChild(part); LOG.debug("{}", parent); } } finally { readLock.unlock(); } return true;}StatsTrack 记录节点实际的count和bytes长度信息属性private int count;private long bytes;private String countStr = "count";private String byteStr = "bytes"; public String toString() { return countStr + "=" + count + "," + byteStr + "=" + bytes;}
"zk中的节点配额,配额管理树和状态信息分别是什么"的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识可以关注网站,小编将为大家输出更多高质量的实用文章!
配额
节点
信息
方法
状态
属性
路径
实际
目录
管理
内容
大小
更多
知识
限制
实用
学有所成
接下来
困境
字典
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
咖啡网
湖南永感互联网科技有限公司
互联网为科技
金融科技与互联网金融
美国互联网科技
互联网科技公司官网
九亚互联网科技
互联网科技logo
长亮科技互联网金融
互联网科技大会
云创客互联网科技公司
重庆威客帮互联网科技
金融科技与互联网金融相同和不同
受益于互联网科技的高速发展
湖北码尼互联网科技有限公司电话
互联网科技和法律行业
互联网科技圈年度人物
互联网相关科技技术
半导体行业属于互联网高科技类吗
上海旺乐尼互联网科技有限公司
美国互联网科技巨头监管
奇酷互联网络科技
成都互联网科技公司
互联网科技logo设计
四川狮子座互联网科技
互联网公司黑科技创始人
云南互联网科技学费
互联网科技品牌
科技互联网专业工作会议发言稿
六子台科技互联网展会