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

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

?? distributedwebdbwriter.java

?? 爬蟲數(shù)據(jù)的改進,并修正了一些bug
?? JAVA
?? 第 1 頁 / 共 5 頁
字號:
/* Copyright (c) 2003 The Nutch Organization.  All rights reserved.   */
/* Use subject to the conditions in http://www.nutch.org/LICENSE.txt. */

package net.nutch.db;

import java.io.*;
import java.util.*;
import java.util.logging.*;
import java.nio.channels.*;

import net.nutch.io.*;
import net.nutch.fs.*;
import net.nutch.util.*;
import net.nutch.pagedb.*;
import net.nutch.linkdb.*;

/***************************************************
 * This is a wrapper class that allows us to reorder
 * write operations to the linkdb and pagedb.  It is
 * useful only for objects like UpdateDatabaseTool,
 * which just does writes.
 *
 * The WebDBWriter is a traditional single-pass database writer.
 * It does not cache any instructions to disk (but it does
 * in memory, with possible resorting).  It certainly does
 * nothing in a distributed fashion.
 *
 * There are other implementors of IWebDBWriter that do
 * all that fancy stuff.
 *
 * @author Mike Cafarella
 *************************************************/
public class DistributedWebDBWriter implements IWebDBWriter {
    static final Logger LOG = LogFormatter.getLogger("net.nutch.db.WebDBWriter");
    static final byte CUR_VERSION = 0;
    static final byte OPEN_COUNTER_VERSION = 0;
    static final byte CLOSE_COUNTER_VERSION = 0;
    static final byte MACHINE_INFO_VERSION = 0;

    // magic number
    static int READY_TO_USE = 0xbabecafe;
    static int IS_COMPLETE = 0xbabe0000;
    static int WRITE_LOCK_INFO = 0xcafe0000;
    static long LONG_TIMEOUT = 10 * 1000;

    // db opcodes
    static final byte ADD_PAGE = 0;
    static final byte ADD_PAGE_WITH_SCORE = 1;
    static final byte ADD_PAGE_IFN_PRESENT = 2;
    static final byte DEL_PAGE = 3;
    static final int ADD_LINK = 0;
    static final int DEL_LINK = 1;
    static final int DEL_SINGLE_LINK = 2;

    // filenames
    static final String PAGES_BY_URL = "pagesByURL";
    static final String PAGES_BY_MD5 = "pagesByMD5";
    static final String LINKS_BY_URL = "linksByURL";
    static final String LINKS_BY_MD5 = "linksByMD5";
    static final String STATS_FILE = "stats";
    static final String META_SHAREGROUP = "metashare";
    static final String METAINFO = "metainfo";

    // Result codes for page-url comparisons
    static final int NO_OUTLINKS = 0;
    static final int HAS_OUTLINKS = 1;
    static final int LINK_INVALID = 2;

    /********************************************
     * PageInstruction holds an operation over a Page.
     *********************************************/
    public static class PageInstruction implements WritableComparable {
        byte opcode;
        boolean hasLink;
        Page page;
        Link link;

        /**
         */
        public PageInstruction() {}

        /**
         */
        public PageInstruction(Page page, int opcode) {
            set(page, opcode);
        }

        /**
         */
        public PageInstruction(Page page, Link link, int opcode) {
            set(page, link, opcode);
        }

        /**
         * Init from another PageInstruction object.
         */
        public void set(PageInstruction that) {
            this.opcode = that.opcode;

            if (this.page == null) {
                this.page = new Page();
            }
            this.page.set(that.page);

            if (this.link == null) {
                this.link = new Link();
            }
            this.hasLink = that.hasLink;
            if (this.hasLink) {
                this.link.set(that.link);
            }
        }

        /**
         * Init PageInstruction with no Link
         */
        public void set(Page page, int opcode) {
            this.opcode = (byte) opcode;
            this.page = page;
            this.hasLink = false;
            this.link = null;
        }

