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

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

?? distributedwebdbwriter.java

?? 爬蟲數(shù)據(jù)的改進(jìn),并修正了一些bug
?? JAVA
?? 第 1 頁 / 共 5 頁
字號(hào):
/* 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());
        }

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
香蕉乱码成人久久天堂爱免费| 欧美日韩黄色一区二区| 99在线热播精品免费| 色94色欧美sute亚洲线路一ni| 欧美在线一区二区| av一区二区不卡| 日本韩国一区二区三区视频| 91久久精品一区二区三| 欧美男女性生活在线直播观看| 日韩美一区二区三区| 久久影院视频免费| 久久久久9999亚洲精品| 亚洲欧洲日韩一区二区三区| 一区二区国产视频| 日本伊人色综合网| 久久精品免费观看| 成人ar影院免费观看视频| 久久午夜色播影院免费高清| 久久精品欧美一区二区三区不卡| 亚洲激情成人在线| 久久国产尿小便嘘嘘| 成人激情动漫在线观看| 91九色02白丝porn| 亚洲精品一区二区三区福利| 综合久久综合久久| 亚洲一区二区影院| 国产美女在线观看一区| 在线中文字幕不卡| 日韩色视频在线观看| 亚洲青青青在线视频| 美女一区二区视频| 91美女片黄在线观看| 欧美一级xxx| 一区二区三区av电影 | 成人短视频下载| 在线观看中文字幕不卡| 欧美精品一区二区三区高清aⅴ| 成人免费在线观看入口| 国产尤物一区二区| 精品视频一区三区九区| 中文字幕av一区二区三区高| 亚洲成人www| 色综合天天做天天爱| 日韩欧美中文字幕一区| 亚洲精品国产精华液| 九色porny丨国产精品| 欧美日韩国产不卡| 国产精品少妇自拍| 精品一二三四在线| 欧美色精品天天在线观看视频| 中文字幕五月欧美| 精品一区二区三区影院在线午夜| 欧美日韩国产中文| 高清不卡在线观看| 精品国产免费一区二区三区四区 | 手机精品视频在线观看| 国产不卡视频一区| 精品噜噜噜噜久久久久久久久试看| 国产精品网站一区| 国产99一区视频免费| 欧美一级午夜免费电影| 一区二区三区不卡视频| 亚洲福利电影网| 91久久精品网| 亚洲日本中文字幕区| 国产传媒一区在线| 日韩一区二区电影在线| 天天操天天综合网| 在线一区二区三区四区五区| 欧美国产精品中文字幕| 国产麻豆日韩欧美久久| 久久久精品影视| 激情综合网最新| 911精品国产一区二区在线| 一区二区三区欧美视频| 91成人网在线| 亚洲精品久久7777| 91蝌蚪国产九色| 综合久久久久久| 色综合久久99| 一区二区三区四区不卡在线 | 不卡在线观看av| 欧美激情一区二区三区| 国产精品69毛片高清亚洲| 精品国产免费人成在线观看| 毛片av中文字幕一区二区| 91精品国产综合久久久久久久久久| 亚洲第一二三四区| 欧美日韩另类一区| 亚洲国产wwwccc36天堂| 欧美日韩国产系列| 亚洲成人第一页| 欧美视频精品在线| 亚洲福利视频三区| 91精品久久久久久蜜臀| 午夜亚洲福利老司机| 日韩精品中文字幕在线不卡尤物| 五月激情综合婷婷| 69av一区二区三区| 久久国产精品一区二区| 欧美极品美女视频| 成人免费三级在线| 亚洲色图一区二区| 91黄色小视频| 欧美亚洲综合另类| 色综合久久久久| 亚洲国产综合91精品麻豆| 欧美电影一区二区三区| 国产一区二区不卡老阿姨| 国产精品乱人伦中文| 日本韩国一区二区三区| 日韩成人免费看| 久久精品无码一区二区三区| 91老司机福利 在线| 日韩av一区二区三区| 国产欧美日本一区视频| 欧美在线看片a免费观看| 久久精品久久精品| 亚洲男人天堂av| 日韩欧美国产不卡| 成人国产免费视频| 日本三级亚洲精品| 国产精品福利一区| 欧美日韩亚洲高清一区二区| 国产精品亚洲一区二区三区妖精| 一级中文字幕一区二区| 久久综合久久综合九色| 91蜜桃在线免费视频| 久88久久88久久久| 亚洲乱码国产乱码精品精小说 | 亚洲国产激情av| 欧美性高清videossexo| 国产精品中文欧美| 五月婷婷色综合| 中文字幕亚洲精品在线观看| 日韩欧美国产综合在线一区二区三区| 成人午夜视频在线观看| 视频一区中文字幕国产| 中文字幕欧美激情| 日韩一级精品视频在线观看| 91蝌蚪porny成人天涯| 国产精品18久久久| 日韩极品在线观看| 一区二区三区四区视频精品免费 | 国产一区二区三区在线观看免费视频 | 亚洲一区免费视频| 国产欧美一区二区精品久导航 | 韩国成人精品a∨在线观看| 亚洲自拍都市欧美小说| 国产精品免费人成网站| 2017欧美狠狠色| 在线视频一区二区免费| 成人av在线资源网站| 精品一区二区三区在线视频| 五月天欧美精品| 成人av午夜电影| 亚洲国产高清aⅴ视频| 三级不卡在线观看| 从欧美一区二区三区| 日日夜夜免费精品视频| 93久久精品日日躁夜夜躁欧美| 欧美一区在线视频| 婷婷开心激情综合| 国产蜜臀av在线一区二区三区| 蜜桃视频在线观看一区| 在线一区二区三区做爰视频网站| 国产精品区一区二区三| 久久99久久久久久久久久久| 国产三级一区二区| 成人av网站在线| 日本一道高清亚洲日美韩| 亚洲精品国产一区二区三区四区在线| 欧美日本国产一区| 中文乱码免费一区二区 | 一本大道久久a久久综合| 国产欧美久久久精品影院| 国产在线一区观看| 久久综合九色综合欧美就去吻| 日韩电影在线免费观看| 日韩欧美视频在线 | 亚洲男人的天堂网| 色综合天天性综合| 亚洲成a人片在线不卡一二三区| 在线免费观看日本一区| 亚洲成在人线在线播放| 欧美日韩国产免费一区二区| 免费看欧美女人艹b| 久久精品网站免费观看| 91色乱码一区二区三区| 亚洲成人综合网站| 精品国产亚洲一区二区三区在线观看| 国内精品久久久久影院薰衣草| 欧美国产欧美综合| 欧美无乱码久久久免费午夜一区 | 91精品欧美一区二区三区综合在 | 久久精品国产在热久久| 国产精品久久久久久户外露出| 色综合久久久久久久久久久| 亚洲永久免费av| 欧美人伦禁忌dvd放荡欲情|