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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? fsdataset.java

?? Hadoop是一個(gè)用于運(yùn)行應(yīng)用程序在大型集群的廉價(jià)硬件設(shè)備上的框架。Hadoop為應(yīng)用程序透明的提供了一組穩(wěn)定/可靠的接口和數(shù)據(jù)運(yùn)動(dòng)。在 Hadoop中實(shí)現(xiàn)了Google的MapReduce算法
?? JAVA
字號(hào):
/** * 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 java.io.*;import java.util.*;import org.apache.hadoop.fs.*;import org.apache.hadoop.conf.*;/************************************************** * FSDataset manages a set of data blocks.  Each block * has a unique name and an extent on disk. * * @author Mike Cafarella ***************************************************/class FSDataset implements FSConstants {    static final double USABLE_DISK_PCT = 0.98;  /**     * A node type that can be built into a tree reflecting the     * hierarchy of blocks on the local disk.     */    class FSDir {        File dir;        FSDir children[];        /**         */        public FSDir(File dir) {            this.dir = dir;            this.children = null;        }        /**         */        public File getDirName() {            return dir;        }        /**         */        public FSDir[] getChildren() {            return children;        }        /**         */        public void addBlock(Block b, File src) {            addBlock(b, src, b.getBlockId(), 0);        }        /**         */        void addBlock(Block b, File src, long blkid, int depth) {            //            // Add to the local dir, if no child dirs            //            if (children == null) {                src.renameTo(new File(dir, b.getBlockName()));                //                // Test whether this dir's contents should be busted                 // up into subdirs.                //                // REMIND - mjc - sometime soon, we'll want this code                // working.  It prevents the datablocks from all going                // into a single huge directory.                /**                File localFiles[] = dir.listFiles();                if (localFiles.length == 16) {                    //                    // Create all the necessary subdirs                    //                    this.children = new FSDir[16];                    for (int i = 0; i < children.length; i++) {                        String str = Integer.toBinaryString(i);                        try {                            File subdir = new File(dir, "dir_" + str);                            subdir.mkdir();                            children[i] = new FSDir(subdir);                        } catch (StringIndexOutOfBoundsException excep) {                            excep.printStackTrace();                            System.out.println("Ran into problem when i == " + i + " an str = " + str);                        }                    }                    //                    // Move existing files into new dirs                    //                    for (int i = 0; i < localFiles.length; i++) {                        Block srcB = new Block(localFiles[i]);                        File dst = getBlockFilename(srcB, blkid, depth);                        if (!src.renameTo(dst)) {                            System.out.println("Unexpected problem in renaming " + src);                        }                    }                }                **/            } else {                // Find subdir                children[getHalfByte(blkid, depth)].addBlock(b, src, blkid, depth+1);            }        }        /**         * Fill in the given blockSet with any child blocks         * found at this node.         */        public void getBlockInfo(TreeSet blockSet) {            if (children != null) {                for (int i = 0; i < children.length; i++) {                    children[i].getBlockInfo(blockSet);                }            }            File blockFiles[] = dir.listFiles();            for (int i = 0; i < blockFiles.length; i++) {                if (Block.isBlockFilename(blockFiles[i])) {                    blockSet.add(new Block(blockFiles[i], blockFiles[i].length()));                }            }        }        /**         * Find the file that corresponds to the given Block         */        public File getBlockFilename(Block b) {            return getBlockFilename(b, b.getBlockId(), 0);        }        /**         * Helper method to find file for a Block         */                 private File getBlockFilename(Block b, long blkid, int depth) {            if (children == null) {                return new File(dir, b.getBlockName());            } else {                //                 // Lift the 4 bits starting at depth, going left->right.                // That means there are 2^4 possible children, or 16.                // The max depth is thus ((len(long) / 4) == 16).                //                return children[getHalfByte(blkid, depth)].getBlockFilename(b, blkid, depth+1);            }        }        /**         * Returns a number 0-15, inclusive.  Pulls out the right         * half-byte from the indicated long.         */        private int getHalfByte(long blkid, int halfByteIndex) {            blkid = blkid >> ((15 - halfByteIndex) * 4);            return (int) ((0x000000000000000F) & blkid);        }        public String toString() {          return "FSDir{" +              "dir=" + dir +              ", children=" + (children == null ? null : Arrays.asList(children)) +              "}";        }    }    //////////////////////////////////////////////////////    //    // FSDataSet    //    //////////////////////////////////////////////////////    DF diskUsage;    File data = null, tmp = null;    long reserved = 0;    FSDir dirTree;    TreeSet ongoingCreates = new TreeSet();    /**     * An FSDataset has a directory where it loads its data files.     */    public FSDataset(File dir, Configuration conf) throws IOException {        diskUsage = new DF( dir.getCanonicalPath(), conf);         this.data = new File(dir, "data");        if (! data.exists()) {            data.mkdirs();        }        this.tmp = new File(dir, "tmp");        if (tmp.exists()) {            FileUtil.fullyDelete(tmp, conf);        }        this.tmp.mkdirs();        this.dirTree = new FSDir(data);    }    /**     * Return total capacity, used and unused     */    public long getCapacity() throws IOException {        return diskUsage.getCapacity();    }    /**     * Return how many bytes can still be stored in the FSDataset     */    public long getRemaining() throws IOException {        return ((long) Math.round(USABLE_DISK_PCT * diskUsage.getAvailable())) - reserved;    }    /**     * Find the block's on-disk length     */    public long getLength(Block b) throws IOException {        if (! isValidBlock(b)) {            throw new IOException("Block " + b + " is not valid.");        }        File f = getFile(b);        return f.length();    }    /**     * Get a stream of data from the indicated block.     */    public InputStream getBlockData(Block b) throws IOException {        if (! isValidBlock(b)) {            throw new IOException("Block " + b + " is not valid.");        }        return new FileInputStream(getFile(b));    }    /**     * A Block b will be coming soon!     */    public boolean startBlock(Block b) throws IOException {        //        // Make sure the block isn't 'valid'        //        if (isValidBlock(b)) {            throw new IOException("Block " + b + " is valid, and cannot be created.");        }        return true;    }    /**     * Start writing to a block file     */    public OutputStream writeToBlock(Block b) throws IOException {        //        // Make sure the block isn't a valid one - we're still creating it!        //        if (isValidBlock(b)) {            throw new IOException("Block " + b + " is valid, and cannot be written to.");        }        //        // Serialize access to /tmp, and check if file already there.        //        File f = null;        synchronized (ongoingCreates) {            //            // Is it already in the create process?            //            if (ongoingCreates.contains(b)) {                throw new IOException("Block " + b + " has already been started (though not completed), and thus cannot be created.");            }            //            // Check if we have too little space            //            if (getRemaining() < BLOCK_SIZE) {                throw new IOException("Insufficient space for an additional block");            }            //            // OK, all's well.  Register the create, adjust             // 'reserved' size, & create file            //            ongoingCreates.add(b);            reserved += BLOCK_SIZE;            f = getTmpFile(b);	    try {		if (f.exists()) {		    throw new IOException("Unexpected problem in startBlock() for " + b + ".  File " + f + " should not be present, but is.");		}		//		// Create the zero-length temp file		//		if (!f.createNewFile()) {		    throw new IOException("Unexpected problem in startBlock() for " + b + ".  File " + f + " should be creatable, but is already present.");		}	    } catch (IOException ie) {                System.out.println("Exception!  " + ie);		ongoingCreates.remove(b);				reserved -= BLOCK_SIZE;                throw ie;	    }        }        //        // Finally, allow a writer to the block file        // REMIND - mjc - make this a filter stream that enforces a max        // block size, so clients can't go crazy        //        return new FileOutputStream(f);    }    //    // REMIND - mjc - eventually we should have a timeout system    // in place to clean up block files left by abandoned clients.    // We should have some timer in place, so that if a blockfile    // is created but non-valid, and has been idle for >48 hours,    // we can GC it safely.    //    /**     * Complete the block write!     */    public void finalizeBlock(Block b) throws IOException {        File f = getTmpFile(b);        if (! f.exists()) {            throw new IOException("No temporary file " + f + " for block " + b);        }                synchronized (ongoingCreates) {            //            // Make sure still registered as ongoing            //            if (! ongoingCreates.contains(b)) {                throw new IOException("Tried to finalize block " + b + ", but not in ongoingCreates table");            }            long finalLen = f.length();            b.setNumBytes(finalLen);            //            // Move the file            // (REMIND - mjc - shame to move the file within a synch            // section!  Maybe remove this?)            //            dirTree.addBlock(b, f);            //            // Done, so deregister from ongoingCreates            //            if (! ongoingCreates.remove(b)) {                throw new IOException("Tried to finalize block " + b + ", but could not find it in ongoingCreates after file-move!");            }             reserved -= BLOCK_SIZE;        }    }    /**     * Return a table of block data     */    public Block[] getBlockReport() {        TreeSet blockSet = new TreeSet();        dirTree.getBlockInfo(blockSet);        Block blockTable[] = new Block[blockSet.size()];        int i = 0;        for (Iterator it = blockSet.iterator(); it.hasNext(); i++) {            blockTable[i] = (Block) it.next();        }        return blockTable;    }    /**     * Check whether the given block is a valid one.     */    public boolean isValidBlock(Block b) {        File f = getFile(b);        if (f.exists()) {            return true;        } else {            return false;        }    }    /**     * We're informed that a block is no longer valid.  We     * could lazily garbage-collect the block, but why bother?     * just get rid of it.     */    public void invalidate(Block invalidBlks[]) throws IOException {        for (int i = 0; i < invalidBlks.length; i++) {            File f = getFile(invalidBlks[i]);            // long len = f.length();            if (!f.delete()) {                throw new IOException("Unexpected error trying to delete block " + invalidBlks[i] + " at file " + f);            }        }    }    /**     * Turn the block identifier into a filename.     */    File getFile(Block b) {        // REMIND - mjc - should cache this result for performance        return dirTree.getBlockFilename(b);    }    /**     * Get the temp file, if this block is still being created.     */    File getTmpFile(Block b) {        // REMIND - mjc - should cache this result for performance        return new File(tmp, b.getBlockName());    }    public String toString() {      return "FSDataset{" +        "dirpath='" + diskUsage.getDirPath() + "'" +        "}";    }}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
国产精品欧美久久久久一区二区| 欧美bbbbb| 欧美日韩国产片| 国产精品系列在线播放| 亚洲一区在线观看视频| 精品av综合导航| 欧美三级韩国三级日本一级| 国产aⅴ综合色| 午夜日韩在线观看| 亚洲视频在线观看三级| 久久亚洲综合av| 555夜色666亚洲国产免| 一本一道波多野结衣一区二区| 久久se精品一区二区| 亚瑟在线精品视频| 亚洲手机成人高清视频| 中文在线一区二区| 欧美精品一区二区三区蜜桃| 欧美日韩在线综合| 91老师片黄在线观看| 国产成a人亚洲精品| 久久精品国产**网站演员| 亚洲国产cao| 日韩一区二区三区视频在线 | 国产精品国产三级国产aⅴ入口 | 99久久亚洲一区二区三区青草| 免费观看在线色综合| 亚洲成在人线免费| 一区二区三区中文在线观看| 国产精品女同互慰在线看| 久久蜜桃香蕉精品一区二区三区| 日韩一区二区在线免费观看| 欧美日韩国产首页| 欧美亚洲日本一区| 在线亚洲欧美专区二区| 99国产麻豆精品| 91在线无精精品入口| 顶级嫩模精品视频在线看| 国产精品 欧美精品| 国产精品一区二区视频| 国产综合色视频| 国产一区二区精品久久91| 美国欧美日韩国产在线播放| 麻豆一区二区在线| 久久99国产精品久久99果冻传媒| 日本午夜精品一区二区三区电影| 五月天丁香久久| 免费成人结看片| 久久精品理论片| 久久不见久久见免费视频7| 久久99精品久久只有精品| 日本精品视频一区二区| 亚洲人成网站色在线观看| ...中文天堂在线一区| 自拍偷自拍亚洲精品播放| 亚洲视频香蕉人妖| 亚洲一区二区在线视频| 视频在线在亚洲| 老司机精品视频一区二区三区| 韩国女主播一区| 成人午夜私人影院| 在线视频你懂得一区| 91精品国产欧美一区二区18| 欧美成人a∨高清免费观看| 国产午夜精品福利| 亚洲精品视频免费观看| 亚洲尤物视频在线| 美国精品在线观看| www.亚洲人| 欧美日韩欧美一区二区| 91精品久久久久久久99蜜桃| 久久亚洲精精品中文字幕早川悠里| 国产日韩欧美精品电影三级在线| 亚洲人成小说网站色在线| 日韩电影在线一区| 国产91清纯白嫩初高中在线观看 | www.亚洲人| 欧美精品乱码久久久久久按摩| 日韩欧美国产一区在线观看| 国产欧美日韩在线| 亚洲福利一区二区三区| 国产一二三精品| 在线视频亚洲一区| 久久蜜桃av一区二区天堂| 国产精品久久久久久久久图文区| 国产精品福利av| 亚洲综合图片区| 经典三级一区二区| 欧美性一二三区| 国产日韩欧美一区二区三区综合| 夜夜爽夜夜爽精品视频| 国产制服丝袜一区| 91电影在线观看| 欧美激情一区二区三区蜜桃视频| 亚洲va天堂va国产va久| 成人的网站免费观看| 日韩亚洲欧美在线| 一区二区三区高清不卡| 国产精品一区二区在线观看不卡 | 欧美视频精品在线| 国产欧美日本一区视频| 日本在线播放一区二区三区| 成人激情小说乱人伦| 欧美一区二区免费视频| 亚洲精品亚洲人成人网| 成人在线一区二区三区| 欧美一区二区久久久| 亚洲精品国产无天堂网2021| 夫妻av一区二区| 欧美不卡一区二区| 午夜精品免费在线观看| 色成年激情久久综合| 国产欧美日本一区视频| 韩国精品久久久| 欧美日韩在线观看一区二区 | 中文无字幕一区二区三区| 蜜桃视频在线一区| 久久久蜜桃精品| 91精品国产91久久久久久一区二区| 中文字幕日韩av资源站| 国产乱子轮精品视频| 日韩视频一区二区三区在线播放| 亚洲制服丝袜在线| 91美女片黄在线观看| 国产精品美女久久福利网站| 日韩av二区在线播放| 欧美午夜不卡在线观看免费| 亚洲人成电影网站色mp4| 成av人片一区二区| 国产三级久久久| 国产一区二区三区四区五区美女 | 成人免费小视频| 成人黄色电影在线 | 日韩欧美精品在线视频| 久久草av在线| www精品美女久久久tv| 韩国三级在线一区| 亚洲精品在线观看视频| 久久国产欧美日韩精品| 欧美大片在线观看| 极品美女销魂一区二区三区免费| 日韩一级片在线观看| 另类小说图片综合网| 欧美一卡二卡在线| 精品一区二区在线播放| 亚洲精品一区二区精华| 国产成人丝袜美腿| 国产精品久久久久毛片软件| 91在线丨porny丨国产| 亚洲人123区| 在线精品亚洲一区二区不卡| 亚洲成人动漫在线免费观看| 欧美蜜桃一区二区三区| 美女视频黄 久久| 久久久99精品免费观看不卡| 福利一区二区在线| 成人欧美一区二区三区小说| 在线欧美日韩精品| 亚洲va欧美va天堂v国产综合| 91丨porny丨户外露出| 亚洲高清视频在线| 日韩一级欧美一级| 国产精品一品二品| 亚洲日本va午夜在线电影| 欧美色图天堂网| 韩国成人福利片在线播放| 国产精品三级电影| 欧美日韩在线播放三区四区| 麻豆91精品视频| 中文字幕二三区不卡| 日本韩国一区二区三区视频| 青青草精品视频| 亚洲国产激情av| 欧美日韩国产系列| 国产乱码精品一区二区三区av| 国产精品区一区二区三| 欧美三级三级三级| 国产精品一品二品| 图片区小说区国产精品视频| 久久综合给合久久狠狠狠97色69| 成人a免费在线看| 秋霞成人午夜伦在线观看| 国产偷v国产偷v亚洲高清| 欧美私人免费视频| 国产成人免费9x9x人网站视频| 一区二区三区不卡视频在线观看| 精品日韩在线一区| 色噜噜狠狠色综合中国| 九九视频精品免费| 洋洋av久久久久久久一区| 久久蜜臀中文字幕| 91精品在线免费观看| 99re视频这里只有精品| 久久99国产精品麻豆| 亚洲一区二区四区蜜桃| 国产日产亚洲精品系列| 91麻豆精品国产91久久久久| 99久久伊人精品| 国产福利91精品一区二区三区| 天天色 色综合|