Package net.yacy.kelondro.index

Examples of net.yacy.kelondro.index.Index


            final File path,
            final String tablename,
            final boolean useTailCache,
            final boolean exceed134217727) {
        this.location = path;
        Index backupIndex = null;
        try {
            backupIndex = new SplitTable(this.location, tablename, URIMetadataRow.rowdef, useTailCache, exceed134217727);
        } catch (RowSpaceExceededException e) {
            try {
                backupIndex = new SplitTable(this.location, tablename, URIMetadataRow.rowdef, false, exceed134217727);
View Full Code Here


        // second pass: open tables
        Iterator<Map.Entry<String, Long>> i;
        Map.Entry<String, Long> entry;
        String maxf;
        long maxram;
        Index table;
        while (!t.isEmpty()) {
            // find maximum table
            maxram = 0;
            maxf = null;
            i = t.entrySet().iterator();
View Full Code Here

    public boolean has(final byte[] key) {
        return keeperOf(key) != null;
    }
   
    public Row.Entry get(final byte[] key) throws IOException {
        final Index keeper = keeperOf(key);
        if (keeper == null) return null;
        return keeper.get(key);
    }
View Full Code Here

        return table;
    }
   
    public Row.Entry replace(final Row.Entry row) throws IOException, RowSpaceExceededException {
        assert row.objectsize() <= this.rowdef.objectsize;
        Index keeper = keeperOf(row.getPrimaryKeyBytes());
        if (keeper != null) return keeper.replace(row);
        synchronized (this.tables) {
            assert this.current == null || this.tables.get(this.current) != null : "this.current = " + this.current;
            keeper = (this.current == null) ? newTable() : checkTable(this.tables.get(this.current));
        }
        keeper.put(row);
        return null;
    }
View Full Code Here

    public boolean put(final Row.Entry row) throws IOException, RowSpaceExceededException {
        assert row.objectsize() <= this.rowdef.objectsize;
        byte[] key = row.getPrimaryKeyBytes();
        if (tables == null) return true;
        synchronized (this.tables) {
            Index keeper = keeperOf(key);
            if (keeper != null) return keeper.put(row);
            assert this.current == null || this.tables.get(this.current) != null : "this.current = " + this.current;
            keeper = (this.current == null) ? newTable() : checkTable(this.tables.get(this.current));
            boolean b = keeper.put(row);
            assert b;
            return b;
        }
    }
View Full Code Here

        return null;
    }
   
    public void addUnique(final Row.Entry row) throws IOException, RowSpaceExceededException {
        assert row.objectsize() <= this.rowdef.objectsize;
        Index table = (this.current == null) ? null : tables.get(this.current);
        synchronized (this.tables) {
            assert this.current == null || this.tables.get(this.current) != null : "this.current = " + this.current;
            if (table == null) table = newTable(); else table = checkTable(table);
        }
        table.addUnique(row);
    }
View Full Code Here

        }
        return report;
    }
   
    public boolean delete(final byte[] key) throws IOException {
        final Index table = keeperOf(key);
        if (table == null) return false;
        return table.delete(key);
    }
View Full Code Here

        if (table == null) return false;
        return table.delete(key);
    }
   
    public Row.Entry remove(final byte[] key) throws IOException {
        final Index table = keeperOf(key);
        if (table == null) return null;
        return table.remove(key);
    }
View Full Code Here

        return table.remove(key);
    }
   
    public Row.Entry removeOne() throws IOException {
        final Iterator<Index> i = tables.values().iterator();
        Index table, maxtable = null;
        int maxcount = -1;
        while (i.hasNext()) {
            table = i.next();
            if (table.size() > maxcount) {
                maxtable = table;
                maxcount = table.size();
            }
        }
        if (maxtable == null) {
            return null;
        }
View Full Code Here

        return maxtable.removeOne();
    }
   
    public List<Row.Entry> top(int count) throws IOException {
        final Iterator<Index> i = tables.values().iterator();
        Index table, maxtable = null;
        int maxcount = -1;
        while (i.hasNext()) {
            table = i.next();
            if (table.size() > maxcount) {
                maxtable = table;
                maxcount = table.size();
            }
        }
        if (maxtable == null) {
            return null;
        }
View Full Code Here

TOP

Related Classes of net.yacy.kelondro.index.Index

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.