        /**
         * Init PageInstruction with a Link
         */         
        public void set(Page page, Link link, int opcode) {
            this.opcode = (byte) opcode;
            this.page = page;
            this.hasLink = true;
            this.link = link;
        }

        //
        // WritableComparable
        //
        public int compareTo(Object o) {
            int pageResult = this.page.compareTo(((PageInstruction) o).page);
            if (pageResult != 0) {
                return pageResult;
            } else {
                return this.opcode - (((PageInstruction) o).opcode);
            }
        }
        public void write(DataOutput out) throws IOException {
            out.writeByte(opcode);
            page.write(out);
            out.writeByte(hasLink ? 1 : 0);
            if (hasLink) {
                link.write(out);
            }
        }
        public void readFields(DataInput in) throws IOException {
            opcode = in.readByte();
            if (page == null) {
                page = new Page();
            }
            page.readFields(in);
            
            if (link == null) {
                link = new Link();
            }
            hasLink = (1 == in.readByte());
            if (hasLink) {
                link.readFields(in);
            }
        }
        public Page getPage() {
            return page;
        }
        public Link getLink() {
            if (hasLink) {
                return link;
            } else {
                return null;
            }
        }
        public int getInstruction() {
            return opcode;
        }

        /**
         * Sorts the instruction first by Page, then by opcode.
         */
        public static class PageComparator extends WritableComparator {
            private static final Page.Comparator PAGE_COMPARATOR =
            new Page.Comparator();

            public PageComparator() { super(PageInstruction.class); }

            /** Optimized comparator. */
            public int compare(byte[] b1, int s1, int l1,
                               byte[] b2, int s2, int l2) {
                int opcode1 = b1[s1];
                int opcode2 = b2[s2];
                int c = PAGE_COMPARATOR.compare(b1, s1+1, l1-1, b2, s2+1, l2-1);
                if (c != 0)
                    return c;
                return opcode1 - opcode2;
            }
        }
 
        /*****************************************************
         * Sorts the instruction first by url, then by opcode.
         *****************************************************/
        public static class UrlComparator extends WritableComparator {
            private static final Page.UrlComparator PAGE_COMPARATOR =
            new Page.UrlComparator();

            public UrlComparator() { super(PageInstruction.class); }

            /**
             * We need to sort by ordered URLs.  First, we sort by
             * URL, then by opcode.
             */
            public int compare(WritableComparable a, WritableComparable b) {
                PageInstruction instructionA = (PageInstruction)a;
                PageInstruction instructionB = (PageInstruction)b;
                Page pageA = instructionA.getPage();
                Page pageB = instructionB.getPage();

                int result = pageA.getURL().compareTo(pageB.getURL());
                if (result != 0) {
                    return result;
                } else {
                    return instructionA.opcode - instructionB.opcode;
                }
            }

            /** 
             * Optimized comparator. 
             */
            public int compare(byte[] b1, int s1, int l1,
                               byte[] b2, int s2, int l2) {
                int opcode1 = b1[s1];
                int opcode2 = b2[s2];
                int c = PAGE_COMPARATOR.compare(b1, s1+1, l1-1, b2, s2+1, l2-1);
                if (c != 0)
                    return c;
                return opcode1 - opcode2;
            }
        }
    }

    /********************************************************
     * PageInstructionWriter very efficiently writes a 
     * PageInstruction to an EditSectionGroupWriter.  Much better
     * than calling "writer.append(new PageInstruction())"
     ********************************************************/
    public static class PageInstructionWriter {
        PageInstruction pi = new PageInstruction();

        /**
         */
        public PageInstructionWriter() {
        }

        /**
         * Append the PageInstruction info to the indicated SequenceFile,
         * and keep the PI for later reuse.
         */
        public synchronized void appendInstructionInfo(EditSectionGroupWriter writer, Page page, int opcode, Writable val) throws IOException {
            pi.set(page, opcode);
            writer.append(pi, val);
        }

