亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fsdirectory.java

?? Hadoop是一個用于運行應用程序在大型集群的廉價硬件設備上的框架。Hadoop為應用程序透明的提供了一組穩定/可靠的接口和數據運動。在 Hadoop中實現了Google的MapReduce算法
?? JAVA
?? 第 1 頁 / 共 2 頁
字號:
/** * Copyright 2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * *     http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */package org.apache.hadoop.dfs;import org.apache.hadoop.io.*;import java.io.*;import java.util.*;import org.apache.hadoop.conf.Configuration;import org.apache.hadoop.fs.FileUtil;/************************************************* * FSDirectory stores the filesystem directory state. * It handles writing/loading values to disk, and logging * changes as we go. * * It keeps the filename->blockset mapping always-current * and logged to disk. *  * @author Mike Cafarella *************************************************/class FSDirectory implements FSConstants {    static String FS_IMAGE = "fsimage";    static String NEW_FS_IMAGE = "fsimage.new";    static String OLD_FS_IMAGE = "fsimage.old";    private static final byte OP_ADD = 0;    private static final byte OP_RENAME = 1;    private static final byte OP_DELETE = 2;    private static final byte OP_MKDIR = 3;    /******************************************************     * We keep an in-memory representation of the file/block     * hierarchy.     ******************************************************/    class INode {        public String name;        public INode parent;        public TreeMap children = new TreeMap();        public Block blocks[];        /**         */        INode(String name, INode parent, Block blocks[]) {            this.name = name;            this.parent = parent;            this.blocks = blocks;        }        /**         * Check whether it's a directory         * @return         */        synchronized public boolean isDir() {          return (blocks == null);        }        /**         * This is the external interface         */        INode getNode(String target) {            if (! target.startsWith("/") || target.length() == 0) {                return null;            } 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;            }            if (index == components.size()-1) {                return this;            }            // Check with children            INode child = (INode) children.get(components.elementAt(index+1));            if (child == null) {                return null;            } else {                return child.getNode(components, index+1);            }        }        /**         */        INode addNode(String target, Block blks[]) {            if (getNode(target) != null) {                return null;            } else {                String parentName = DFSFile.getDFSParent(target);                if (parentName == null) {                    return null;                }                INode parentNode = getNode(parentName);                if (parentNode == null) {                    return null;                } else {                    String targetName = new File(target).getName();                    INode newItem = new INode(targetName, parentNode, blks);                    parentNode.children.put(targetName, newItem);                    return newItem;                }            }        }        /**         */        boolean removeNode() {            if (parent == null) {                return false;            } else {                parent.children.remove(name);                return true;            }        }        /**         * Collect all the blocks at this INode and all its children.         * This operation is performed after a node is removed from the tree,         * and we want to GC all the blocks at this node and below.         */        void collectSubtreeBlocks(Vector v) {            if (blocks != null) {                for (int i = 0; i < blocks.length; i++) {                    v.add(blocks[i]);                }            }            for (Iterator it = children.values().iterator(); it.hasNext(); ) {                INode child = (INode) it.next();                child.collectSubtreeBlocks(v);            }        }        /**         */        int numItemsInTree() {            int total = 0;            for (Iterator it = children.values().iterator(); it.hasNext(); ) {                INode child = (INode) it.next();                total += child.numItemsInTree();            }            return total + 1;        }        /**         */        String computeName() {            if (parent != null) {                return parent.computeName() + "/" + name;            } else {                return name;            }        }        /**         */        long computeFileLength() {            long total = 0;            if (blocks != null) {                for (int i = 0; i < blocks.length; i++) {                    total += blocks[i].getNumBytes();                }            }            return total;        }        /**         */        long computeContentsLength() {            long total = computeFileLength();            for (Iterator it = children.values().iterator(); it.hasNext(); ) {                INode child = (INode) it.next();                total += child.computeContentsLength();            }            return total;        }        /**         */        void listContents(Vector v) {            if (parent != null && blocks != null) {                v.add(this);            }            for (Iterator it = children.values().iterator(); it.hasNext(); ) {                INode child = (INode) it.next();                v.add(child);            }        }        /**         */        void saveImage(String parentPrefix, DataOutputStream out) throws IOException {            String fullName = "";            if (parent != null) {                fullName = parentPrefix + "/" + name;                new UTF8(fullName).write(out);                if (blocks == null) {                    out.writeInt(0);                } else {                    out.writeInt(blocks.length);                    for (int i = 0; i < blocks.length; i++) {                        blocks[i].write(out);                    }                }            }            for (Iterator it = children.values().iterator(); it.hasNext(); ) {                INode child = (INode) it.next();                child.saveImage(fullName, out);            }        }    }    INode rootDir = new INode("", null, null);    TreeSet activeBlocks = new TreeSet();    TreeMap activeLocks = new TreeMap();    DataOutputStream editlog = null;    boolean ready = false;    /** Access an existing dfs name directory. */    public FSDirectory(File dir) throws IOException {        File fullimage = new File(dir, "image");        if (! fullimage.exists()) {          throw new IOException("NameNode not formatted: " + dir);        }        File edits = new File(dir, "edits");        if (loadFSImage(fullimage, edits)) {            saveFSImage(fullimage, edits);        }        synchronized (this) {            this.ready = true;            this.notifyAll();            this.editlog = new DataOutputStream(new FileOutputStream(edits));        }    }    /** Create a new dfs name directory.  Caution: this destroys all files     * in this filesystem. */    public static void format(File dir, Configuration conf)      throws IOException {        File image = new File(dir, "image");        File edits = new File(dir, "edits");        if (!((!image.exists() || FileUtil.fullyDelete(image, conf)) &&              (!edits.exists() || edits.delete()) &&              image.mkdirs())) {                    throw new IOException("Unable to format: "+dir);        }    }    /**     * Shutdown the filestore     */    public void close() throws IOException {        editlog.close();    }    /**     * Block until the object is ready to be used.     */    void waitForReady() {        if (! ready) {            synchronized (this) {                while (!ready) {                    try {                        this.wait(5000);                    } catch (InterruptedException ie) {                    }                }            }        }    }    /**     * Load in the filesystem image.  It's a big list of     * filenames and blocks.  Return whether we should     * "re-save" and consolidate the edit-logs     */    boolean loadFSImage(File fsdir, File edits) throws IOException {        //        // Atomic move sequence, to recover from interrupted save        //        File curFile = new File(fsdir, FS_IMAGE);        File newFile = new File(fsdir, NEW_FS_IMAGE);        File oldFile = new File(fsdir, OLD_FS_IMAGE);        // Maybe we were interrupted between 2 and 4        if (oldFile.exists() && curFile.exists()) {            oldFile.delete();            if (edits.exists()) {                edits.delete();            }        } else if (oldFile.exists() && newFile.exists()) {            // Or maybe between 1 and 2            newFile.renameTo(curFile);            oldFile.delete();        } else if (curFile.exists() && newFile.exists()) {            // Or else before stage 1, in which case we lose the edits            newFile.delete();        }        //        // Load in bits        //        if (curFile.exists()) {            DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(curFile)));            try {                int numFiles = in.readInt();                for (int i = 0; i < numFiles; i++) {                    UTF8 name = new UTF8();                    name.readFields(in);                    int numBlocks = in.readInt();                    if (numBlocks == 0) {                        unprotectedAddFile(name, null);                    } else {                        Block blocks[] = new Block[numBlocks];                        for (int j = 0; j < numBlocks; j++) {                            blocks[j] = new Block();                            blocks[j].readFields(in);                        }                        unprotectedAddFile(name, blocks);                    }                }            } finally {                in.close();            }        }        if (edits.exists() && loadFSEdits(edits) > 0) {            return true;        } else {            return false;        }    }    /**     * Load an edit log, and apply the changes to the in-memory structure     *     * This is where we apply edits that we've been writing to disk all     * along.     */    int loadFSEdits(File edits) throws IOException {        int numEdits = 0;        if (edits.exists()) {            DataInputStream in = new DataInputStream(new BufferedInputStream(new FileInputStream(edits)));            try {

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人精品免费看| 一区二区三区日本| 日韩欧美激情四射| 制服丝袜国产精品| 欧美精品亚洲二区| 日韩一区二区三区视频| 欧美日产在线观看| 欧美tickling网站挠脚心| 777奇米成人网| 精品国产一二三区| 亚洲女人小视频在线观看| 中文字幕不卡在线观看| 日本一区二区三区四区| 国产精品福利一区| 亚洲日本在线观看| 亚洲1区2区3区视频| 五月天精品一区二区三区| 美女任你摸久久| 国产福利一区二区三区视频| 色综合久久精品| 欧美精品免费视频| 精品国产乱码久久久久久久| 国产亚洲欧美在线| 亚洲综合在线免费观看| 日韩av一级电影| 成人永久看片免费视频天堂| 欧美又粗又大又爽| 欧美成人精品高清在线播放| 国产精品美女久久福利网站| 亚洲一区国产视频| 激情小说亚洲一区| 99久久精品国产麻豆演员表| 69久久99精品久久久久婷婷 | 国产精品欧美久久久久一区二区| 综合中文字幕亚洲| 日韩国产欧美在线播放| 国产一区二区在线观看免费| 99久久伊人网影院| 欧美一区二区三区免费大片 | 欧美精品日日鲁夜夜添| 久久久精品欧美丰满| 一区二区三区在线高清| 精品影院一区二区久久久| 99久久国产综合精品色伊| 精品日韩成人av| 午夜日韩在线观看| 成人av电影在线网| 精品久久久久久亚洲综合网 | 久久99精品国产麻豆不卡| 91蜜桃网址入口| 久久综合色婷婷| 亚洲va韩国va欧美va| 国产精品一区在线| 欧美一区二区三区婷婷月色 | 在线成人免费视频| 久久久91精品国产一区二区三区| 亚洲成a人片在线不卡一二三区 | 欧美色综合网站| 国产精品久久久久久久久免费樱桃 | 国产一区二区三区日韩| 欧美日韩日日骚| 亚洲视频 欧洲视频| 国产精品一区二区在线看| 91精品国产综合久久久久| 亚洲欧美经典视频| av在线不卡网| 亚洲日穴在线视频| 91在线观看视频| 国产精品你懂的| 99久久久久久99| 自拍偷拍欧美精品| 91免费版pro下载短视频| 亚洲欧美在线观看| 91影视在线播放| 亚洲欧美成aⅴ人在线观看| a4yy欧美一区二区三区| 国产亚洲综合性久久久影院| 久久国产生活片100| 日韩欧美123| 精品在线免费观看| 久久精品男人的天堂| 国产成人一级电影| 欧美激情一区二区三区不卡| 成人伦理片在线| 亚洲色图.com| 欧美日韩免费电影| 麻豆精品一二三| 国产亚洲欧美色| 成人不卡免费av| 亚洲女厕所小便bbb| 色av一区二区| 性感美女久久精品| 精品国产一区a| av成人免费在线观看| 亚洲三级理论片| 91精品国产综合久久久蜜臀粉嫩| 九九久久精品视频| 亚洲日本在线视频观看| 欧美精品乱人伦久久久久久| 国内成人精品2018免费看| 中文字幕的久久| 欧美日韩国产综合一区二区 | 国产成人自拍网| 亚洲精品成人悠悠色影视| 欧美日韩综合一区| 极品美女销魂一区二区三区免费| 国产精品看片你懂得| 欧美精品久久99久久在免费线| 国产一区二区三区久久悠悠色av| 亚洲三级视频在线观看| 精品国产电影一区二区| 色香色香欲天天天影视综合网| 日本在线不卡视频一二三区| 国产精品嫩草久久久久| 欧美日韩大陆一区二区| 国产不卡一区视频| 日本午夜一区二区| 亚洲色欲色欲www| 精品国产91洋老外米糕| 色欧美片视频在线观看| 国产一区欧美二区| 亚洲午夜电影在线| 中文字幕高清一区| 2023国产一二三区日本精品2022| 色噜噜夜夜夜综合网| 国产一区二区三区美女| 视频在线观看一区二区三区| 亚洲欧洲精品一区二区三区不卡| 欧美草草影院在线视频| 欧美色视频在线| 不卡一区中文字幕| 粉嫩久久99精品久久久久久夜| 日本va欧美va瓶| 亚洲一区在线观看网站| 亚洲欧洲av在线| 国产亚洲综合在线| 欧美精品一区二区三区在线| 欧美精品第1页| 欧美做爰猛烈大尺度电影无法无天| 不卡电影一区二区三区| 高清日韩电视剧大全免费| 国产美女在线精品| 国产在线播放一区| 久久精品国产精品青草| 毛片不卡一区二区| 日韩不卡免费视频| 日韩vs国产vs欧美| 麻豆视频观看网址久久| 日韩高清不卡在线| 麻豆国产精品一区二区三区 | 日韩欧美一级片| 91精品国产一区二区三区蜜臀| 欧美性猛交xxxx黑人交| 日本伦理一区二区| 欧美视频一区在线| 欧美精品xxxxbbbb| 日韩精品一区二区三区在线观看| 日韩欧美中文一区二区| 欧美一区二区大片| 精品日韩一区二区三区| 久久久久久97三级| 中文字幕精品三区| 一区二区国产视频| 午夜精品久久久久久不卡8050| 婷婷丁香激情综合| 国产一区二区三区高清播放| 懂色一区二区三区免费观看| 99精品视频在线观看| 欧美亚洲免费在线一区| 91精品啪在线观看国产60岁| 欧美mv日韩mv国产| 综合分类小说区另类春色亚洲小说欧美| 亚洲视频在线一区| 欧美aaaaa成人免费观看视频| 国内精品在线播放| 色综合亚洲欧洲| 日韩亚洲欧美高清| 中文字幕乱码久久午夜不卡| 一区二区三区不卡视频在线观看| 亚洲国产精品影院| 蜜桃精品视频在线| 成人免费观看av| 欧美群妇大交群中文字幕| 久久久777精品电影网影网| 成人免费一区二区三区视频 | 欧美三级日韩在线| 精品99999| 亚洲成a人片在线观看中文| 国产精品99久久久久久宅男| 色老汉av一区二区三区| 2024国产精品视频| 亚洲成av人**亚洲成av**| 国产一区二区三区精品视频| 在线观看中文字幕不卡| 国产欧美日韩卡一| 日韩成人精品在线观看| 91在线观看下载| 久久色.com| 日韩二区三区四区| 色综合视频一区二区三区高清|