這篇文章主要介紹“zk的樹形數(shù)據(jù)模型是什么”,在日常操作中,相信很多人在zk的樹形數(shù)據(jù)模型是什么問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”zk的樹形數(shù)據(jù)模型是什么”的疑惑有所幫助!接下來,請跟著小編一起來學(xué)習吧!
憑借整站使用HTML5建站的創(chuàng)新體驗、定制設(shè)計、設(shè)計團隊積累與透明式的服務(wù)過程,符合行業(yè)特點,專屬顧問根據(jù)企業(yè)產(chǎn)品,消費群體屬性,準確定位;設(shè)計師以目標客戶為中心,以突出品牌官網(wǎng)特性為宗旨,定制專屬網(wǎng)站建設(shè)設(shè)計方案。
zookeeper的數(shù)據(jù)模型是樹結(jié)構(gòu)
在內(nèi)存數(shù)據(jù)庫中存儲了整顆樹內(nèi)容,包含所有節(jié)點路徑,節(jié)點數(shù)據(jù),狀態(tài)信息
會定時將數(shù)據(jù)刷到磁盤上
數(shù)據(jù)模型表示主要有DataTree DataNode ZKDatabase
datatree是一顆樹結(jié)構(gòu),不包含和客戶端,網(wǎng)絡(luò),請求相關(guān)的業(yè)務(wù)邏輯
dataNode是數(shù)據(jù)存儲的最小單元,保存了節(jié)點數(shù)據(jù)內(nèi)容,ACL列表,狀態(tài),父節(jié)點引用和子節(jié)點列表
zkdatabase是內(nèi)存數(shù)據(jù)庫,管理zk所有會話,DataTree存儲和事務(wù)日志,定時將日志刷寫到磁盤
在zookeeper啟動時,會通過磁盤的事務(wù)日志和快照文件恢復(fù)一個完整的內(nèi)存數(shù)據(jù)庫
屬性相關(guān)
屬性相關(guān) private final NodeHashMap nodes; //監(jiān)聽節(jié)點 private IWatchManager dataWatches; //監(jiān)聽節(jié)點 private IWatchManager childWatches; /** cached total size of paths and data for all DataNodes */ //總大小 private final AtomicLong nodeDataSize = new AtomicLong(0); /** the root of zookeeper tree */ //zookeeper的根節(jié)點 private static final String rootZookeeper = "/"; /** the zookeeper nodes that acts as the management and status node **/ //狀態(tài)管理節(jié)點 private static final String procZookeeper = Quotas.procZookeeper; /** th will be the string thats stored as a child of root */ //root的一個子節(jié)點 private static final String procChildZookeeper = procZookeeper.substring(1); /** * the zookeeper quota node that acts as the quota management node for * zookeeper */ //限額管理節(jié)點 private static final String quotaZookeeper = Quotas.quotaZookeeper; /** thi是s- will be the string thats stored as a child of /zookeeper */ // /zookeeper的子節(jié)點 private static final String quotaChildZookeeper = quotaZookeeper.substring(procZookeeper.length() + 1); /** * the zookeeper config node that acts as the config management node for * zookeeper */ //配置管理節(jié)點 private static final String configZookeeper = ZooDefs.CONFIG_NODE; /** thi是s- will be the string thats stored as a child of /zookeeper */ // 子節(jié)點config節(jié)點 private static final String configChildZookeeper = configZookeeper.substring(procZookeeper.length() + 1); /** * the path trie that keeps track of the quota nodes in thi是s- datatree */ //限額節(jié)點關(guān)聯(lián) private final PathTrie pTrie = new PathTrie(); /** * over-the-wire size of znode's stat. Counting the fields of Stat class */ //stat 類的field public static final int STAT_OVERHEAD_BYTES = (6 * 8) + (5 * 4); /** * Thi是s- hashtable li是s-ts the paths of the ephemeral nodes of a session. */ //臨時會話節(jié)點的相關(guān)路徑 private final Map> ephemerals = new ConcurrentHashMap >(); /** * Thi是s- set contains the paths of all container nodes */ // 容器節(jié)點的路徑 private final Set containers = Collections.newSetFromMap(new ConcurrentHashMap ()); /** * Thi是s- set contains the paths of all ttl nodes */ //ttl node的相關(guān)路徑 private final Set ttls = Collections.newSetFromMap(new ConcurrentHashMap ()); private final ReferenceCountedACLCache aclCache = new ReferenceCountedACLCache(); // The maximum number of tree digests that we will keep in our hi是s-tory public static final int DIGEST_LOG_LIMIT = 1024; // Dump digest every 128 txns, in hex it's 80, which will make it easier // to align and compare between servers. public static final int DIGEST_LOG_INTERVAL = 128; // If thi是s- i是s- not null, we are actively looking for a target zxid that we // want to validate the digest for private ZxidDigest digestFromLoadedSnapshot; // The digest associated with the highest zxid in the data tree. private volatile ZxidDigest lastProcessedZxidDigest; // Will be notified when digest mi是s-match event triggered. private final Li是s-t digestWatchers = new ArrayLi是s-t<>(); // The hi是s-torical digests li是s-t. private LinkedLi是s-t digestLog = new LinkedLi是s-t<>(); private final DigestCalculator digestCalculator;
到此,關(guān)于“zk的樹形數(shù)據(jù)模型是什么”的學(xué)習就結(jié)束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學(xué)習,快去試試吧!若想繼續(xù)學(xué)習更多相關(guān)知識,請繼續(xù)關(guān)注創(chuàng)新互聯(lián)網(wǎng)站,小編會繼續(xù)努力為大家?guī)砀鄬嵱玫奈恼拢?/p>
網(wǎng)站題目:zk的樹形數(shù)據(jù)模型是什么
網(wǎng)站URL:http://weahome.cn/article/jdidee.html