        /**
         * Append the PageInstruction info to the indicated SequenceFile,
         * and keep the PI for later reuse.
         */
        public synchronized void appendInstructionInfo(EditSectionGroupWriter writer, Page page, Link link, int opcode, Writable val) throws IOException {
            pi.set(page, link, opcode);
            writer.append(pi, val);
        }
    }

    /*************************************************************
     * Reduce multiple instructions for a given url to the single effective
     * instruction.  ADD is prioritized highest, then ADD_IFN_PRESENT, and then
     * DEL.  Not coincidentally, this is opposite the order they're sorted in.
     **************************************************************/
    private static class DeduplicatingPageSequenceReader {
        SequenceFile.Reader edits;
        PageInstruction current = new PageInstruction();
        UTF8 currentUrl = new UTF8();
        boolean haveCurrent;

        /**
         */
        public DeduplicatingPageSequenceReader(SequenceFile.Reader edits) throws IOException {
            this.edits = edits;
            this.haveCurrent = edits.next(current, NullWritable.get());
        }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
色妞www精品视频| 亚洲电影一区二区| 亚洲高清一区二区三区| 精品午夜一区二区三区在线观看| 欧美乱妇一区二区三区不卡视频| 一区二区三区在线视频免费| 色一区在线观看| 最新高清无码专区| 91麻豆产精品久久久久久| 国产精品午夜电影| 成人激情小说网站| 中文字幕成人网| av在线一区二区| 亚洲色图制服丝袜| 粉嫩嫩av羞羞动漫久久久| 欧美电影精品一区二区| 午夜精品福利一区二区蜜股av| 欧美日韩一区二区三区四区| 天堂成人免费av电影一区| 日韩欧美一区二区三区在线| 黄色成人免费在线| 国产精品色哟哟| 91婷婷韩国欧美一区二区| 一区二区三区成人在线视频| 欧美日韩色综合| 国产尤物一区二区在线 | 色噜噜狠狠色综合欧洲selulu| 亚洲伦在线观看| 欧美丰满嫩嫩电影| 狠狠色伊人亚洲综合成人| 国产日韩精品一区二区浪潮av | 精品亚洲欧美一区| 国产三级一区二区| 国产a久久麻豆| 亚洲丝袜精品丝袜在线| 欧美一区二区三区四区视频| 国产精品自拍av| 亚洲日本成人在线观看| 欧美精品久久99久久在免费线 | 日韩精品久久理论片| 久久久影视传媒| 欧美亚洲国产一区二区三区va| 久久精品国产一区二区三| 国产精品网站导航| 91精品国产日韩91久久久久久| eeuss国产一区二区三区| 亚洲曰韩产成在线| 精品国产成人在线影院| 91免费视频观看| 另类成人小视频在线| 亚洲精品自拍动漫在线| 欧美精品一区二区蜜臀亚洲| 色婷婷亚洲综合| 国产乱码精品一区二区三区五月婷| 亚洲美女区一区| 精品动漫一区二区三区在线观看| 日本电影亚洲天堂一区| 国产成人av一区二区三区在线| 一区二区三区不卡视频| 日韩精品在线一区| 丁香激情综合五月| 久久aⅴ国产欧美74aaa| 亚洲不卡av一区二区三区| 国产精品萝li| 欧美另类videos死尸| 91在线精品一区二区三区| 国产一区三区三区| 另类小说色综合网站| 亚洲电影欧美电影有声小说| 国产精品久久久久久久久免费桃花 | 亚洲欧洲成人自拍| 久久亚洲影视婷婷| 777久久久精品| www.亚洲国产| 日韩av一区二区三区| 亚洲免费看黄网站| 国产精品久久久久aaaa| 国产欧美日韩麻豆91| 精品剧情在线观看| 欧美片在线播放| 色综合天天综合网天天看片| 国产精品亚洲视频| 国产精品一区二区在线播放| 另类小说欧美激情| 麻豆一区二区三区| 午夜精品免费在线| 亚洲女人小视频在线观看| 久久亚洲二区三区| 精品人在线二区三区| 欧美成人a∨高清免费观看| 日韩欧美综合一区| 日韩午夜激情电影| 欧美性生活大片视频| 国产一区二区三区蝌蚪| 老司机免费视频一区二区三区| 日韩和欧美一区二区三区| 日韩精品视频网| 日本不卡一区二区| 精品亚洲欧美一区| 国产成人亚洲综合a∨婷婷 | 色综合久久综合网| 91视视频在线观看入口直接观看www| 国产精品一区三区| 成人av电影在线网| 在线视频国产一区| 欧美日韩视频在线观看一区二区三区 | 欧美喷水一区二区| 91麻豆精品国产综合久久久久久| 欧美高清视频一二三区| 欧美日韩成人综合| 欧美日韩美女一区二区| 欧美一区二区精品久久911| 日韩精品专区在线| 精品三级在线观看| 国产欧美精品国产国产专区| 亚洲女同ⅹxx女同tv| 亚洲国产精品久久久男人的天堂| 日韩国产欧美视频| 国产精品一区在线观看乱码| eeuss鲁片一区二区三区 | 国内精品伊人久久久久av一坑| 国产一区欧美二区| 97se亚洲国产综合在线| 色综合天天综合狠狠| 色综合天天狠狠| 91精品国产乱码久久蜜臀| 久久中文娱乐网| 亚洲视频 欧洲视频| 国产精品久久久久久久裸模| 亚洲一区在线视频| 精品一区二区三区免费播放| av一区二区三区| 日韩一区二区三区观看| 精品日韩在线一区| 亚洲乱码国产乱码精品精可以看| 蜜臀91精品一区二区三区| 不卡视频免费播放| 在线精品国精品国产尤物884a| 91亚洲精品一区二区乱码| 日韩欧美中文字幕制服| 亚洲欧美日韩国产另类专区| 日本欧美一区二区三区乱码| 99久久综合色| 精品国产91亚洲一区二区三区婷婷 | 国产精品国产三级国产aⅴ中文| 日韩一区欧美二区| 国产成人av福利| 欧美一区二区在线免费播放| 国产欧美日韩中文久久| 亚洲成人手机在线| 国内偷窥港台综合视频在线播放| 成人精品免费视频| 欧美日韩另类国产亚洲欧美一级| 日韩视频免费直播| 中文字幕成人av| 亚洲自拍偷拍图区| 色综合久久中文字幕| 久久综合久久综合亚洲| 亚洲女同一区二区| 懂色av一区二区三区免费看| 日韩精品一区二区三区四区 | 久久天天做天天爱综合色| 亚洲香蕉伊在人在线观| 成人午夜激情视频| 久久久久免费观看| 久久精品久久精品| 欧美一区二区免费观在线| 中文字幕一区二区三区av| 秋霞午夜av一区二区三区| 欧美性高清videossexo| 亚洲精品自拍动漫在线| 99热国产精品| 亚洲欧美一区二区视频| 国产麻豆精品久久一二三| 精品少妇一区二区| 亚洲午夜私人影院| 日韩一区二区三区四区五区六区| 亚洲123区在线观看| 欧美性感一类影片在线播放| 亚洲精品国产第一综合99久久| 成人a区在线观看| 国产精品精品国产色婷婷| 国产成人精品影院| 国产日韩影视精品| 成人一区二区三区视频在线观看 | 亚洲精品一区二区三区在线观看 | 国产成人在线看| 国产人成一区二区三区影院| 国产精品一级二级三级| 日韩免费电影一区| 日本不卡在线视频| 精品国产乱子伦一区| 国产精品66部| 国产精品美女久久久久aⅴ| 99精品国产视频| 亚洲综合激情网| 91精品一区二区三区在线观看| 中文字幕在线播放不卡一区| 欧美片在线播放| 国精产品一区一区三区mba桃花 |