欧美一区二区三区老妇人-欧美做爰猛烈大尺度电-99久久夜色精品国产亚洲a-亚洲福利视频一区二区

HDFS中exists函數(shù)的作用是什么

這期內(nèi)容當(dāng)中小編將會(huì)給大家?guī)碛嘘P(guān)HDFS中exists函數(shù)的作用是什么,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

創(chuàng)新互聯(lián)專注為客戶提供全方位的互聯(lián)網(wǎng)綜合服務(wù),包含不限于網(wǎng)站設(shè)計(jì)制作、成都網(wǎng)站建設(shè)、橫峰網(wǎng)絡(luò)推廣、成都微信小程序、橫峰網(wǎng)絡(luò)營銷、橫峰企業(yè)策劃、橫峰品牌公關(guān)、搜索引擎seo、人物專訪、企業(yè)宣傳片、企業(yè)代運(yùn)營等,從售前售中售后,我們都將竭誠為您服務(wù),您的肯定,是我們最大的嘉獎(jiǎng);創(chuàng)新互聯(lián)為所有大學(xué)生創(chuàng)業(yè)者提供橫峰建站搭建服務(wù),24小時(shí)服務(wù)熱線:13518219792,官方網(wǎng)址:www.chinadenli.net

/**

     */

    public boolean exists(String src) throws IOException {

        return namesystem.exists(new UTF8(src));//直接調(diào)用namesystem.

    }

 那下面我們來看看namesystem是如何來判斷的。

public boolean exists(UTF8 src) {

        if (dir.getFile(src) != null || dir.isDir(src)) {

            return true;//從這可以看到,要么確實(shí)存在,如果不存在且是目錄也可以。

        } else {

            return false;

        }

    }

先分析getFile(...)函數(shù)。

-----------------------------------------

public Block[] getFile(UTF8 src) {

        waitForReady();

        synchronized (rootDir) {

            INode targetNode = rootDir.getNode(src.toString());//獲取節(jié)點(diǎn)

            if (targetNode == null) {

                return null;//節(jié)點(diǎn)不存在

            } else {

                return targetNode.blocks;//節(jié)點(diǎn)存在,返回文件塊信息

            }

        }

    }

 ----------繼續(xù)分析getNode

INode getNode(String target) {

            if (! target.startsWith("/") || target.length() == 0) {

                return null;//路徑是否規(guī)范

            } else if (parent == null && "/".equals(target)) {

                return this;//是否為根目錄

            } else {

                Vector components = new Vector();

                int start = 0;

                int slashid = 0;

                while (start < target.length() && (slashid = target.indexOf('/', start)) >= 0) {

                    components.add(target.substring(start, slashid));

                    start = slashid + 1;

                }

                if (start < target.length()) {

                    components.add(target.substring(start));

                }

                return getNode(components, 0);//開啟遞歸查找模式

            }

        }

 ---------

 INode getNode(Vector components, int index) {

            if (! name.equals((String) components.elementAt(index))) {

                return null;//當(dāng)前INode的名字是否OK?

            }

            if (index == components.size()-1) {

                return this;//已經(jīng)到了最后一個(gè)item

            }

            // Check with children

            INode child = (INode) children.get(components.elementAt(index+1));//根據(jù)文件名從children中查找對應(yīng)INode,然后再遞歸查找

            if (child == null) {

                return null;

            } else {

                return child.getNode(components, index+1);

            }

        }

-------------好,然后分析isDir函數(shù)

public boolean isDir(UTF8 src) {

        synchronized (rootDir) {

            INode node = rootDir.getNode(normalizePath(src));

            return node != null && node.isDir();

        }

    }

上述就是小編為大家分享的HDFS中exists函數(shù)的作用是什么了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道。

當(dāng)前文章:HDFS中exists函數(shù)的作用是什么
標(biāo)題鏈接:http://www.chinadenli.net/article32/jdhcpc.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供品牌網(wǎng)站制作定制開發(fā)Google網(wǎng)站內(nèi)鏈手機(jī)網(wǎng)站建設(shè)網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)

手機(jī)網(wǎng)站建設(shè)