Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
Abstraction of HandleMap and HandleSet
Michael Peter Christen168773777191
diff --git a/htroot/CrawlProfileEditor_p.java b/htroot/CrawlProfileEditor_p.javaindex b7966790b..1e6e8caf8 100644--- a/htroot/CrawlProfileEditor_p.java+++ b/htroot/CrawlProfileEditor_p.java@@ -32,7 +32,7 @@ import java.util.TreeMap;import java.util.regex.Pattern;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.crawler.CrawlProfile;@@ -99,7 +99,7 @@ public class CrawlProfileEditor_p {// delete all entries from the crawl queue that are deleted heresb.crawler.removeActive(handle.getBytes());sb.crawlQueues.noticeURL.removeByProfileHandle(handle, 10000);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}if (post.containsKey("delete")) {diff --git a/htroot/Crawler_p.java b/htroot/Crawler_p.javaindex 1b29d3cd3..58d8d4b4c 100644--- a/htroot/Crawler_p.java+++ b/htroot/Crawler_p.java@@ -42,11 +42,11 @@ import java.util.regex.PatternSyntaxException;import net.yacy.cora.document.MultiProtocolURI;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Document;import net.yacy.document.parser.html.ContentScraper;import net.yacy.document.parser.html.TransformerWriter;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;import net.yacy.peers.NewsPool;@@ -127,7 +127,7 @@ public class Crawler_p {// delete all entries from the crawl queue that are deleted heresb.crawler.removeActive(handle.getBytes());sb.crawlQueues.noticeURL.removeByProfileHandle(handle, 10000);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}diff --git a/htroot/IndexControlRWIs_p.java b/htroot/IndexControlRWIs_p.javaindex 458bfdb00..d2c560438 100644--- a/htroot/IndexControlRWIs_p.java+++ b/htroot/IndexControlRWIs_p.java@@ -40,6 +40,8 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.lod.JenaTripleStore;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;@@ -47,8 +49,7 @@ import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;@@ -116,7 +117,7 @@ public class IndexControlRWIs_p {// read values from checkboxesfinal String[] urls = post.getAll("urlhx.*");HandleSet urlb =- new HandleSet(+ new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength,URIMetadataRow.rowdef.objectOrder,urls.length);@@ -124,7 +125,7 @@ public class IndexControlRWIs_p {for ( final String s : urls ) {try {urlb.put(s.getBytes());- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}}@@ -203,14 +204,14 @@ public class IndexControlRWIs_p {index = segment.termIndex().get(keyhash, null);final Iterator<WordReference> en = index.entries();urlb =- new HandleSet(+ new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength,URIMetadataRow.rowdef.objectOrder,index.size());while ( en.hasNext() ) {try {urlb.put(en.next().urlhash());- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}}@@ -246,14 +247,14 @@ public class IndexControlRWIs_p {}}final HandleSet urlHashes =- new HandleSet(+ new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength,URIMetadataRow.rowdef.objectOrder,0);for ( final byte[] b : urlb ) {try {urlHashes.put(b);- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}}@@ -311,7 +312,7 @@ public class IndexControlRWIs_p {final TreeMap<byte[], URIMetadata> knownURLs =new TreeMap<byte[], URIMetadata>(Base64Order.enhancedCoder);final HandleSet unknownURLEntries =- new HandleSet(+ new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength,WordReferenceRow.urlEntryRow.objectOrder,index.size());@@ -323,7 +324,7 @@ public class IndexControlRWIs_p {if (lurl == null) {try {unknownURLEntries.put(iEntry.urlhash());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}urlIter.remove();@@ -340,7 +341,7 @@ public class IndexControlRWIs_p {Word.commonHashLength);try {icc.add(index);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}@@ -396,7 +397,7 @@ public class IndexControlRWIs_p {if ( post.containsKey("blacklist") ) {final String blacklist = post.get("blacklist", "");final HandleSet urlHashes =- new HandleSet(+ new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength,URIMetadataRow.rowdef.objectOrder,urlb.size());@@ -411,7 +412,7 @@ public class IndexControlRWIs_p {for ( final byte[] b : urlb ) {try {urlHashes.put(b);- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}final URIMetadata e = segment.urlMetadata().load(b);@@ -446,7 +447,7 @@ public class IndexControlRWIs_p {for ( final byte[] b : urlb ) {try {urlHashes.put(b);- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}final URIMetadata e = segment.urlMetadata().load(b);diff --git a/htroot/Load_RSS_p.java b/htroot/Load_RSS_p.javaindex 4f2a6b58a..227fe3332 100644--- a/htroot/Load_RSS_p.java+++ b/htroot/Load_RSS_p.java@@ -35,11 +35,11 @@ import net.yacy.cora.document.RSSReader;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Parser.Failure;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.blob.Tables.Row;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.repository.Blacklist.BlacklistType;import net.yacy.search.Switchboard;@@ -93,7 +93,7 @@ public class Load_RSS_p {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}@@ -108,7 +108,7 @@ public class Load_RSS_p {sb.tables.insert("rss", pk, rssRow);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -139,7 +139,7 @@ public class Load_RSS_p {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}@@ -153,7 +153,7 @@ public class Load_RSS_p {} catch (final IOException e) {Log.logException(e);continue;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);continue;}@@ -230,7 +230,7 @@ public class Load_RSS_p {prop.put("shownewfeeds", newc > 0 ? 1 : 0);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}diff --git a/htroot/Table_API_p.java b/htroot/Table_API_p.javaindex 0e291f300..34cf8b4c1 100644--- a/htroot/Table_API_p.java+++ b/htroot/Table_API_p.java@@ -31,8 +31,8 @@ import java.util.regex.Pattern;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import net.yacy.search.SwitchboardConstants;@@ -95,7 +95,7 @@ public class Table_API_p {}} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}}@@ -115,7 +115,7 @@ public class Table_API_p {}} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}}@@ -144,7 +144,7 @@ public class Table_API_p {}} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}}diff --git a/htroot/Table_YMark_p.java b/htroot/Table_YMark_p.javaindex b5e99dedc..6ae16a9d9 100644--- a/htroot/Table_YMark_p.java+++ b/htroot/Table_YMark_p.java@@ -7,8 +7,8 @@ import java.util.regex.Pattern;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.data.ymark.YMarkEntry;@@ -150,7 +150,7 @@ public class Table_YMark_p {sb.tables.bookmarks.deleteBookmark(bmk_user, entry.getValue().substring(5).getBytes());} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -167,7 +167,7 @@ public class Table_YMark_p {sb.tables.bookmarks.addBookmark(bmk_user, bmk, false, false);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -193,7 +193,7 @@ public class Table_YMark_p {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}} else if (post.containsKey("addrow")) try {@@ -202,7 +202,7 @@ public class Table_YMark_p {setEdit(sb, prop, table, pk, columns);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);} else {prop.put("showtable", 1);@@ -282,7 +282,7 @@ public class Table_YMark_p {return prop;}- private static void setEdit(final Switchboard sb, final serverObjects prop, final String table, final String pk, final List<String> columns) throws IOException, RowSpaceExceededException {+ private static void setEdit(final Switchboard sb, final serverObjects prop, final String table, final String pk, final List<String> columns) throws IOException, SpaceExceededException {prop.put("showedit", 1);prop.put("showedit_table", table);prop.put("showedit_pk", pk);diff --git a/htroot/Tables_p.java b/htroot/Tables_p.javaindex 1f323ac7a..b57b2ed84 100644--- a/htroot/Tables_p.java+++ b/htroot/Tables_p.java@@ -27,8 +27,8 @@ import java.util.regex.Pattern;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -128,7 +128,7 @@ public class Tables_p {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}} else if (post.containsKey("addrow")) try {@@ -137,7 +137,7 @@ public class Tables_p {setEdit(sb, prop, table, pk, columns);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);} else {prop.put("showtable", 1);@@ -195,7 +195,7 @@ public class Tables_p {return prop;}- private static void setEdit(final Switchboard sb, final serverObjects prop, final String table, final String pk, final List<String> columns) throws IOException, RowSpaceExceededException {+ private static void setEdit(final Switchboard sb, final serverObjects prop, final String table, final String pk, final List<String> columns) throws IOException, SpaceExceededException {prop.put("showedit", 1);prop.put("showedit_table", table);prop.put("showedit_pk", pk);diff --git a/htroot/api/table_p.java b/htroot/api/table_p.javaindex c55b97934..d383b989e 100644--- a/htroot/api/table_p.java+++ b/htroot/api/table_p.java@@ -26,8 +26,8 @@ import java.util.regex.Pattern;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.server.serverObjects;@@ -112,7 +112,7 @@ public class table_p {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/htroot/api/timeline.java b/htroot/api/timeline.javaindex 2559e6019..d7c7388d7 100644--- a/htroot/api/timeline.java+++ b/htroot/api/timeline.java@@ -30,10 +30,10 @@ import java.util.Iterator;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.TermSearch;@@ -88,7 +88,7 @@ public final class timeline {TermSearch<WordReference> search = null;try {search = segment.termIndex().query(q, Word.words2hashesHandles(query[1]), null, Segment.wordReferenceFactory, maxdist);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}ReferenceContainer<WordReference> index = search.joined();diff --git a/htroot/api/ymarks/add_ymark.java b/htroot/api/ymarks/add_ymark.javaindex a83fc67c8..795423f56 100644--- a/htroot/api/ymarks/add_ymark.java+++ b/htroot/api/ymarks/add_ymark.java@@ -1,9 +1,9 @@import java.io.IOException;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Parser.Failure;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.data.UserDB;@@ -46,7 +46,7 @@ public class add_ymark {} catch (final Failure e) {// TODO Auto-generated catch blockLog.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// TODO Auto-generated catch blockLog.logException(e);}@@ -77,7 +77,7 @@ public class add_ymark {sb.tables.bookmarks.addBookmark(bmk_user, bmk, false, false);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {}prop.put("status", "1");} else {diff --git a/htroot/api/ymarks/delete_ymark.java b/htroot/api/ymarks/delete_ymark.javaindex 6dde75bac..01c364e8b 100644--- a/htroot/api/ymarks/delete_ymark.java+++ b/htroot/api/ymarks/delete_ymark.java@@ -1,7 +1,7 @@import java.io.IOException;import net.yacy.cora.protocol.RequestHeader;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.data.UserDB;@@ -40,7 +40,7 @@ public class delete_ymark {prop.put("result", "1");} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}} else {diff --git a/htroot/api/ymarks/get_treeview.java b/htroot/api/ymarks/get_treeview.javaindex 9295c9314..e01bc8d8c 100644--- a/htroot/api/ymarks/get_treeview.java+++ b/htroot/api/ymarks/get_treeview.java@@ -8,11 +8,11 @@ import java.util.TreeMap;import net.yacy.cora.date.ISO8601Formatter;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Document;import net.yacy.document.Parser.Failure;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;import de.anomic.data.UserDB;@@ -210,7 +210,7 @@ public class get_treeview {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}} else if (isAutoTagger || isMetadata || isURLdb || isCrawlStart) {diff --git a/htroot/api/ymarks/import_ymark.java b/htroot/api/ymarks/import_ymark.javaindex 119415a04..8fdeaad56 100644--- a/htroot/api/ymarks/import_ymark.java+++ b/htroot/api/ymarks/import_ymark.java@@ -11,11 +11,11 @@ import java.util.regex.Pattern;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Parser.Failure;import net.yacy.document.content.SurrogateReader;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.Switchboard;@@ -169,7 +169,7 @@ public class import_ymark {} catch (final IOException e) {// TODO Auto-generated catch blocke.printStackTrace();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// TODO Auto-generated catch blocke.printStackTrace();} catch (final Failure e) {@@ -206,7 +206,7 @@ public class import_ymark {} catch (final IOException e) {// TODO Auto-generated catch blocke.printStackTrace();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// TODO Auto-generated catch blocke.printStackTrace();}@@ -254,7 +254,7 @@ public class import_ymark {}} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);} catch (final InterruptedException e) {Log.logException(e);diff --git a/htroot/yacy/search.java b/htroot/yacy/search.javaindex e8d72632c..a53d5199d 100644--- a/htroot/yacy/search.java+++ b/htroot/yacy/search.java@@ -46,11 +46,12 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.sorting.ScoreMap;import net.yacy.cora.sorting.WeakPriorityBlockingQueue;+import net.yacy.cora.storage.HandleSet;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceFactory;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.order.Bitfield;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.util.ByteBuffer;@@ -202,7 +203,7 @@ public final class search {// prepare searchfinal HandleSet queryhashes = QueryParams.hashes2Set(query);- final HandleSet excludehashes = (exclude.isEmpty()) ? new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0) : QueryParams.hashes2Set(exclude);+ final HandleSet excludehashes = (exclude.isEmpty()) ? new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0) : QueryParams.hashes2Set(exclude);final long timestamp = System.currentTimeMillis();// prepare a search profile@@ -221,7 +222,7 @@ public final class search {theQuery = new QueryParams(null,abstractSet,- new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0),+ new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0),null,null,modifier,diff --git a/htroot/yacy/transferRWI.java b/htroot/yacy/transferRWI.javaindex a51c20b85..7915ea355 100644--- a/htroot/yacy/transferRWI.java+++ b/htroot/yacy/transferRWI.java@@ -34,10 +34,11 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.document.RSSMessage;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.storage.HandleSet;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.rwi.IndexCell;import net.yacy.kelondro.util.FileUtils;@@ -145,8 +146,8 @@ public final class transferRWI {String wordHash;byte[] urlHash;WordReferenceRow iEntry;- final HandleSet unknownURL = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);- final HandleSet knownURL = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ final HandleSet unknownURL = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ final HandleSet knownURL = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);final ArrayList<String> wordhashes = new ArrayList<String>();int received = 0;int blocked = 0;diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 12e11f4d7..10df99bae 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -51,6 +51,7 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.protocol.ResponseHeader;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;import net.yacy.document.Condenser;import net.yacy.document.Document;import net.yacy.document.LibraryProvider;@@ -59,7 +60,6 @@ import net.yacy.document.geolocation.GeoLocation;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Bitfield;import net.yacy.kelondro.util.Formatter;diff --git a/source/de/anomic/crawler/Balancer.java b/source/de/anomic/crawler/Balancer.javaindex 1a63afe03..209aadc12 100644--- a/source/de/anomic/crawler/Balancer.java+++ b/source/de/anomic/crawler/Balancer.java@@ -43,12 +43,13 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.protocol.Domains;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.index.BufferedObjectIndex;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.table.Table;@@ -88,7 +89,7 @@ public class Balancer {this.minimumGlobalDelta = minimumGlobalDelta;this.myAgentIDs = myAgentIDs;this.domStackInitSize = Integer.MAX_VALUE;- this.double_push_check = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ this.double_push_check = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);// create a stack for newly entered entriesif (!(cachePath.exists())) cachePath.mkdir(); // make the path@@ -96,10 +97,10 @@ public class Balancer {final File f = new File(this.cacheStacksPath, stackname + indexSuffix);try {this.urlFileIndex = new BufferedObjectIndex(new Table(f, Request.rowdef, EcoFSBufferSize, 0, useTailCache, exceed134217727, true), objectIndexBufferSize);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {this.urlFileIndex = new BufferedObjectIndex(new Table(f, Request.rowdef, 0, 0, false, exceed134217727, true), objectIndexBufferSize);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {Log.logException(e1);}}@@ -146,13 +147,13 @@ public class Balancer {return new Request(entry);}- public int removeAllByProfileHandle(final String profileHandle, final long timeout) throws IOException, RowSpaceExceededException {+ public int removeAllByProfileHandle(final String profileHandle, final long timeout) throws IOException, SpaceExceededException {// removes all entries with a specific profile hash.// this may last some time// returns number of deletions// first find a list of url hashes that shall be deleted- final HandleSet urlHashes = new HandleSet(this.urlFileIndex.row().primaryKeyLength, Base64Order.enhancedCoder, 100);+ final HandleSet urlHashes = new RowHandleSet(this.urlFileIndex.row().primaryKeyLength, Base64Order.enhancedCoder, 100);final long terminate = (timeout > 0) ? System.currentTimeMillis() + timeout : Long.MAX_VALUE;synchronized (this) {final Iterator<Row.Entry> i = this.urlFileIndex.rows();@@ -237,9 +238,9 @@ public class Balancer {* @param entry* @return null if this was successful or a String explaining what went wrong in case of an error* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public String push(final Request entry) throws IOException, RowSpaceExceededException {+ public String push(final Request entry) throws IOException, SpaceExceededException {assert entry != null;final byte[] hash = entry.url().hash();synchronized (this) {@@ -328,13 +329,13 @@ public class Balancer {return cel;}- private void pushHashToDomainStacks(String host, final byte[] urlhash) throws RowSpaceExceededException {+ private void pushHashToDomainStacks(String host, final byte[] urlhash) throws SpaceExceededException {// extend domain stackif (host == null) host = Domains.LOCALHOST;HandleSet domainList = this.domainStacks.get(host);if (domainList == null) {// create new list- domainList = new HandleSet(12, Base64Order.enhancedCoder, 1);+ domainList = new RowHandleSet(12, Base64Order.enhancedCoder, 1);domainList.put(urlhash);this.domainStacks.put(host, domainList);} else {@@ -365,7 +366,7 @@ public class Balancer {* @param profile* @return a url in a CrawlEntry object* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/public Request pop(final boolean delay, final CrawlSwitchboard cs, final RobotsTxt robots) throws IOException {// returns a crawl entry from the stack and ensures minimum delta times@@ -495,7 +496,7 @@ public class Balancer {}try {entry.getValue().put(n); // put entry back, we are checking only- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {e.printStackTrace();}}@@ -546,7 +547,7 @@ public class Balancer {host = request.url().getHost();try {pushHashToDomainStacks(host, handle);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {break;}count++;diff --git a/source/de/anomic/crawler/Cache.java b/source/de/anomic/crawler/Cache.javaindex 7ec9f8902..6eaf80d0b 100644--- a/source/de/anomic/crawler/Cache.java+++ b/source/de/anomic/crawler/Cache.java@@ -43,13 +43,14 @@ import java.util.concurrent.BlockingQueue;import net.yacy.cora.document.ASCII;import net.yacy.cora.protocol.ResponseHeader;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.ArrayStack;import net.yacy.kelondro.blob.Compressor;import net.yacy.kelondro.blob.MapHeap;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;@@ -106,12 +107,12 @@ public final class Cache {Thread.currentThread().setName("Cache startupCleanup");// enumerate the responseHeaderDB and find out all entries that are not inside the fileDBunbufferedBlockingQueue<byte[]> q = responseHeaderDB.keyQueue(1000);- final HandleSet delkeys = new HandleSet(Word.commonHashLength, Base64Order.enhancedCoder, 1);+ final HandleSet delkeys = new RowHandleSet(Word.commonHashLength, Base64Order.enhancedCoder, 1);Log.logInfo("Cache", "started cleanup thread to remove unused cache metadata");try {byte[] k;while (((k = q.take()) != MapHeap.POISON_QUEUE_ENTRY)) {- if (!fileDB.containsKey(k)) try { delkeys.put(k); } catch (RowSpaceExceededException e) { break; }+ if (!fileDB.containsKey(k)) try { delkeys.put(k); } catch (SpaceExceededException e) { break; }}} catch (InterruptedException e) {} finally {@@ -128,7 +129,7 @@ public final class Cache {Log.logInfo("Cache", "running check to remove unused file cache data");delkeys.clear();for (byte[] k: fileDB) {- if (!responseHeaderDB.containsKey(k)) try { delkeys.put(k); } catch (RowSpaceExceededException e) { break; }+ if (!responseHeaderDB.containsKey(k)) try { delkeys.put(k); } catch (SpaceExceededException e) { break; }}Log.logInfo("Cache", "cleanup thread collected " + delkeys.size() + " unused cache entries; now deleting them from the file...");for (byte[] k: delkeys) {@@ -260,7 +261,7 @@ public final class Cache {hdb = responseHeaderDB.get(hash);} catch (IOException e) {return null;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {return null;}if (hdb == null) return null;@@ -288,7 +289,7 @@ public final class Cache {} catch (final IOException e) {Log.logException(e);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return null;} catch (final OutOfMemoryError e) {diff --git a/source/de/anomic/crawler/CrawlSwitchboard.java b/source/de/anomic/crawler/CrawlSwitchboard.javaindex f8ccce633..8baf608f7 100644--- a/source/de/anomic/crawler/CrawlSwitchboard.java+++ b/source/de/anomic/crawler/CrawlSwitchboard.java@@ -35,9 +35,9 @@ import java.util.TreeMap;import net.yacy.cora.document.UTF8;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -102,7 +102,7 @@ public final class CrawlSwitchboardp = new CrawlProfile(this.profilesActiveCrawls.get(handle));} catch ( final IOException e ) {p = null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {p = null;}if ( p == null ) {@@ -149,7 +149,7 @@ public final class CrawlSwitchboardLog.logInfo("CrawlProfiles", "loaded Profile " + p.handle() + ": " + p.name());} catch ( final IOException e ) {continue;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {continue;}}@@ -179,7 +179,7 @@ public final class CrawlSwitchboardm = this.profilesActiveCrawls.get(profileKey);} catch ( final IOException e ) {m = null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {m = null;}if ( m == null ) {@@ -199,7 +199,7 @@ public final class CrawlSwitchboardm = this.profilesPassiveCrawls.get(profileKey);} catch ( final IOException e ) {m = null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {m = null;}if ( m == null ) {@@ -518,7 +518,7 @@ public final class CrawlSwitchboardentry = new CrawlProfile(this.profilesActiveCrawls.get(handle));} catch ( final IOException e ) {continue;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {continue;}if ( !((entry.name().equals(CRAWL_PROFILE_PROXY))diff --git a/source/de/anomic/crawler/NoticedURL.java b/source/de/anomic/crawler/NoticedURL.javaindex 2ba7ee9ff..fc993e009 100644--- a/source/de/anomic/crawler/NoticedURL.java+++ b/source/de/anomic/crawler/NoticedURL.java@@ -35,8 +35,9 @@ import java.util.List;import java.util.Map;import java.util.Set;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import de.anomic.crawler.retrieval.Request;@@ -206,7 +207,7 @@ public class NoticedURL {*/public boolean removeByURLHash(final byte[] urlhashBytes) {try {- final HandleSet urlHashes = new HandleSet(12, Base64Order.enhancedCoder, 1);+ final HandleSet urlHashes = new RowHandleSet(12, Base64Order.enhancedCoder, 1);urlHashes.put(urlhashBytes);boolean ret = false;try {ret |= this.noloadStack.remove(urlHashes) > 0;} catch (final IOException e) {}@@ -214,13 +215,13 @@ public class NoticedURL {try {ret |= this.limitStack.remove(urlHashes) > 0;} catch (final IOException e) {}try {ret |= this.remoteStack.remove(urlHashes) > 0;} catch (final IOException e) {}return ret;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return false;}}- public int removeByProfileHandle(final String handle, final long timeout) throws RowSpaceExceededException {+ public int removeByProfileHandle(final String handle, final long timeout) throws SpaceExceededException {int removed = 0;try {removed += this.noloadStack.removeAllByProfileHandle(handle, timeout);} catch (final IOException e) {}try {removed += this.coreStack.removeAllByProfileHandle(handle, timeout);} catch (final IOException e) {}diff --git a/source/de/anomic/crawler/RSSLoader.java b/source/de/anomic/crawler/RSSLoader.javaindex fa1ff7e1a..5e2f7cc81 100644--- a/source/de/anomic/crawler/RSSLoader.java+++ b/source/de/anomic/crawler/RSSLoader.java@@ -35,10 +35,10 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.services.federated.yacy.CacheStrategy;import net.yacy.cora.storage.ARC;import net.yacy.cora.storage.ComparableARC;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Parser.Failure;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.repository.Blacklist.BlacklistType;@@ -120,7 +120,7 @@ public class RSSLoader extends Thread {sb.tables.update("rss", url.hash(), rssRow);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/de/anomic/crawler/RobotsTxt.java b/source/de/anomic/crawler/RobotsTxt.javaindex b20c6bb39..8ec118fc1 100644--- a/source/de/anomic/crawler/RobotsTxt.java+++ b/source/de/anomic/crawler/RobotsTxt.java@@ -42,8 +42,8 @@ import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.protocol.ResponseHeader;import net.yacy.cora.protocol.http.HTTPClient;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.BEncodedHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.io.ByteCount;import org.apache.log4j.Logger;@@ -104,7 +104,7 @@ public class RobotsTxt {final BEncodedHeap robotsTable = this.tables.getHeap(WorkTables.TABLE_ROBOTS_NAME);try {record = robotsTable.get(robotsTable.encodedKey(urlHostPort));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {log.warn("memory exhausted", e);record = null;}@@ -132,7 +132,7 @@ public class RobotsTxt {// to complete a downloadtry {record = robotsTable.get(robotsTable.encodedKey(urlHostPort));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {log.warn("memory exhausted", e);record = null;}diff --git a/source/de/anomic/crawler/ZURL.java b/source/de/anomic/crawler/ZURL.javaindex 3a3d2f9a3..4ac0ba428 100644--- a/source/de/anomic/crawler/ZURL.java+++ b/source/de/anomic/crawler/ZURL.java@@ -39,12 +39,12 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.services.federated.solr.ShardSolrConnector;import net.yacy.cora.services.federated.solr.SolrConnector;import net.yacy.cora.services.federated.solr.SolrDoc;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.table.SplitTable;@@ -112,10 +112,10 @@ public class ZURL implements Iterable<ZURL.Entry> {}try {this.urlIndex = new Table(f, rowdef, EcoFSBufferSize, 0, useTailCache, exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {this.urlIndex = new Table(f, rowdef, 0, 0, false, exceed134217727, true);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {Log.logException(e1);}}diff --git a/source/de/anomic/data/BlogBoard.java b/source/de/anomic/data/BlogBoard.javaindex 482c9babb..3743b0c07 100644--- a/source/de/anomic/data/BlogBoard.java+++ b/source/de/anomic/data/BlogBoard.java@@ -50,8 +50,8 @@ import javax.xml.parsers.ParserConfigurationException;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.Domains;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -131,7 +131,7 @@ public class BlogBoard {ret = page.key;} catch (IOException ex) {Log.logException(ex);- } catch (RowSpaceExceededException ex) {+ } catch (SpaceExceededException ex) {Log.logException(ex);}return ret;@@ -149,7 +149,7 @@ public class BlogBoard {} catch (final IOException e) {Log.logException(e);record = null;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);record = null;}diff --git a/source/de/anomic/data/BlogBoardComments.java b/source/de/anomic/data/BlogBoardComments.javaindex b26efac81..66e3007f5 100644--- a/source/de/anomic/data/BlogBoardComments.java+++ b/source/de/anomic/data/BlogBoardComments.java@@ -47,8 +47,8 @@ import javax.xml.parsers.ParserConfigurationException;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.Domains;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -138,7 +138,7 @@ public class BlogBoardComments {} catch (final IOException e) {Log.logException(e);record = null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);record = null;}diff --git a/source/de/anomic/data/BookmarkDate.java b/source/de/anomic/data/BookmarkDate.javaindex 689873e0b..23095b5c2 100644--- a/source/de/anomic/data/BookmarkDate.java+++ b/source/de/anomic/data/BookmarkDate.java@@ -40,8 +40,8 @@ import java.util.Map;import de.anomic.data.BookmarksDB.Bookmark;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;@@ -64,7 +64,7 @@ public class BookmarkDate {map = datesTable.get(UTF8.getBytes(date));} catch (final IOException e) {map = null;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {map = null;}if (map == null) {diff --git a/source/de/anomic/data/BookmarksDB.java b/source/de/anomic/data/BookmarksDB.javaindex e07d184c2..8b5dd9ce8 100644--- a/source/de/anomic/data/BookmarksDB.java+++ b/source/de/anomic/data/BookmarksDB.java@@ -38,9 +38,9 @@ import java.util.concurrent.ConcurrentHashMap;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;@@ -164,7 +164,7 @@ public class BookmarksDB {} catch (final IOException e) {Log.logException(e);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return null;}diff --git a/source/de/anomic/data/MessageBoard.java b/source/de/anomic/data/MessageBoard.javaindex 8f20fce50..a15612770 100644--- a/source/de/anomic/data/MessageBoard.java+++ b/source/de/anomic/data/MessageBoard.java@@ -33,8 +33,8 @@ import java.util.Map;import java.util.TimeZone;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -199,7 +199,7 @@ public class MessageBoard {} catch (final IOException e) {Log.logException(e);return null;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);return null;}diff --git a/source/de/anomic/data/UserDB.java b/source/de/anomic/data/UserDB.javaindex b37cf697a..87b0d3466 100644--- a/source/de/anomic/data/UserDB.java+++ b/source/de/anomic/data/UserDB.java@@ -39,8 +39,8 @@ import java.util.Random;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.protocol.RequestHeader;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;@@ -103,7 +103,7 @@ public final class UserDB {record = userTable.get(UTF8.getBytes(userName));} catch (final IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}@@ -537,7 +537,7 @@ public final class UserDB {return this.mem;}- public void setProperty(final String propName, final String newValue) throws IOException, RowSpaceExceededException {+ public void setProperty(final String propName, final String newValue) throws IOException, SpaceExceededException {this.mem.put(propName, newValue);UserDB.this.userTable.insert(UTF8.getBytes(getUserName()), this.mem);}diff --git a/source/de/anomic/data/WorkTables.java b/source/de/anomic/data/WorkTables.javaindex 4f65d0d1e..167399efa 100644--- a/source/de/anomic/data/WorkTables.java+++ b/source/de/anomic/data/WorkTables.java@@ -9,7 +9,7 @@// $LastChangedBy$//// LICENSE-//+//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or@@ -39,11 +39,11 @@ import java.util.TreeMap;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.http.HTTPClient;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.WordReference;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.rwi.IndexCell;@@ -52,12 +52,12 @@ import de.anomic.data.ymark.YMarkTables;import de.anomic.server.serverObjects;public class WorkTables extends Tables {-+public final static String TABLE_API_NAME = "api";public final static String TABLE_API_TYPE_STEERING = "steering";public final static String TABLE_API_TYPE_CONFIGURATION = "configuration";public final static String TABLE_API_TYPE_CRAWLER = "crawler";-+public final static String TABLE_API_COL_TYPE = "type";public final static String TABLE_API_COL_COMMENT = "comment";public final static String TABLE_API_COL_DATE_RECORDING = "date_recording"; // if not present default to old date field@@ -71,7 +71,7 @@ public class WorkTables extends Tables {public final static String TABLE_API_COL_APICALL_SCHEDULE_UNIT= "apicall_schedule_unit"; // may be 'minutes', 'hours', 'days'public final static String TABLE_ROBOTS_NAME = "robots";-+public final static String TABLE_ACTIVECRAWLS_NAME = "crawljobsActive";public final static String TABLE_PASSIVECRAWLS_NAME = "crawljobsPassive";@@ -80,14 +80,14 @@ public class WorkTables extends Tables {public final static String TABLE_SEARCH_FAILURE_COL_DATE = "date";public final static String TABLE_SEARCH_FAILURE_COL_WORDS = "words";public final static String TABLE_SEARCH_FAILURE_COL_COMMENT = "comment";-+public YMarkTables bookmarks;-+public WorkTables(final File workPath) {super(workPath, 12);this.bookmarks = new YMarkTables(this);}-+/*** recording of a api call. stores the call parameters into the API database table* @param post the post arguments of the api call@@ -100,7 +100,7 @@ public class WorkTables extends Tables {// remove the apicall attributes from the post objectString pks = post.remove(TABLE_API_COL_APICALL_PK);byte[] pk = pks == null ? null : UTF8.getBytes(pks);-+// generate the apicall url - without the apicall attributesfinal String apiurl = /*"http://localhost:" + getConfig("port", "8090") +*/ "/" + servletName + "?" + post.toString();@@ -110,10 +110,10 @@ public class WorkTables extends Tables {row = (pk == null) ? null : super.select(TABLE_API_NAME, pk);} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}-+// insert or update entrytry {if (row == null) {@@ -125,8 +125,8 @@ public class WorkTables extends Tables {data.put(TABLE_API_COL_DATE_RECORDING, date);data.put(TABLE_API_COL_DATE_LAST_EXEC, date);data.put(TABLE_API_COL_URL, UTF8.getBytes(apiurl));-- // insert APICALL attributes++ // insert APICALL attributesdata.put(TABLE_API_COL_APICALL_COUNT, "1");pk = super.insert(TABLE_API_NAME, data);} else {@@ -136,21 +136,21 @@ public class WorkTables extends Tables {row.put(TABLE_API_COL_DATE_LAST_EXEC, UTF8.getBytes(GenericFormatter.SHORT_MILSEC_FORMATTER.format()));if (!row.containsKey(TABLE_API_COL_DATE_RECORDING)) row.put(TABLE_API_COL_DATE_RECORDING, row.get(TABLE_API_COL_DATE));row.remove(TABLE_API_COL_DATE);-- // insert APICALL attributes++ // insert APICALL attributesrow.put(TABLE_API_COL_APICALL_COUNT, row.get(TABLE_API_COL_APICALL_COUNT, 1) + 1);super.update(TABLE_API_NAME, row);assert pk != null;}} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}Log.logInfo("APICALL", apiurl);return pk;}-+/*** store a API call and set attributes to schedule a re-call of that API call according to a given frequence* This is the same as the previous method but it also computes a re-call time and stores that additionally@@ -172,7 +172,7 @@ public class WorkTables extends Tables {} else {if (unit.equals("minutes") && time < 10) time = 10;}-+// generate the apicall url - without the apicall attributesfinal String apiurl = /*"http://localhost:" + getConfig("port", "8090") +*/ "/" + servletName + "?" + post.toString();byte[] pk = null;@@ -186,8 +186,8 @@ public class WorkTables extends Tables {data.put(TABLE_API_COL_DATE_RECORDING, date);data.put(TABLE_API_COL_DATE_LAST_EXEC, date);data.put(TABLE_API_COL_URL, UTF8.getBytes(apiurl));-- // insert APICALL attributes++ // insert APICALL attributesdata.put(TABLE_API_COL_APICALL_COUNT, UTF8.getBytes("1"));data.put(TABLE_API_COL_APICALL_SCHEDULE_TIME, UTF8.getBytes(Integer.toString(time)));data.put(TABLE_API_COL_APICALL_SCHEDULE_UNIT, UTF8.getBytes(unit));@@ -195,13 +195,13 @@ public class WorkTables extends Tables {pk = super.insert(TABLE_API_NAME, data);} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}Log.logInfo("APICALL", apiurl);return pk;}-+/*** execute an API call using a api table row which contains all essentials* to access the server also the host, port and the authentication realm must be given@@ -225,7 +225,7 @@ public class WorkTables extends Tables {row = select(WorkTables.TABLE_API_NAME, UTF8.getBytes(pk));} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}if (row == null) continue;@@ -242,7 +242,7 @@ public class WorkTables extends Tables {}return l;}-+public static int execAPICall(String host, int port, String realm, String path, byte[] pk) {// now call the api URLs and store the result statusfinal HTTPClient client = new HTTPClient();@@ -258,7 +258,7 @@ public class WorkTables extends Tables {return -1;}}-+/*** simplified call to execute a single entry in the api database table* @param pk the primary key of the entry@@ -297,14 +297,14 @@ public class WorkTables extends Tables {d -= d % 60000; // remove secondsrow.put(WorkTables.TABLE_API_COL_DATE_NEXT_EXEC, new Date(d));}-+public void failURLsRegisterMissingWord(IndexCell<WordReference> indexCell, final DigestURI url, HandleSet queryHashes, final String reason) {// remove words from indexfor (final byte[] word: queryHashes) {indexCell.removeDelayed(word, url.hash());}-+// insert information about changed url into databasetry {// create and insert new entry@@ -319,7 +319,7 @@ public class WorkTables extends Tables {Log.logException(e);}}-+public boolean failURLsContains(byte[] urlhash) {try {return super.has(TABLE_SEARCH_FAILURE_NAME, urlhash);@@ -328,7 +328,7 @@ public class WorkTables extends Tables {return false;}}-+/*** cleanup cached failed searchs older then timeout*/@@ -351,7 +351,7 @@ public class WorkTables extends Tables {}}}-+public static Map<byte[], String> commentCache(Switchboard sb) {Map<byte[], String> comments = new TreeMap<byte[], String>(Base64Order.enhancedCoder);Iterator<Tables.Row> i;diff --git a/source/de/anomic/data/wiki/WikiBoard.java b/source/de/anomic/data/wiki/WikiBoard.javaindex 9074a2b00..f7f7fdcdd 100644--- a/source/de/anomic/data/wiki/WikiBoard.java+++ b/source/de/anomic/data/wiki/WikiBoard.java@@ -38,8 +38,8 @@ import java.util.TimeZone;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.Domains;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapHeap;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -407,7 +407,7 @@ public class WikiBoard {ret = (record == null) ? newEntry(copyOfKey, ANONYMOUS, Domains.LOCALHOST, "New Page", UTF8.getBytes("")) : new Entry(copyOfKey, record);} catch (final IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}return ret;diff --git a/source/de/anomic/data/ymark/YMarkAutoTagger.java b/source/de/anomic/data/ymark/YMarkAutoTagger.javaindex 071f3e17e..bd9070561 100644--- a/source/de/anomic/data/ymark/YMarkAutoTagger.java+++ b/source/de/anomic/data/ymark/YMarkAutoTagger.java@@ -11,6 +11,7 @@ import java.util.TreeSet;import java.util.concurrent.ArrayBlockingQueue;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.document.Document;import net.yacy.document.LibraryProvider;@@ -19,7 +20,6 @@ import net.yacy.document.SentenceReader;import net.yacy.document.WordTokenizer;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.repository.LoaderDispatcher;import de.anomic.crawler.retrieval.Response;@@ -266,7 +266,7 @@ public class YMarkAutoTagger implements Runnable, Thread.UncaughtExceptionHandleLog.logException(e);} catch (final IOException e) {Log.logWarning(YMarkTables.BOOKMARKS_LOG.toString(), "autoTagger - IOException for URL: "+url);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);} finally {}diff --git a/source/de/anomic/data/ymark/YMarkTables.java b/source/de/anomic/data/ymark/YMarkTables.javaindex 7f1236ee4..da5470967 100644--- a/source/de/anomic/data/ymark/YMarkTables.java+++ b/source/de/anomic/data/ymark/YMarkTables.java@@ -38,12 +38,12 @@ import java.util.TreeSet;import java.util.regex.Pattern;import net.yacy.cora.document.ASCII;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Document;import net.yacy.document.Parser.Failure;import net.yacy.kelondro.blob.Tables;import net.yacy.kelondro.blob.Tables.Row;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.repository.LoaderDispatcher;import de.anomic.data.WorkTables;@@ -104,7 +104,7 @@ public class YMarkTables {this.worktables = (WorkTables)wt;}- public void deleteBookmark(final String bmk_user, final byte[] urlHash) throws IOException, RowSpaceExceededException {+ public void deleteBookmark(final String bmk_user, final byte[] urlHash) throws IOException, SpaceExceededException {final String bmk_table = TABLES.BOOKMARKS.tablename(bmk_user);Tables.Row bmk_row = null;bmk_row = this.worktables.select(bmk_table, urlHash);@@ -113,7 +113,7 @@ public class YMarkTables {}}- public void deleteBookmark(final String bmk_user, final String url) throws IOException, RowSpaceExceededException {+ public void deleteBookmark(final String bmk_user, final String url) throws IOException, SpaceExceededException {this.deleteBookmark(bmk_user, YMarkUtil.getBookmarkId(url));}@@ -228,7 +228,7 @@ public class YMarkTables {return sortList;}- public void addTags(final String bmk_user, final String url, final String tagString, final boolean merge) throws IOException, RowSpaceExceededException {+ public void addTags(final String bmk_user, final String url, final String tagString, final boolean merge) throws IOException, SpaceExceededException {if(!tagString.isEmpty()) {// do not set defaults as we only want to update tagsfinal YMarkEntry bmk = new YMarkEntry(false);@@ -257,7 +257,7 @@ public class YMarkTables {}}- public void addFolder(final String bmk_user, final String url, final String folder) throws IOException, RowSpaceExceededException {+ public void addFolder(final String bmk_user, final String url, final String folder) throws IOException, SpaceExceededException {if(!folder.isEmpty()) {// do not set defaults as we only want to add a folderfinal YMarkEntry bmk = new YMarkEntry(false);@@ -267,7 +267,7 @@ public class YMarkTables {}}- public void visited(final String bmk_user, final String url) throws IOException, RowSpaceExceededException {+ public void visited(final String bmk_user, final String url) throws IOException, SpaceExceededException {// do not set defaultsfinal YMarkEntry bmk = new YMarkEntry(false);bmk.put(YMarkEntry.BOOKMARK.URL.key(), url);@@ -275,11 +275,11 @@ public class YMarkTables {addBookmark(bmk_user, bmk, true, true);}- public void createBookmark(final LoaderDispatcher loader, final String url, final String bmk_user, final boolean autotag, final String tagsString, final String foldersString) throws IOException, Failure, RowSpaceExceededException {+ public void createBookmark(final LoaderDispatcher loader, final String url, final String bmk_user, final boolean autotag, final String tagsString, final String foldersString) throws IOException, Failure, SpaceExceededException {createBookmark(loader, new DigestURI(url), bmk_user, autotag, tagsString, foldersString);}- public void createBookmark(final LoaderDispatcher loader, final DigestURI url, final String bmk_user, final boolean autotag, final String tagsString, final String foldersString) throws IOException, Failure, RowSpaceExceededException {+ public void createBookmark(final LoaderDispatcher loader, final DigestURI url, final String bmk_user, final boolean autotag, final String tagsString, final String foldersString) throws IOException, Failure, SpaceExceededException {final YMarkEntry bmk_entry = new YMarkEntry(false);final YMarkMetadata meta = new YMarkMetadata(url);@@ -319,7 +319,7 @@ public class YMarkTables {}}- public void addBookmark(final String bmk_user, final YMarkEntry bmk, final boolean mergeTags, final boolean mergeFolders) throws IOException, RowSpaceExceededException {+ public void addBookmark(final String bmk_user, final YMarkEntry bmk, final boolean mergeTags, final boolean mergeFolders) throws IOException, SpaceExceededException {final String bmk_table = TABLES.BOOKMARKS.tablename(bmk_user);final String date = String.valueOf(System.currentTimeMillis());final byte[] urlHash = YMarkUtil.getBookmarkId(bmk.get(YMarkEntry.BOOKMARK.URL.key()));diff --git a/source/net/yacy/cora/storage/HandleMap.java b/source/net/yacy/cora/storage/HandleMap.javanew file mode 100644index 000000000..2a968a8b7--- /dev/null+++ b/source/net/yacy/cora/storage/HandleMap.java@@ -0,0 +1,90 @@+/**+ * HandleMap+ * Copyright 2009 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+ * First published 26.07.2012 on http://yacy.net+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */++package net.yacy.cora.storage;++import java.io.File;+import java.io.IOException;+import java.util.ArrayList;+import java.util.Map;++import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;++public interface HandleMap extends Iterable<Map.Entry<byte[], Long>> {++ public long mem();++ public void trim();++ /**+ * write a dump of the index to a file. All entries are written in order+ * which makes it possible to read them again in a fast way+ * @param file+ * @return the number of written entries+ * @throws IOException+ */+ public int dump(final File file) throws IOException;++ public void clear();++ public byte[] smallestKey();++ public byte[] largestKey();++ public boolean has(final byte[] key);++ public long get(final byte[] key);++ /**+ * Adds the key-value pair to the index.+ * @param key the index key+ * @param l the value+ * @return the previous entry of the index+ * @throws IOException+ * @throws SpaceExceededException+ */+ public long put(final byte[] key, final long l) throws SpaceExceededException;++ public void putUnique(final byte[] key, final long l) throws SpaceExceededException;++ public long add(final byte[] key, final long a) throws SpaceExceededException;++ public long inc(final byte[] key) throws SpaceExceededException;++ public long dec(final byte[] key) throws SpaceExceededException;++ public ArrayList<long[]> removeDoubles() throws SpaceExceededException;++ public ArrayList<byte[]> top(final int count);++ public long remove(final byte[] key);++ public long removeone();++ public int size();++ public boolean isEmpty();++ public CloneableIterator<byte[]> keys(final boolean up, final byte[] firstKey);++ public void close();++}diff --git a/source/net/yacy/cora/storage/HandleSet.java b/source/net/yacy/cora/storage/HandleSet.javanew file mode 100644index 000000000..40a9a311b--- /dev/null+++ b/source/net/yacy/cora/storage/HandleSet.java@@ -0,0 +1,98 @@+/**+ * HandleSet+ * Copyright 2012 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+ * First published 26.07.2012 on http://yacy.net+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */++package net.yacy.cora.storage;++import java.io.File;+import java.io.IOException;+import java.io.Serializable;+import java.util.Iterator;++import net.yacy.cora.order.ByteOrder;+import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;++public interface HandleSet extends Iterable<byte[]>, Cloneable, Serializable {++ public HandleSet clone();++ public byte[] export();+++ /**+ * write a dump of the set to a file. All entries are written in order+ * which makes it possible to read them again in a fast way+ * @param file+ * @return the number of written entries+ * @throws IOException+ */+ public int dump(final File file) throws IOException;++ public byte[] smallestKey();++ public byte[] largestKey();++ public ByteOrder comparator();++ public void clear();++ public boolean has(final byte[] key);++ public void putAll(final HandleSet aset) throws SpaceExceededException;++ /**+ * Adds the key to the set+ * @param key+ * @return true if this set did _not_ already contain the given key.+ * @throws IOException+ * @throws SpaceExceededException+ */+ public boolean put(final byte[] key) throws SpaceExceededException;++ public void putUnique(final byte[] key) throws SpaceExceededException;++ public boolean remove(final byte[] key);++ public byte[] removeOne();++ /**+ * get one entry; objects are taken from the end of the list+ * a getOne(0) would return the same object as removeOne() would remove+ * @param idx+ * @return entry from the end of the list+ */+ public byte[] getOne(int idx);++ public boolean isEmpty();++ public int size();++ public int keylen();++ public CloneableIterator<byte[]> keys(final boolean up, final byte[] firstKey);++ public void excludeDestructive(final HandleSet other);++ @Override+ public Iterator<byte[]> iterator();++ public void close();++}diff --git a/source/net/yacy/cora/util/SpaceExceededException.java b/source/net/yacy/cora/util/SpaceExceededException.javanew file mode 100644index 000000000..0d5874758--- /dev/null+++ b/source/net/yacy/cora/util/SpaceExceededException.java@@ -0,0 +1,66 @@+/**+ * SpaceExceededException+ * Copyright 2009 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany+ * First published 06.12.2009 on http://yacy.net+ *+ * This library is free software; you can redistribute it and/or+ * modify it under the terms of the GNU Lesser General Public+ * License as published by the Free Software Foundation; either+ * version 2.1 of the License, or (at your option) any later version.+ *+ * This library is distributed in the hope that it will be useful,+ * but WITHOUT ANY WARRANTY; without even the implied warranty of+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU+ * Lesser General Public License for more details.+ *+ * You should have received a copy of the GNU Lesser General Public License+ * along with this program in the file lgpl21.txt+ * If not, see <http://www.gnu.org/licenses/>.+ */++package net.yacy.cora.util;++import java.util.Date;++import net.yacy.kelondro.util.MemoryControl;++public class SpaceExceededException extends Exception {++ private static final long serialVersionUID = 9059516027929222151L;++ private final String forUsage;+ private final long neededRAM, availableRAM, time;++ public SpaceExceededException(final long neededRAM, final String forUsage) {+ super(Long.toString(neededRAM) + " bytes needed for " + forUsage + ": " + MemoryControl.available() + " free at " + (new Date()).toString());+ this.time = System.currentTimeMillis();+ this.availableRAM = MemoryControl.available();+ this.neededRAM = neededRAM;+ this.forUsage = forUsage;+ }++ public SpaceExceededException(final long neededRAM, final String forUsage, final Throwable t) {+ super(Long.toString(neededRAM) + " bytes needed for " + forUsage + ": " + MemoryControl.available() + " free at " + (new Date()).toString(), t);+ this.time = System.currentTimeMillis();+ this.availableRAM = MemoryControl.available();+ this.neededRAM = neededRAM;+ this.forUsage = forUsage;+ }++ public String getUsage() {+ return this.forUsage;+ }++ public long getNeededRAM() {+ return this.neededRAM;+ }++ public long getAvailableRAM() {+ return this.availableRAM;+ }++ public long getTime() {+ return this.time;+ }++}diff --git a/source/net/yacy/dbtest.java b/source/net/yacy/dbtest.javaindex ac8a44f43..c36d454e7 100644--- a/source/net/yacy/dbtest.java+++ b/source/net/yacy/dbtest.java@@ -13,10 +13,10 @@ import javax.imageio.ImageIO;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -134,7 +134,7 @@ public class dbtest {System.err.println(e);Log.logException(e);System.exit(0);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {System.err.println(e);Log.logException(e);System.exit(0);diff --git a/source/net/yacy/document/SnippetExtractor.java b/source/net/yacy/document/SnippetExtractor.javaindex 4427fdc68..a4f5e7cc7 100644--- a/source/net/yacy/document/SnippetExtractor.java+++ b/source/net/yacy/document/SnippetExtractor.java@@ -27,8 +27,9 @@ import java.util.SortedMap;import java.util.TreeMap;import java.util.TreeSet;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;public class SnippetExtractor {@@ -130,14 +131,14 @@ public class SnippetExtractor {final Iterator<byte[]> j = queryhashes.iterator();Integer pos;int p, minpos = sentence.length(), maxpos = -1;- final HandleSet remainingHashes = new HandleSet(queryhashes.row().primaryKeyLength, queryhashes.comparator(), 0);+ final HandleSet remainingHashes = new RowHandleSet(queryhashes.keylen(), queryhashes.comparator(), 0);while (j.hasNext()) {hash = j.next();pos = hs.get(hash);if (pos == null) {try {remainingHashes.put(hash);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}} else {diff --git a/source/net/yacy/interaction/Interaction.java b/source/net/yacy/interaction/Interaction.javaindex a7e42efd9..ecde18db6 100644--- a/source/net/yacy/interaction/Interaction.java+++ b/source/net/yacy/interaction/Interaction.java@@ -12,9 +12,9 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.protocol.http.HTTPClient;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.Tables.Row;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.peers.Seed;import net.yacy.search.Switchboard;@@ -220,7 +220,7 @@ public static String Tableentry(String url, String type, String comment, Stringsb.tables.insert(from+"_contribution", map);} catch (final IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {// TODO Auto-generated catch blocke.printStackTrace();}diff --git a/source/net/yacy/kelondro/blob/ArrayStack.java b/source/net/yacy/kelondro/blob/ArrayStack.javaindex 4ede3318d..cfff9b6c6 100644--- a/source/net/yacy/kelondro/blob/ArrayStack.java+++ b/source/net/yacy/kelondro/blob/ArrayStack.java@@ -54,7 +54,7 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.MergeIterator;import net.yacy.kelondro.order.NaturalOrder;@@ -627,7 +627,7 @@ public class ArrayStack implements BLOB {* @throws IOException*/@Override- public byte[] get(final byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] get(final byte[] key) throws IOException, SpaceExceededException {if (this.blobs == null || this.blobs.isEmpty()) return null;if (this.blobs.size() == 1) {final blobItem bi = this.blobs.get(0);@@ -654,7 +654,7 @@ public class ArrayStack implements BLOB {return get((byte[]) key);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return null;@@ -692,7 +692,7 @@ public class ArrayStack implements BLOB {} catch (final IOException e) {Log.logSevere("ArrayStack", "BlobValues - IOException: " + e.getMessage(), e);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logSevere("ArrayStack", "BlobValues - RowSpaceExceededException: " + e.getMessage(), e);break;}@@ -774,7 +774,7 @@ public class ArrayStack implements BLOB {* @param key the primary key* @param b* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Overridepublic synchronized void insert(final byte[] key, final byte[] b) throws IOException {@@ -801,10 +801,10 @@ public class ArrayStack implements BLOB {* replace a BLOB entry with another* @param key the primary key* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public synchronized int replace(final byte[] key, final Rewriter rewriter) throws IOException, RowSpaceExceededException {+ public synchronized int replace(final byte[] key, final Rewriter rewriter) throws IOException, SpaceExceededException {int d = 0;for (final blobItem bi: this.blobs) {d += bi.blob.replace(key, rewriter);@@ -816,10 +816,10 @@ public class ArrayStack implements BLOB {* replace a BLOB entry with another which must be smaller or same size* @param key the primary key* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public synchronized int reduce(final byte[] key, final Reducer reduce) throws IOException, RowSpaceExceededException {+ public synchronized int reduce(final byte[] key, final Reducer reduce) throws IOException, SpaceExceededException {int d = 0;for (final blobItem bi: this.blobs) {d += bi.blob.reduce(key, reduce);@@ -963,7 +963,7 @@ public class ArrayStack implements BLOB {HeapWriter.delete(tmpFile);HeapWriter.delete(newFile);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logSevere("ArrayStack", "cannot merge because of memory failure: " + e.getMessage(), e);HeapWriter.delete(tmpFile);HeapWriter.delete(newFile);@@ -1015,7 +1015,7 @@ public class ArrayStack implements BLOB {FileUtils.deletedelete(tmpFile);FileUtils.deletedelete(newFile);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logSevere("ArrayStack", "cannot rewrite because of memory failure: " + e.getMessage(), e);FileUtils.deletedelete(tmpFile);FileUtils.deletedelete(newFile);@@ -1029,7 +1029,7 @@ public class ArrayStack implements BLOB {private static <ReferenceType extends Reference> void merge(final CloneableIterator<ReferenceContainer<ReferenceType>> i1,final CloneableIterator<ReferenceContainer<ReferenceType>> i2,- final ByteOrder ordering, final HeapWriter writer) throws IOException, RowSpaceExceededException {+ final ByteOrder ordering, final HeapWriter writer) throws IOException, SpaceExceededException {assert i1.hasNext();assert i2.hasNext();byte[] c1lh, c2lh;@@ -1129,7 +1129,7 @@ public class ArrayStack implements BLOB {private static <ReferenceType extends Reference> void rewrite(final CloneableIterator<ReferenceContainer<ReferenceType>> i,- final ByteOrder ordering, final HeapWriter writer) throws IOException, RowSpaceExceededException {+ final ByteOrder ordering, final HeapWriter writer) throws IOException, SpaceExceededException {assert i.hasNext();byte[] clh;ReferenceContainer<ReferenceType> c;diff --git a/source/net/yacy/kelondro/blob/BEncodedHeap.java b/source/net/yacy/kelondro/blob/BEncodedHeap.javaindex 1cfa67742..79d627e7b 100644--- a/source/net/yacy/kelondro/blob/BEncodedHeap.java+++ b/source/net/yacy/kelondro/blob/BEncodedHeap.java@@ -41,7 +41,7 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.storage.MapStore;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;@@ -274,10 +274,10 @@ public class BEncodedHeap implements MapStore {** @param name* @return the map if one found or NULL if no entry exists or the entry is corrupt- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* @throws IOException*/- public Map<String, byte[]> get(final byte[] pk) throws IOException, RowSpaceExceededException {+ public Map<String, byte[]> get(final byte[] pk) throws IOException, SpaceExceededException {final byte[] b = this.table.get(pk);if ( b == null ) {return null;@@ -299,7 +299,7 @@ public class BEncodedHeap implements MapStore {} catch ( final IOException e ) {Log.logException(e);return null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);return null;}@@ -314,9 +314,9 @@ public class BEncodedHeap implements MapStore {* @param key* @return the value* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public byte[] getProp(final byte[] pk, final String key) throws IOException, RowSpaceExceededException {+ public byte[] getProp(final byte[] pk, final String key) throws IOException, SpaceExceededException {final byte[] b = this.table.get(pk);if ( b == null ) {return null;@@ -386,11 +386,11 @@ public class BEncodedHeap implements MapStore {** @param name* @param map- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* @throws IOException*/public void insert(final byte[] pk, final Map<String, byte[]> map)- throws RowSpaceExceededException,+ throws SpaceExceededException,IOException {final byte[] b = BEncoder.encode(BEncoder.transcode(map));this.table.insert(pk, b);@@ -404,7 +404,7 @@ public class BEncodedHeap implements MapStore {}public void update(final byte[] pk, final Map<String, byte[]> map)- throws RowSpaceExceededException,+ throws SpaceExceededException,IOException {final Map<String, byte[]> entry = this.get(pk);if ( entry == null ) {@@ -416,7 +416,7 @@ public class BEncodedHeap implements MapStore {}public void update(final byte[] pk, final String key, final byte[] value)- throws RowSpaceExceededException,+ throws SpaceExceededException,IOException {Map<String, byte[]> entry = this.get(pk);if ( entry == null ) {@@ -446,7 +446,7 @@ public class BEncodedHeap implements MapStore {} catch ( final IOException e ) {Log.logException(e);return null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);return null;}@@ -466,10 +466,10 @@ public class BEncodedHeap implements MapStore {* delete a map from the table** @param name- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* @throws IOException*/- public Map<String, byte[]> remove(final byte[] key) throws IOException, RowSpaceExceededException {+ public Map<String, byte[]> remove(final byte[] key) throws IOException, SpaceExceededException {final Map<String, byte[]> value = get(key);delete(key);return value;@@ -483,7 +483,7 @@ public class BEncodedHeap implements MapStore {} catch ( final IOException e ) {Log.logException(e);return null;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);return null;}@@ -501,7 +501,7 @@ public class BEncodedHeap implements MapStore {for ( final Map.Entry<? extends byte[], ? extends Map<String, byte[]>> me : map.entrySet() ) {try {this.insert(me.getKey(), me.getValue());- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);} catch ( final IOException e ) {Log.logException(e);@@ -686,7 +686,7 @@ public class BEncodedHeap implements MapStore {map.close();} catch ( final IOException e ) {Log.logException(e);- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);}} else {diff --git a/source/net/yacy/kelondro/blob/BLOB.java b/source/net/yacy/kelondro/blob/BLOB.javaindex f068451ca..1cc3f2a5b 100644--- a/source/net/yacy/kelondro/blob/BLOB.java+++ b/source/net/yacy/kelondro/blob/BLOB.java@@ -30,7 +30,7 @@ import java.io.IOException;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;public interface BLOB {@@ -115,7 +115,7 @@ public interface BLOB {* @return* @throws IOException*/- public byte[] get(byte[] key) throws IOException, RowSpaceExceededException;+ public byte[] get(byte[] key) throws IOException, SpaceExceededException;public byte[] get(Object key);/**@@ -139,7 +139,7 @@ public interface BLOB {* @param key the primary key* @param b* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/public void insert(byte[] key, byte[] b) throws IOException;@@ -155,9 +155,9 @@ public interface BLOB {* @param rewriter* @return the number of bytes that the rewriter reduced the BLOB* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public int replace(byte[] key, Rewriter rewriter) throws IOException, RowSpaceExceededException;+ public int replace(byte[] key, Rewriter rewriter) throws IOException, SpaceExceededException;/*** a reduce method is the same as the replace. A replace subsumes a reduce method. A reduce method may be more simple.@@ -165,9 +165,9 @@ public interface BLOB {* @param reducer* @return the number of bytes that the rewriter reduced the BLOB* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public int reduce(byte[] key, Reducer reducer) throws IOException, RowSpaceExceededException;+ public int reduce(byte[] key, Reducer reducer) throws IOException, SpaceExceededException;/*** remove a BLOB@@ -189,9 +189,9 @@ public interface BLOB {* of the input* @param b* @return an array that is equal or smaller in size than b- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public byte[] rewrite(byte[] b) throws RowSpaceExceededException;+ public byte[] rewrite(byte[] b) throws SpaceExceededException;}diff --git a/source/net/yacy/kelondro/blob/Compressor.java b/source/net/yacy/kelondro/blob/Compressor.javaindex e6fc380c6..7e5855f68 100644--- a/source/net/yacy/kelondro/blob/Compressor.java+++ b/source/net/yacy/kelondro/blob/Compressor.java@@ -40,7 +40,7 @@ import java.util.zip.GZIPOutputStream;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.MemoryControl;@@ -172,7 +172,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {}@Override- public byte[] get(final byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] get(final byte[] key) throws IOException, SpaceExceededException {// depending on the source of the result, we additionally do entry compression// because if a document was read once, we think that it will not be retrieved another time again soonbyte[] b = null;@@ -189,7 +189,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {b = this.backend.get(key);if (b == null) return null;if (!MemoryControl.request(b.length * 2, true)) {- throw new RowSpaceExceededException(b.length * 2, "decompress needs 2 * " + b.length + " bytes");+ throw new SpaceExceededException(b.length * 2, "decompress needs 2 * " + b.length + " bytes");}return decompress(b);}@@ -201,7 +201,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {return get((byte[]) key);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return null;@@ -239,7 +239,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {if (b == null) return 0;b = decompress(b);return (b == null) ? 0 : b.length;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}@@ -342,7 +342,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {}@Override- public int replace(final byte[] key, final Rewriter rewriter) throws IOException, RowSpaceExceededException {+ public int replace(final byte[] key, final Rewriter rewriter) throws IOException, SpaceExceededException {final byte[] b = get(key);if (b == null) return 0;final byte[] c = rewriter.rewrite(b);@@ -354,7 +354,7 @@ public class Compressor implements BLOB, Iterable<byte[]> {}@Override- public int reduce(final byte[] key, final Reducer reducer) throws IOException, RowSpaceExceededException {+ public int reduce(final byte[] key, final Reducer reducer) throws IOException, SpaceExceededException {final byte[] b = get(key);if (b == null) return 0;final byte[] c = reducer.rewrite(b);diff --git a/source/net/yacy/kelondro/blob/Heap.java b/source/net/yacy/kelondro/blob/Heap.javaindex a1d6630d1..c9d9d5e88 100644--- a/source/net/yacy/kelondro/blob/Heap.java+++ b/source/net/yacy/kelondro/blob/Heap.java@@ -37,7 +37,7 @@ import java.util.TreeMap;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.io.AbstractWriter;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;@@ -142,7 +142,7 @@ public final class Heap extends HeapModifier implements BLOB {* @param key* @param blob* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/private void add(byte[] key, final byte[] blob) throws IOException {assert blob.length > 0;@@ -154,7 +154,7 @@ public final class Heap extends HeapModifier implements BLOB {this.file.writeInt(this.keylength + blob.length);this.file.write(key);this.file.write(blob, 0, blob.length);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {throw new IOException(e.getMessage()); // should never occur;}}@@ -163,7 +163,7 @@ public final class Heap extends HeapModifier implements BLOB {* flush the buffer completely* this is like adding all elements of the buffer, but it needs only one IO access* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/public void flushBuffer() throws IOException {assert this.buffer != null;@@ -208,7 +208,7 @@ public final class Heap extends HeapModifier implements BLOB {blob = entry.getValue();try {this.index.put(key, posFile);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {nextBuffer.put(entry.getKey(), blob);continue flush;}@@ -240,7 +240,7 @@ public final class Heap extends HeapModifier implements BLOB {* @throws IOException*/@Override- public byte[] get(byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] get(byte[] key) throws IOException, SpaceExceededException {key = normalizeKey(key);synchronized (this) {@@ -328,8 +328,8 @@ public final class Heap extends HeapModifier implements BLOB {* @param key the primary key* @param b* @throws IOException- * @throws RowSpaceExceededException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException+ * @throws SpaceExceededException*/@Overridepublic void insert(byte[] key, final byte[] b) throws IOException {@@ -346,7 +346,7 @@ public final class Heap extends HeapModifier implements BLOB {// then look if we can use a free entrytry {if (putToGap(key, b)) return;- } catch (RowSpaceExceededException e) {} // too less space can be ignored, we have a second try+ } catch (SpaceExceededException e) {} // too less space can be ignored, we have a second tryassert this.buffer != null;@@ -374,7 +374,7 @@ public final class Heap extends HeapModifier implements BLOB {}}- private boolean putToGap(byte[] key, final byte[] b) throws IOException, RowSpaceExceededException {+ private boolean putToGap(byte[] key, final byte[] b) throws IOException, SpaceExceededException {// we do not write records of length 0 into the BLOBif (b.length == 0) return true;@@ -569,7 +569,7 @@ public final class Heap extends HeapModifier implements BLOB {heap.close();} catch (final IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/kelondro/blob/HeapModifier.java b/source/net/yacy/kelondro/blob/HeapModifier.javaindex 40f3cdd3b..56dec265e 100644--- a/source/net/yacy/kelondro/blob/HeapModifier.java+++ b/source/net/yacy/kelondro/blob/HeapModifier.java@@ -30,7 +30,7 @@ import java.util.SortedMap;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.io.CachedFileWriter;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;@@ -251,7 +251,7 @@ public class HeapModifier extends HeapReader implements BLOB {}@Override- public int reduce(byte[] key, final Reducer reducer) throws IOException, RowSpaceExceededException {+ public int reduce(byte[] key, final Reducer reducer) throws IOException, SpaceExceededException {key = normalizeKey(key);assert key.length == this.keylength;diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.javaindex 429396ba2..66712dadc 100644--- a/source/net/yacy/kelondro/blob/HeapReader.java+++ b/source/net/yacy/kelondro/blob/HeapReader.java@@ -40,8 +40,9 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.HandleMap;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;+import net.yacy.kelondro.index.RowHandleMap;import net.yacy.kelondro.io.CachedFileWriter;import net.yacy.kelondro.io.Writer;import net.yacy.kelondro.logging.Log;@@ -92,7 +93,7 @@ public class HeapReader {// pick some elements of the indexIterator<byte[]> i = this.index.keys(true, null);int c = 3;- byte[] b, b1 = new byte[this.index.row().primaryKeyLength];+ byte[] b, b1 = new byte[this.keylength];long pos;boolean ok = true;while (i.hasNext() && c-- > 0) {@@ -175,20 +176,22 @@ public class HeapReader {// there is an index and a gap file:// read the index file:try {- this.index = new HandleMap(this.keylength, this.ordering, 8, this.fingerprintFileIdx);+ this.index = new RowHandleMap(this.keylength, this.ordering, 8, this.fingerprintFileIdx);} catch (IOException e) {Log.logException(e);return false;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);return false;}// check saturation- int[] saturation = this.index.saturation(); // {<the maximum length of consecutive equal-beginning bytes in the key>, <the minimum number of leading zeros in the second column>}+ if (this.index instanceof RowHandleMap) {+ int[] saturation = ((RowHandleMap) this.index).saturation(); // {<the maximum length of consecutive equal-beginning bytes in the key>, <the minimum number of leading zeros in the second column>}log.logInfo("saturation of " + this.fingerprintFileIdx.getName() + ": keylength = " + saturation[0] + ", vallength = " + saturation[1] + ", size = " + this.index.size() +", maximum saving for index-compression = " + (saturation[0] * this.index.size() / 1024 / 1024) + " MB" +", exact saving for value-compression = " + (saturation[1] * this.index.size() / 1024 / 1024) + " MB");+ }// read the gap file:try {@@ -249,7 +252,7 @@ public class HeapReader {log.logInfo("generating index for " + this.heapFile.toString() + ", " + (this.file.length() / 1024 / 1024) + " MB. Please wait.");this.free = new Gap();- HandleMap.initDataConsumer indexready = HandleMap.asynchronusInitializer(this.name() + ".initializer", this.keylength, this.ordering, 8, Math.max(10, (int) (Runtime.getRuntime().freeMemory() / (10 * 1024 * 1024))));+ RowHandleMap.initDataConsumer indexready = RowHandleMap.asynchronusInitializer(this.name() + ".initializer", this.keylength, this.ordering, 8, Math.max(10, (int) (Runtime.getRuntime().freeMemory() / (10 * 1024 * 1024))));byte[] key = new byte[this.keylength];int reclen;long seek = 0;@@ -424,7 +427,7 @@ public class HeapReader {* @return the entry which key is the smallest in the heap* @throws IOException*/- protected byte[] first() throws IOException, RowSpaceExceededException {+ protected byte[] first() throws IOException, SpaceExceededException {assert (this.index != null) : "index == null; closeDate=" + this.closeDate + ", now=" + new Date();if (this.index == null) {log.logSevere("this.index == null in first(); closeDate=" + this.closeDate + ", now=" + new Date() + this.heapFile == null ? "" : (" file = " + this.heapFile.toString()));@@ -463,7 +466,7 @@ public class HeapReader {* @return the entry which key is the smallest in the heap* @throws IOException*/- protected byte[] last() throws IOException, RowSpaceExceededException {+ protected byte[] last() throws IOException, SpaceExceededException {assert (this.index != null) : "index == null; closeDate=" + this.closeDate + ", now=" + new Date();if (this.index == null) {log.logSevere("this.index == null in last(); closeDate=" + this.closeDate + ", now=" + new Date() + this.heapFile == null ? "" : (" file = " + this.heapFile.toString()));@@ -482,7 +485,7 @@ public class HeapReader {* @return* @throws IOException*/- public byte[] get(byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] get(byte[] key) throws IOException, SpaceExceededException {assert (this.index != null) : "index == null; closeDate=" + this.closeDate + ", now=" + new Date();if (this.index == null) {log.logSevere("this.index == null in get(); closeDate=" + this.closeDate + ", now=" + new Date() + this.heapFile == null ? "" : (" file = " + this.heapFile.toString()));@@ -497,25 +500,25 @@ public class HeapReader {// access the file and read the containerthis.file.seek(pos);- final int len = this.file.readInt() - this.index.row().primaryKeyLength;+ final int len = this.file.readInt() - this.keylength;if (len < 0) {// database file may be corrupted and should be deleted :-((- log.logSevere("file " + this.file.file() + " corrupted at " + pos + ": negative len. len = " + len + ", pk.len = " + this.index.row().primaryKeyLength);+ log.logSevere("file " + this.file.file() + " corrupted at " + pos + ": negative len. len = " + len + ", pk.len = " + this.keylength);// to get lazy over that problem (who wants to tell the user to stop operation and delete the file???) we work on like the entry does not existthis.index.remove(key);return null;}- long memr = len + this.index.row().primaryKeyLength + 64;+ long memr = len + this.keylength + 64;if (MemoryControl.available() < memr) {- if (!MemoryControl.request(memr, true)) throw new RowSpaceExceededException(memr, "HeapReader.get()/check"); // not enough memory available for this blob+ if (!MemoryControl.request(memr, true)) throw new SpaceExceededException(memr, "HeapReader.get()/check"); // not enough memory available for this blob}// read the keybyte[] keyf;try {- keyf = new byte[this.index.row().primaryKeyLength];+ keyf = new byte[this.keylength];} catch (OutOfMemoryError e) {- throw new RowSpaceExceededException(this.index.row().primaryKeyLength, "HeapReader.get()/keyf");+ throw new SpaceExceededException(this.keylength, "HeapReader.get()/keyf");}this.file.readFully(keyf, 0, keyf.length);if (!this.ordering.equal(key, keyf)) {@@ -536,7 +539,7 @@ public class HeapReader {try {blob = new byte[len];} catch (OutOfMemoryError e) {- throw new RowSpaceExceededException(len, "HeapReader.get()/blob");+ throw new SpaceExceededException(len, "HeapReader.get()/blob");}this.file.readFully(blob, 0, blob.length);@@ -550,7 +553,7 @@ public class HeapReader {return get((byte[]) key);} catch (IOException e) {Log.logException(e);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);}return null;@@ -562,7 +565,7 @@ public class HeapReader {this.file.readInt(); // skip the size value// read the key- final byte[] keyf = new byte[this.index.row().primaryKeyLength];+ final byte[] keyf = new byte[this.keylength];this.file.readFully(keyf, 0, keyf.length);return this.ordering.equal(key, keyf);}@@ -588,7 +591,7 @@ public class HeapReader {// access the file and read the size of the containerthis.file.seek(pos);- return this.file.readInt() - this.index.row().primaryKeyLength;+ return this.file.readInt() - this.keylength;}}diff --git a/source/net/yacy/kelondro/blob/HeapWriter.java b/source/net/yacy/kelondro/blob/HeapWriter.javaindex cfc8b48df..2008ebc08 100644--- a/source/net/yacy/kelondro/blob/HeapWriter.java+++ b/source/net/yacy/kelondro/blob/HeapWriter.java@@ -32,8 +32,9 @@ import java.io.IOException;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;-import net.yacy.kelondro.index.HandleMap;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;+import net.yacy.kelondro.index.RowHandleMap;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;@@ -81,7 +82,7 @@ public final class HeapWriter {this.heapFileTMP = temporaryHeapFile;this.heapFileREADY = readyHeapFile;this.keylength = keylength;- this.index = new HandleMap(keylength, ordering, 8, 100000, readyHeapFile.getAbsolutePath());+ this.index = new RowHandleMap(keylength, ordering, 8, 100000, readyHeapFile.getAbsolutePath());try {this.os = new DataOutputStream(new BufferedOutputStream(new FileOutputStream(temporaryHeapFile), outBuffer));} catch (OutOfMemoryError e) {@@ -97,13 +98,12 @@ public final class HeapWriter {* @param key* @param blob* @throws IOException- * @throws RowSpaceExceededException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException+ * @throws SpaceExceededException*/- public synchronized void add(byte[] key, final byte[] blob) throws IOException, RowSpaceExceededException {+ public synchronized void add(byte[] key, final byte[] blob) throws IOException, SpaceExceededException {assert blob.length > 0;key = HeapReader.normalizeKey(key, this.keylength);- assert this.index.row().primaryKeyLength == this.keylength : this.index.row().primaryKeyLength + "!=" + key.length;assert key.length == this.keylength : "key.length == " + key.length + ", this.keylength = " + this.keylength; // after normalizing they should be equal in lengthassert this.index.get(key) < 0 : "index.get(key) = " + this.index.get(key) + ", index.size() = " + this.index.size() + ", file.length() = " + this.heapFileTMP.length() + ", key = " + UTF8.String(key); // must not occur beforeif ((blob == null) || (blob.length == 0)) return;diff --git a/source/net/yacy/kelondro/blob/MapDataMining.java b/source/net/yacy/kelondro/blob/MapDataMining.javaindex 5f9b2da6f..587e4f175 100644--- a/source/net/yacy/kelondro/blob/MapDataMining.java+++ b/source/net/yacy/kelondro/blob/MapDataMining.java@@ -41,8 +41,8 @@ import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.sorting.ClusteredScoreMap;import net.yacy.cora.sorting.ConcurrentScoreMap;import net.yacy.cora.sorting.ScoreMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;@@ -118,7 +118,7 @@ public class MapDataMining extends MapHeap {mapnameb = it.next();try {map = super.get(mapnameb);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logWarning("MapDataMining", e.getMessage());break;}@@ -200,7 +200,7 @@ public class MapDataMining extends MapHeap {}@Override- public synchronized void insert(final byte[] key, final Map<String, String> newMap) throws IOException, RowSpaceExceededException {+ public synchronized void insert(final byte[] key, final Map<String, String> newMap) throws IOException, SpaceExceededException {assert (key != null);assert (key.length > 0);assert (newMap != null);@@ -295,7 +295,7 @@ public class MapDataMining extends MapHeap {// remove from sortClusterif (this.sortfields != null) deleteSortCluster(UTF8.String(key));}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {map = null;Log.logException(e);}diff --git a/source/net/yacy/kelondro/blob/MapHeap.java b/source/net/yacy/kelondro/blob/MapHeap.javaindex 9df9b3858..a8f0a8aae 100644--- a/source/net/yacy/kelondro/blob/MapHeap.java+++ b/source/net/yacy/kelondro/blob/MapHeap.java@@ -49,7 +49,7 @@ import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.storage.ARC;import net.yacy.cora.storage.ConcurrentARC;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;import net.yacy.kelondro.order.RotateIterator;@@ -121,7 +121,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {return bb.toString();}- private static Map<String, String> bytes2map(final byte[] b) throws IOException, RowSpaceExceededException {+ private static Map<String, String> bytes2map(final byte[] b) throws IOException, SpaceExceededException {final BufferedReader br = new BufferedReader(new InputStreamReader(new ByteArrayInputStream(b)));final Map<String, String> map = new ConcurrentHashMap<String, String>();String line;@@ -136,7 +136,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {map.put(line.substring(0, pos), line.substring(pos + 1));}} catch (final OutOfMemoryError e) {- throw new RowSpaceExceededException(0, "readLine probably uses too much RAM", e);+ throw new SpaceExceededException(0, "readLine probably uses too much RAM", e);} finally {br.close();}@@ -152,9 +152,9 @@ public class MapHeap implements Map<byte[], Map<String, String>> {* @param key the primary key* @param newMap* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public void insert(byte[] key, final Map<String, String> newMap) throws IOException, RowSpaceExceededException {+ public void insert(byte[] key, final Map<String, String> newMap) throws IOException, SpaceExceededException {assert key != null;assert key.length > 0;assert newMap != null;@@ -188,7 +188,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {insert(key, newMap);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return v;@@ -251,7 +251,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {* @return* @throws IOException*/- public Map<String, String> get(final byte[] key) throws IOException, RowSpaceExceededException {+ public Map<String, String> get(final byte[] key) throws IOException, SpaceExceededException {if (key == null) return null;return get(key, true);}@@ -264,7 +264,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {if (key instanceof String) return get(UTF8.getBytes((String) key));} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return null;@@ -297,7 +297,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {return k;}- protected Map<String, String> get(byte[] key, final boolean storeCache) throws IOException, RowSpaceExceededException {+ protected Map<String, String> get(byte[] key, final boolean storeCache) throws IOException, SpaceExceededException {// load map from cacheassert key != null;if (this.cache == null) return null; // case may appear during shutdown@@ -324,7 +324,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {if (b == null) return null;try {map = bytes2map(b);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}@@ -344,7 +344,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {if (b == null) return null;try {return bytes2map(b);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}@@ -486,7 +486,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {} catch (final IOException e) {Log.logWarning("MapDataMining", e.getMessage());continue;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);continue;}@@ -505,7 +505,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {for (final Map.Entry<? extends byte[], ? extends Map<String, String>> me: map.entrySet()) {try {insert(me.getKey(), me.getValue());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);} catch (final IOException e) {Log.logException(e);@@ -586,7 +586,7 @@ public class MapHeap implements Map<byte[], Map<String, String>> {map.close();} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/kelondro/blob/Stack.java b/source/net/yacy/kelondro/blob/Stack.javaindex 5c1579bc5..562a8be45 100644--- a/source/net/yacy/kelondro/blob/Stack.java+++ b/source/net/yacy/kelondro/blob/Stack.java@@ -28,7 +28,7 @@ import java.io.File;import java.io.IOException;import java.util.Iterator;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;@@ -98,9 +98,9 @@ public class Stack {* @param b the new stack element* @return the handle used to store the new element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public synchronized long push(final byte[] b) throws IOException, RowSpaceExceededException {+ public synchronized long push(final byte[] b) throws IOException, SpaceExceededException {long handle = nextHandle();this.stack.insert(NaturalOrder.encodeLong(handle, 8), b);return handle;@@ -113,9 +113,9 @@ public class Stack {* @param b the new stack element* @return the handle used to store the new element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- protected synchronized void push(final Entry e) throws IOException, RowSpaceExceededException {+ protected synchronized void push(final Entry e) throws IOException, SpaceExceededException {this.stack.insert(NaturalOrder.encodeLong(e.h, 8), e.b);}@@ -125,9 +125,9 @@ public class Stack {* @return the object that belongs to the handle* or null if no such element exists* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public synchronized byte[] get(final long handle) throws IOException, RowSpaceExceededException {+ public synchronized byte[] get(final long handle) throws IOException, SpaceExceededException {byte[] k = NaturalOrder.encodeLong(handle, 8);byte[] b = this.stack.get(k);if (b == null) return null;@@ -139,9 +139,9 @@ public class Stack {* @param handle* @return the removed element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public synchronized byte[] remove(final long handle) throws IOException, RowSpaceExceededException {+ public synchronized byte[] remove(final long handle) throws IOException, SpaceExceededException {byte[] k = NaturalOrder.encodeLong(handle, 8);byte[] b = this.stack.get(k);if (b == null) return null;@@ -195,7 +195,7 @@ public class Stack {byte[] b;try {b = this.stack.get(k);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);b = null;}diff --git a/source/net/yacy/kelondro/blob/Stacks.java b/source/net/yacy/kelondro/blob/Stacks.javaindex 877fd5fdc..7d5c4c6a6 100644--- a/source/net/yacy/kelondro/blob/Stacks.java+++ b/source/net/yacy/kelondro/blob/Stacks.java@@ -29,7 +29,7 @@ import java.io.IOException;import java.util.Iterator;import java.util.concurrent.ConcurrentHashMap;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;public class Stacks {@@ -147,9 +147,9 @@ public class Stacks {* @param b the new stack element* @return the handle used to store the new element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public long push(final String stack, final byte[] b) throws IOException, RowSpaceExceededException {+ public long push(final String stack, final byte[] b) throws IOException, SpaceExceededException {Stack s = getStack(stack);if (s == null) return -1;return s.push(b);@@ -163,9 +163,9 @@ public class Stacks {* @param b the new stack element* @return the handle used to store the new element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- protected void push(final String stack, final Stack.Entry e) throws IOException, RowSpaceExceededException {+ protected void push(final String stack, final Stack.Entry e) throws IOException, SpaceExceededException {Stack s = getStack(stack);if (s == null) return;s.push(e);@@ -178,9 +178,9 @@ public class Stacks {* @return the object that belongs to the handle* or null if no such element exists* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public byte[] get(final String stack, final long handle) throws IOException, RowSpaceExceededException {+ public byte[] get(final String stack, final long handle) throws IOException, SpaceExceededException {Stack s = getStack(stack);if (s == null) return null;return s.get(handle);@@ -192,9 +192,9 @@ public class Stacks {* @param handle* @return the removed element* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public byte[] remove(final String stack, final long handle) throws IOException, RowSpaceExceededException {+ public byte[] remove(final String stack, final long handle) throws IOException, SpaceExceededException {Stack s = getStack(stack);if (s == null) return null;return s.remove(handle);diff --git a/source/net/yacy/kelondro/blob/Tables.java b/source/net/yacy/kelondro/blob/Tables.javaindex 99aacd43c..5ea0f9755 100644--- a/source/net/yacy/kelondro/blob/Tables.java+++ b/source/net/yacy/kelondro/blob/Tables.java@@ -43,7 +43,7 @@ import java.util.regex.Pattern;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.UTF8;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.ByteBuffer;@@ -167,7 +167,7 @@ public class Tables implements Iterable<String> {return heap.size();}- private byte[] ukey(final String tablename) throws IOException, RowSpaceExceededException {+ private byte[] ukey(final String tablename) throws IOException, SpaceExceededException {Row row = select(system_table_pkcounter, UTF8.getBytes(tablename));if (row == null) {// table counter entry in pkcounter table does not exist: make a new table entry@@ -201,11 +201,11 @@ public class Tables implements Iterable<String> {* insert a map into a table using a new unique key* @param tablename* @param map- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public byte[] insert(final String tablename, final Map<String, byte[]> map) throws IOException, RowSpaceExceededException {+ public byte[] insert(final String tablename, final Map<String, byte[]> map) throws IOException, SpaceExceededException {final byte[] uk = ukey(tablename);update(tablename, uk, map);final BEncodedHeap heap = getHeap(system_table_pkcounter);@@ -217,7 +217,7 @@ public class Tables implements Iterable<String> {final BEncodedHeap heap = getHeap(table);try {heap.insert(pk, map);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}@@ -226,7 +226,7 @@ public class Tables implements Iterable<String> {final BEncodedHeap heap = getHeap(table);try {heap.insert(row.pk, row);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}@@ -235,7 +235,7 @@ public class Tables implements Iterable<String> {final BEncodedHeap heap = getHeap(table);try {heap.update(pk, map);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}@@ -244,16 +244,16 @@ public class Tables implements Iterable<String> {final BEncodedHeap heap = getHeap(table);try {heap.update(row.pk, row);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException(e.getMessage());}}- public byte[] createRow(final String table) throws IOException, RowSpaceExceededException {+ public byte[] createRow(final String table) throws IOException, SpaceExceededException {return this.insert(table, new ConcurrentHashMap<String, byte[]>());}- public Row select(final String table, final byte[] pk) throws IOException, RowSpaceExceededException {+ public Row select(final String table, final byte[] pk) throws IOException, SpaceExceededException {final BEncodedHeap heap = getHeap(table);if (heap.containsKey(pk)) return new Row(pk, heap.get(pk));return null;diff --git a/source/net/yacy/kelondro/data/word/Word.java b/source/net/yacy/kelondro/data/word/Word.javaindex 0a74d36c5..a49c5ed30 100644--- a/source/net/yacy/kelondro/data/word/Word.java+++ b/source/net/yacy/kelondro/data/word/Word.java@@ -34,9 +34,10 @@ import java.util.Set;import net.yacy.cora.storage.ARC;import net.yacy.cora.storage.ConcurrentARC;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.LargeNumberCache;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;@@ -160,11 +161,11 @@ public class Word {}public static final HandleSet words2hashesHandles(final Collection<String> words) {- final HandleSet hashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, words.size());+ final HandleSet hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, words.size());for (final String word: words)try {hashes.put(word2hash(word));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return hashes;}@@ -172,11 +173,11 @@ public class Word {}public static final HandleSet words2hashesHandles(final String[] words) {- final HandleSet hashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, words.length);+ final HandleSet hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, words.length);for (final String word: words)try {hashes.put(word2hash(word));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return hashes;}diff --git a/source/net/yacy/kelondro/index/BufferedObjectIndex.java b/source/net/yacy/kelondro/index/BufferedObjectIndex.javaindex 6708e0311..eb922a152 100644--- a/source/net/yacy/kelondro/index/BufferedObjectIndex.java+++ b/source/net/yacy/kelondro/index/BufferedObjectIndex.java@@ -33,6 +33,8 @@ import java.util.Map;import java.util.TreeMap;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.MergeIterator;@@ -70,7 +72,7 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {return this.backend.row().getOrdering().largest(this.buffer.largestKey(), this.backend.largestKey());}- private final void flushBuffer() throws IOException, RowSpaceExceededException {+ private final void flushBuffer() throws IOException, SpaceExceededException {if (!this.buffer.isEmpty()) {for (final Row.Entry e: this.buffer) {this.backend.put(e);@@ -87,15 +89,15 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {/*** check size of buffer in such a way that a put into the buffer is possible* afterwards without exceeding the given maximal buffersize- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* @throws IOException*/- private final void checkBuffer() throws IOException, RowSpaceExceededException {+ private final void checkBuffer() throws IOException, SpaceExceededException {if (this.buffer.size() >= this.buffersize) flushBuffer();}@Override- public void addUnique(final Entry row) throws RowSpaceExceededException, IOException {+ public void addUnique(final Entry row) throws SpaceExceededException, IOException {synchronized (this.backend) {checkBuffer();this.buffer.put(row);@@ -117,7 +119,7 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {flushBuffer();} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}this.backend.close();@@ -180,10 +182,10 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public boolean put(final Entry row) throws IOException, RowSpaceExceededException {+ public boolean put(final Entry row) throws IOException, SpaceExceededException {synchronized (this.backend) {checkBuffer();return this.buffer.put(row);@@ -209,7 +211,7 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {}@Override- public List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException {+ public List<RowCollection> removeDoubles() throws IOException, SpaceExceededException {synchronized (this.backend) {flushBuffer();return this.backend.removeDoubles();@@ -240,7 +242,7 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {}@Override- public Entry replace(final Entry row) throws RowSpaceExceededException, IOException {+ public Entry replace(final Entry row) throws SpaceExceededException, IOException {synchronized (this.backend) {final Entry entry = this.buffer.replace(row);if (entry != null) return entry;@@ -321,17 +323,17 @@ public class BufferedObjectIndex implements Index, Iterable<Row.Entry> {while (missing-- > 0) {try {this.buffer.put(this.backend.removeOne());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);break;}}- final HandleSet handles = new HandleSet(this.buffer.row().primaryKeyLength, this.buffer.row().objectOrder, this.buffer.size());+ final HandleSet handles = new RowHandleSet(this.buffer.row().primaryKeyLength, this.buffer.row().objectOrder, this.buffer.size());final Iterator<byte[]> i = this.buffer.keys();while (i.hasNext()) {try {handles.put(i.next());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);break;}diff --git a/source/net/yacy/kelondro/index/Cache.java b/source/net/yacy/kelondro/index/Cache.javaindex 0ae2ae361..fd82ffb72 100644--- a/source/net/yacy/kelondro/index/Cache.java+++ b/source/net/yacy/kelondro/index/Cache.java@@ -34,6 +34,7 @@ import java.util.Map;import java.util.TreeMap;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.util.MemoryControl;@@ -298,7 +299,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkMissSpace()) try {final Row.Entry dummy = this.readMissCache.replace(this.readMissCache.row().newEntry(key));if (dummy == null) this.hasnotUnique++; else this.hasnotDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}return null;@@ -307,7 +308,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(entry);if (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}return entry;@@ -325,7 +326,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {}@Override- public final synchronized boolean put(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public final synchronized boolean put(final Row.Entry row) throws IOException, SpaceExceededException {assert (row != null);assert (row.columns() == row().columns());//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));@@ -344,7 +345,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {boolean c;try {c = this.index.put(row);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// flush all caches to get more memoryclearCache();c = this.index.put(row); // try again@@ -352,14 +353,14 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(row); // overwrite old entryif (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}return c;}@Override- public final synchronized Row.Entry replace(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public final synchronized Row.Entry replace(final Row.Entry row) throws IOException, SpaceExceededException {assert (row != null);assert (row.columns() == row().columns());//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));@@ -374,7 +375,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {// the entry does not exist beforetry {this.index.put(row);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// flush all caches to get more memoryclearCache();this.index.put(row); // try again@@ -383,7 +384,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(row); // learn that entryif (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}return null;@@ -394,7 +395,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {// write to the back-endtry {entry = this.index.replace(row);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// flush all caches to get more memoryclearCache();this.index.replace(row); // try again@@ -402,14 +403,14 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(row); // learn that entryif (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}return entry;}@Override- public final synchronized void addUnique(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public final synchronized void addUnique(final Row.Entry row) throws IOException, SpaceExceededException {assert (row != null);assert (row.columns() == row().columns());//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));@@ -427,7 +428,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {// the worst case: we must write to the back-end directlytry {this.index.addUnique(row);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// flush all caches to get more memoryclearCache();this.index.addUnique(row); // try again@@ -435,12 +436,12 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(row); // learn that entryif (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}}- public final synchronized void addUnique(final Row.Entry row, final Date entryDate) throws IOException, RowSpaceExceededException {+ public final synchronized void addUnique(final Row.Entry row, final Date entryDate) throws IOException, SpaceExceededException {if (entryDate == null) {addUnique(row);return;@@ -461,7 +462,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {// the worst case: we must write to the backend directlytry {this.index.addUnique(row);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// flush all caches to get more memoryclearCache();this.index.addUnique(row); // try again@@ -469,19 +470,19 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkHitSpace()) try {final Row.Entry dummy = this.readHitCache.replace(row); // learn that entryif (dummy == null) this.writeUnique++; else this.writeDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}}- public final synchronized void addUnique(final List<Row.Entry> rows) throws IOException, RowSpaceExceededException {+ public final synchronized void addUnique(final List<Row.Entry> rows) throws IOException, SpaceExceededException {final Iterator<Row.Entry> i = rows.iterator();Row.Entry r;while (i.hasNext()) {r = i.next();try {addUnique(r);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// flush all caches to get more memoryclearCache();addUnique(r); // try again@@ -490,7 +491,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {}@Override- public final synchronized List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException {+ public final synchronized List<RowCollection> removeDoubles() throws IOException, SpaceExceededException {return this.index.removeDoubles();// todo: remove reported entries from the cache!!!}@@ -509,7 +510,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {this.hasnotHit++;this.hasnotDouble++;}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}@@ -541,7 +542,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {this.hasnotHit++;this.hasnotDouble++;}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}@@ -570,7 +571,7 @@ public final class Cache implements Index, Iterable<Row.Entry> {if (checkMissSpace()) try {final Row.Entry dummy = this.readMissCache.replace(this.readMissCache.row().newEntry(key));if (dummy == null) this.hasnotUnique++; else this.hasnotDouble++;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {clearCache();}if (this.readHitCache != null) {diff --git a/source/net/yacy/kelondro/index/Index.java b/source/net/yacy/kelondro/index/Index.javaindex 9e90366ce..fb27734d0 100644--- a/source/net/yacy/kelondro/index/Index.java+++ b/source/net/yacy/kelondro/index/Index.java@@ -31,6 +31,7 @@ import java.util.List;import java.util.Map;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;public interface Index extends Iterable<Row.Entry> {@@ -45,18 +46,18 @@ public interface Index extends Iterable<Row.Entry> {public boolean has(byte[] key); // use this only if there is no get in case that has returns truepublic Map<byte[], Row.Entry> get(final Collection<byte[]> keys, boolean forcecopy) throws IOException, InterruptedException;public Row.Entry get(byte[] key, boolean forcecopy) throws IOException;- public Row.Entry replace(Row.Entry row) throws RowSpaceExceededException, IOException;+ public Row.Entry replace(Row.Entry row) throws SpaceExceededException, IOException;/*** Adds the row to the index. The row is identified by the primary key of the row.* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public boolean put(Row.Entry row) throws IOException, RowSpaceExceededException;- public void addUnique(Row.Entry row) throws RowSpaceExceededException, IOException; // no double-check- public List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException; // removes all elements that are double (to be used after all addUnique)+ public boolean put(Row.Entry row) throws IOException, SpaceExceededException;+ public void addUnique(Row.Entry row) throws SpaceExceededException, IOException; // no double-check+ public List<RowCollection> removeDoubles() throws IOException, SpaceExceededException; // removes all elements that are double (to be used after all addUnique)public boolean delete(byte[] key) throws IOException;public Row.Entry remove(byte[] key) throws IOException;public Row.Entry removeOne() throws IOException;diff --git a/source/net/yacy/kelondro/index/IndexTest.java b/source/net/yacy/kelondro/index/IndexTest.javaindex c0a222e70..7b1b27532 100644--- a/source/net/yacy/kelondro/index/IndexTest.java+++ b/source/net/yacy/kelondro/index/IndexTest.java@@ -10,7 +10,7 @@// $LastChangedBy$//// LICENSE-//+//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or@@ -34,6 +34,8 @@ import java.util.TreeMap;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.MemoryControl;@@ -52,26 +54,26 @@ public class IndexTest {Base64Order.enhancedCoder.encodeLongSB(Math.abs(r1), 6).toString());return ASCII.getBytes(s);}-+public static byte[] randomHash(final Random r) {return randomHash(r.nextLong(), r.nextLong());}-+public static final long mb = 1024 * 1024;-+public static void main(final String[] args) {-+// pre-generate test data so it will not influence test case timefinal int count = args.length == 0 ? 1000000 : Integer.parseInt(args[0]);byte[][] tests = new byte[count][];final Random r = new Random(0);for (int i = 0; i < count; i++) tests[i] = randomHash(r);System.out.println("generated " + count + " test data entries \n");-+// startSystem.out.println("\nSTANDARD JAVA CLASS MAPS \n");final long t1 = System.currentTimeMillis();-+// test tree mapSystem.out.println("sorted map");Runtime.getRuntime().gc();@@ -80,7 +82,7 @@ public class IndexTest {for (int i = 0; i < count; i++) tm.put(tests[i], 1);final long t2 = System.currentTimeMillis();System.out.println("time for TreeMap<byte[]> generation: " + (t2 - t1));-+int bugs = 0;for (int i = 0; i < count; i++) if (tm.get(tests[i]) == null) bugs++;Runtime.getRuntime().gc();@@ -98,7 +100,7 @@ public class IndexTest {for (int i = 0; i < count; i++) hm.put(UTF8.String(tests[i]), 1);final long t4 = System.currentTimeMillis();System.out.println("time for HashMap<String> generation: " + (t4 - t3));-+bugs = 0;for (int i = 0; i < count; i++) if (hm.get(UTF8.String(tests[i])) == null) bugs++;Runtime.getRuntime().gc();@@ -107,25 +109,25 @@ public class IndexTest {final long t5 = System.currentTimeMillis();System.out.println("time for HashMap<String> test: " + (t5 - t4) + ", " + bugs + " bugs");System.out.println("memory for HashMap<String>: " + (freeStartHash - freeEndHash) / mb + " MB\n");-+System.out.println("\nKELONDRO-ENHANCED MAPS \n");-+// test kelondro indexSystem.out.println("sorted map");Runtime.getRuntime().gc();final long freeStartKelondro = MemoryControl.available();HandleMap ii = null;- ii = new HandleMap(12, Base64Order.enhancedCoder, 4, count, "test");+ ii = new RowHandleMap(12, Base64Order.enhancedCoder, 4, count, "test");for (int i = 0; i < count; i++)try {ii.putUnique(tests[i], 1);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {e.printStackTrace();}ii.get(randomHash(r)); // trigger sortfinal long t6 = System.currentTimeMillis();System.out.println("time for HandleMap<byte[]> generation: " + (t6 - t5));-+bugs = 0;for (int i = 0; i < count; i++) if (ii.get(tests[i]) != 1) bugs++;Runtime.getRuntime().gc();@@ -143,7 +145,7 @@ public class IndexTest {for (int i = 0; i < count; i++) bm.put(new ByteArray(tests[i]), 1);final long t8 = System.currentTimeMillis();System.out.println("time for HashMap<ByteArray> generation: " + (t8 - t7));-+bugs = 0;for (int i = 0; i < count; i++) if (bm.get(new ByteArray(tests[i])) == null) bugs++;Runtime.getRuntime().gc();diff --git a/source/net/yacy/kelondro/index/RAMIndex.java b/source/net/yacy/kelondro/index/RAMIndex.javaindex fbc193728..cc4aafb9e 100644--- a/source/net/yacy/kelondro/index/RAMIndex.java+++ b/source/net/yacy/kelondro/index/RAMIndex.java@@ -34,6 +34,7 @@ import java.util.Map;import java.util.TreeMap;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.order.MergeIterator;import net.yacy.kelondro.order.StackIterator;@@ -92,7 +93,7 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {this.index1 = null; // to show that this is the initialization phase}- public final synchronized void reset(final int initialspace) throws RowSpaceExceededException {+ public final synchronized void reset(final int initialspace) throws SpaceExceededException {this.index0 = null; // first flush RAM to make roomthis.index0 = new RowSet(this.rowdef, initialspace);this.index1 = null; // to show that this is the initialization phase@@ -164,7 +165,7 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {}@Override- public final synchronized Row.Entry replace(final Row.Entry entry) throws RowSpaceExceededException {+ public final synchronized Row.Entry replace(final Row.Entry entry) throws SpaceExceededException {assert (entry != null);finishInitialization();// if the new entry is within the initialization part, just overwrite it@@ -183,10 +184,10 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public final boolean put(final Row.Entry entry) throws RowSpaceExceededException {+ public final boolean put(final Row.Entry entry) throws SpaceExceededException {assert (entry != null);if (entry == null) return true;synchronized (this) {@@ -205,7 +206,7 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {}@Override- public final void addUnique(final Row.Entry entry) throws RowSpaceExceededException {+ public final void addUnique(final Row.Entry entry) throws SpaceExceededException {assert (entry != null);if (entry == null) return;synchronized (this) {@@ -219,12 +220,12 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {}}- public final void addUnique(final List<Entry> rows) throws RowSpaceExceededException {+ public final void addUnique(final List<Entry> rows) throws SpaceExceededException {final Iterator<Entry> i = rows.iterator();while (i.hasNext()) addUnique(i.next());}- public final synchronized long inc(final byte[] key, final int col, final long add, final Row.Entry initrow) throws RowSpaceExceededException {+ public final synchronized long inc(final byte[] key, final int col, final long add, final Row.Entry initrow) throws SpaceExceededException {assert (key != null);finishInitialization();assert this.index0.isSorted();@@ -234,7 +235,7 @@ public final class RAMIndex implements Index, Iterable<Row.Entry> {}@Override- public final synchronized ArrayList<RowCollection> removeDoubles() throws RowSpaceExceededException {+ public final synchronized ArrayList<RowCollection> removeDoubles() throws SpaceExceededException {// finish initialization phase explicitelythis.index0.sort();if (this.index1 == null) {diff --git a/source/net/yacy/kelondro/index/RAMIndexCluster.java b/source/net/yacy/kelondro/index/RAMIndexCluster.javaindex ded7793d8..7e0038fb0 100644--- a/source/net/yacy/kelondro/index/RAMIndexCluster.java+++ b/source/net/yacy/kelondro/index/RAMIndexCluster.java@@ -33,6 +33,8 @@ import java.util.Map;import java.util.TreeMap;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.MergeIterator;@@ -84,11 +86,11 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea@Overridepublic final byte[] smallestKey() {- final HandleSet keysort = new HandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.cluster.length);+ final HandleSet keysort = new RowHandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.cluster.length);synchronized (this.cluster) {for (final RAMIndex rs: this.cluster) try {keysort.put(rs.smallestKey());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -97,11 +99,11 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea@Overridepublic final byte[] largestKey() {- final HandleSet keysort = new HandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.cluster.length);+ final HandleSet keysort = new RowHandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.cluster.length);synchronized (this.cluster) {for (final RAMIndex rs: this.cluster) try {keysort.put(rs.largestKey());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -121,14 +123,14 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea}@Override- public final void addUnique(final Entry row) throws RowSpaceExceededException {+ public final void addUnique(final Entry row) throws SpaceExceededException {final int i = indexFor(row);assert i >= 0 : "i = " + i;if (i < 0) return;accessArray(i).addUnique(row);}- public final void addUnique(final List<Entry> rows) throws RowSpaceExceededException {+ public final void addUnique(final List<Entry> rows) throws SpaceExceededException {for (final Entry row: rows) addUnique(row);}@@ -210,10 +212,10 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public final boolean put(final Entry row) throws RowSpaceExceededException {+ public final boolean put(final Entry row) throws SpaceExceededException {final int i = indexFor(row);assert i >= 0 : "i = " + i;if (i < 0) return true;@@ -235,7 +237,7 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea}@Override- public final ArrayList<RowCollection> removeDoubles() throws RowSpaceExceededException {+ public final ArrayList<RowCollection> removeDoubles() throws SpaceExceededException {final ArrayList<RowCollection> col = new ArrayList<RowCollection>();synchronized (this.cluster) {for (int i = 0; i < this.cluster.length; i++) {@@ -282,7 +284,7 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Clonea}@Override- public final Entry replace(final Entry row) throws RowSpaceExceededException {+ public final Entry replace(final Entry row) throws SpaceExceededException {final int i = indexFor(row);assert i >= 0 : "i = " + i;if (i < 0) return null;@@ -344,7 +346,7 @@ public final class RAMIndexCluster implements Index, Iterable<Row.Entry>, Cloneareturn this.rows(true, null);}- public final long inc(final byte[] key, final int col, final long add, final Entry initrow) throws RowSpaceExceededException {+ public final long inc(final byte[] key, final int col, final long add, final Entry initrow) throws SpaceExceededException {final int i = indexFor(key);if (i < 0) return -1;return accessArray(i).inc(key, col, add, initrow);diff --git a/source/net/yacy/kelondro/index/RowCollection.java b/source/net/yacy/kelondro/index/RowCollection.javaindex c9f792d26..9441d8e0c 100644--- a/source/net/yacy/kelondro/index/RowCollection.java+++ b/source/net/yacy/kelondro/index/RowCollection.java@@ -38,6 +38,7 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.sorting.Array;import net.yacy.cora.sorting.Sortable;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;@@ -85,7 +86,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,this.chunkcount = 0;}- public RowCollection(final Row rowdef, final int objectCount) throws RowSpaceExceededException {+ public RowCollection(final Row rowdef, final int objectCount) throws SpaceExceededException {this(rowdef);ensureSize(objectCount);}@@ -253,14 +254,14 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,return needed;}- private final void ensureSize(final int elements) throws RowSpaceExceededException {+ private final void ensureSize(final int elements) throws SpaceExceededException {if (elements == 0) return;final long allocram = neededSpaceForEnsuredSize(elements, true);if (allocram == 0) return;assert this.chunkcache.length < elements * this.rowdef.objectsize : "wrong alloc computation (1): elements * rowdef.objectsize = " + (elements * this.rowdef.objectsize) + ", chunkcache.length = " + this.chunkcache.length;assert allocram > this.chunkcache.length : "wrong alloc computation (2): allocram = " + allocram + ", chunkcache.length = " + this.chunkcache.length;if (allocram > Integer.MAX_VALUE || !MemoryControl.request(allocram + 32, true))- throw new RowSpaceExceededException(allocram + 32, "RowCollection grow");+ throw new SpaceExceededException(allocram + 32, "RowCollection grow");try {final byte[] newChunkcache = new byte[(int) allocram]; // increase spaceSystem.arraycopy(this.chunkcache, 0, newChunkcache, 0, this.chunkcache.length);@@ -273,7 +274,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,System.arraycopy(this.chunkcache, 0, newChunkcache, 0, this.chunkcache.length);this.chunkcache = newChunkcache;} catch (final OutOfMemoryError ee) {- throw new RowSpaceExceededException(allocram, "RowCollection grow after OutOfMemoryError " + ee.getMessage());+ throw new SpaceExceededException(allocram, "RowCollection grow after OutOfMemoryError " + ee.getMessage());}}}@@ -354,7 +355,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,return entry;}- public synchronized final void set(final int index, final Row.Entry a) throws RowSpaceExceededException {+ public synchronized final void set(final int index, final Row.Entry a) throws SpaceExceededException {assert (index >= 0) : "set: access with index " + index + " is below zero";ensureSize(index + 1);final byte[] column = a.bytes();@@ -368,7 +369,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,this.lastTimeWrote = System.currentTimeMillis();}- public final void insertUnique(final int index, final Row.Entry a) throws RowSpaceExceededException {+ public final void insertUnique(final int index, final Row.Entry a) throws SpaceExceededException {assert (a != null);if (index < this.chunkcount) {@@ -381,23 +382,23 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,set(index, a);}- public synchronized void addUnique(final Row.Entry row) throws RowSpaceExceededException {+ public synchronized void addUnique(final Row.Entry row) throws SpaceExceededException {final byte[] r = row.bytes();addUnique(r, 0, r.length);}- public synchronized void addUnique(final List<Row.Entry> rows) throws RowSpaceExceededException {+ public synchronized void addUnique(final List<Row.Entry> rows) throws SpaceExceededException {assert this.sortBound == 0 : "sortBound = " + this.sortBound + ", chunkcount = " + this.chunkcount;final Iterator<Row.Entry> i = rows.iterator();while (i.hasNext()) addUnique(i.next());}- public synchronized void add(final byte[] a) throws RowSpaceExceededException {+ public synchronized void add(final byte[] a) throws SpaceExceededException {assert a.length == this.rowdef.objectsize : "a.length = " + a.length + ", objectsize = " + this.rowdef.objectsize;addUnique(a, 0, a.length);}- private final void addUnique(final byte[] a, final int astart, final int alength) throws RowSpaceExceededException {+ private final void addUnique(final byte[] a, final int astart, final int alength) throws SpaceExceededException {assert (a != null);assert (astart >= 0) && (astart < a.length) : " astart = " + astart;assert (!(Log.allZero(a, astart, alength))) : "a = " + NaturalOrder.arrayList(a, astart, alength);@@ -421,7 +422,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,this.lastTimeWrote = System.currentTimeMillis();}- protected final void addSorted(final byte[] a, final int astart, final int alength) throws RowSpaceExceededException {+ protected final void addSorted(final byte[] a, final int astart, final int alength) throws SpaceExceededException {assert (a != null);assert (astart >= 0) && (astart < a.length) : " astart = " + astart;assert (!(Log.allZero(a, astart, alength))) : "a = " + NaturalOrder.arrayList(a, astart, alength);@@ -436,7 +437,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,this.lastTimeWrote = System.currentTimeMillis();}- public synchronized final void addAllUnique(final RowCollection c) throws RowSpaceExceededException {+ public synchronized final void addAllUnique(final RowCollection c) throws SpaceExceededException {if (c == null) return;assert(this.rowdef.objectsize == c.rowdef.objectsize);ensureSize(this.chunkcount + c.size());@@ -781,7 +782,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,Array.uniq(this);}- public synchronized ArrayList<RowCollection> removeDoubles() throws RowSpaceExceededException {+ public synchronized ArrayList<RowCollection> removeDoubles() throws SpaceExceededException {assert (this.rowdef.objectOrder != null);// removes double-occurrences of chunks// in contrast to uniq() this removes also the remaining, non-double entry that had a double-occurrence to the others@@ -912,7 +913,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,Base64Order.enhancedCoder.encodeLongSB(random.nextLong(), 4).toString();}- public static void test(final int testsize) throws RowSpaceExceededException {+ public static void test(final int testsize) throws SpaceExceededException {final Row r = new Row(new Column[]{new Column("hash", Column.celltype_string, Column.encoder_bytes, 12, "hash")},Base64Order.enhancedCoder);@@ -1048,7 +1049,7 @@ public class RowCollection implements Sortable<Row.Entry>, Iterable<Row.Entry>,//test(1000000);Log.shutdown();Array.terminate();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {e.printStackTrace();}}diff --git a/source/net/yacy/kelondro/index/HandleMap.java b/source/net/yacy/kelondro/index/RowHandleMap.javasimilarity index 85%rename from source/net/yacy/kelondro/index/HandleMap.javarename to source/net/yacy/kelondro/index/RowHandleMap.javaindex 21287c1c3..b7706eefb 100644--- a/source/net/yacy/kelondro/index/HandleMap.java+++ b/source/net/yacy/kelondro/index/RowHandleMap.java@@ -32,9 +32,12 @@ import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;import java.io.OutputStream;+import java.util.AbstractMap;import java.util.ArrayList;import java.util.Iterator;import java.util.List;+import java.util.Map;+import java.util.Map.Entry;import java.util.concurrent.BlockingQueue;import java.util.concurrent.Callable;import java.util.concurrent.ExecutionException;@@ -47,10 +50,12 @@ import java.util.zip.GZIPOutputStream;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;-public final class HandleMap implements Iterable<Row.Entry> {+public final class RowHandleMap implements HandleMap, Iterable<Map.Entry<byte[], Long>> {private final Row rowdef;private RAMIndexCluster index;@@ -63,7 +68,7 @@ public final class HandleMap implements Iterable<Row.Entry> {* @param objectOrder* @param space*/- public HandleMap(final int keylength, final ByteOrder objectOrder, final int idxbytes, final int expectedspace, final String name) {+ public RowHandleMap(final int keylength, final ByteOrder objectOrder, final int idxbytes, final int expectedspace, final String name) {this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key"), new Column("long c-" + idxbytes + " {b256}")}, objectOrder);this.index = new RAMIndexCluster(name, this.rowdef, spread(expectedspace));}@@ -74,9 +79,9 @@ public final class HandleMap implements Iterable<Row.Entry> {* @param objectOrder* @param file* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public HandleMap(final int keylength, final ByteOrder objectOrder, final int idxbytes, final File file) throws IOException, RowSpaceExceededException {+ public RowHandleMap(final int keylength, final ByteOrder objectOrder, final int idxbytes, final File file) throws IOException, SpaceExceededException {this(keylength, objectOrder, idxbytes, (int) (file.length() / (keylength + idxbytes)), file.getAbsolutePath());// read the index dump and fill the indexInputStream is;@@ -101,6 +106,7 @@ public final class HandleMap implements Iterable<Row.Entry> {trim();}+ @Overridepublic void trim() {this.index.trim();}@@ -122,7 +128,10 @@ public final class HandleMap implements Iterable<Row.Entry> {int valm = this.rowdef.width(1);byte[] lastk = null, thisk;int keym = 0; // will be the maximum length of consecutive equal-beginning byte[]- for (final Row.Entry row: this) {+ Iterator<Row.Entry> i = rows(true, null);+ Row.Entry row;+ while (i.hasNext()) {+ row = i.next();// check length of keyif (lastk == null) {lastk = row.bytes();@@ -165,6 +174,7 @@ public final class HandleMap implements Iterable<Row.Entry> {* @return the number of written entries* @throws IOException*/+ @Overridepublic final int dump(final File file) throws IOException {// we must use an iterator from the combined index, because we need the entries sorted// otherwise we could just write the byte[] from the in kelondroRowSet which would make@@ -195,23 +205,28 @@ public final class HandleMap implements Iterable<Row.Entry> {return this.index.row();}+ @Overridepublic final void clear() {this.index.clear();}+ @Overridepublic final byte[] smallestKey() {return this.index.smallestKey();}+ @Overridepublic final byte[] largestKey() {return this.index.largestKey();}+ @Overridepublic final boolean has(final byte[] key) {assert (key != null);return this.index.has(key);}+ @Overridepublic final long get(final byte[] key) {assert (key != null);final Row.Entry indexentry = this.index.get(key, false);@@ -225,9 +240,10 @@ public final class HandleMap implements Iterable<Row.Entry> {* @param l the value* @return the previous entry of the index* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public final long put(final byte[] key, final long l) throws RowSpaceExceededException {+ @Override+ public final long put(final byte[] key, final long l) throws SpaceExceededException {assert l >= 0 : "l = " + l;assert (key != null);final Row.Entry newentry = this.rowdef.newEntry();@@ -238,7 +254,8 @@ public final class HandleMap implements Iterable<Row.Entry> {return oldentry.getColLong(1);}- public final void putUnique(final byte[] key, final long l) throws RowSpaceExceededException {+ @Override+ public final void putUnique(final byte[] key, final long l) throws SpaceExceededException {assert l >= 0 : "l = " + l;assert (key != null);final Row.Entry newentry = this.rowdef.newEntry();@@ -247,7 +264,8 @@ public final class HandleMap implements Iterable<Row.Entry> {this.index.addUnique(newentry);}- public final long add(final byte[] key, final long a) throws RowSpaceExceededException {+ @Override+ public final long add(final byte[] key, final long a) throws SpaceExceededException {assert key != null;assert a > 0; // it does not make sense to add 0. If this occurres, it is a performance issuesynchronized (this.index) {@@ -266,15 +284,18 @@ public final class HandleMap implements Iterable<Row.Entry> {}}- public final long inc(final byte[] key) throws RowSpaceExceededException {+ @Override+ public final long inc(final byte[] key) throws SpaceExceededException {return add(key, 1);}- public final long dec(final byte[] key) throws RowSpaceExceededException {+ @Override+ public final long dec(final byte[] key) throws SpaceExceededException {return add(key, -1);}- public final ArrayList<long[]> removeDoubles() throws RowSpaceExceededException {+ @Override+ public final ArrayList<long[]> removeDoubles() throws SpaceExceededException {final ArrayList<long[]> report = new ArrayList<long[]>();long[] is;int c;@@ -294,6 +315,7 @@ public final class HandleMap implements Iterable<Row.Entry> {return report;}+ @Overridepublic final ArrayList<byte[]> top(final int count) {final List<Row.Entry> list0 = this.index.top(count);final ArrayList<byte[]> list = new ArrayList<byte[]>();@@ -303,6 +325,7 @@ public final class HandleMap implements Iterable<Row.Entry> {return list;}+ @Overridepublic final synchronized long remove(final byte[] key) {assert (key != null);final Row.Entry indexentry;@@ -320,20 +343,24 @@ public final class HandleMap implements Iterable<Row.Entry> {return indexentry.getColLong(1);}+ @Overridepublic final long removeone() {final Row.Entry indexentry = this.index.removeOne();if (indexentry == null) return -1;return indexentry.getColLong(1);}+ @Overridepublic final int size() {return this.index.size();}+ @Overridepublic final boolean isEmpty() {return this.index.isEmpty();}+ @Overridepublic final CloneableIterator<byte[]> keys(final boolean up, final byte[] firstKey) {return this.index.keys(up, firstKey);}@@ -342,6 +369,7 @@ public final class HandleMap implements Iterable<Row.Entry> {return this.index.rows(up, firstKey);}+ @Overridepublic final void close() {this.index.close();this.index = null;@@ -358,7 +386,7 @@ public final class HandleMap implements Iterable<Row.Entry> {* @return*/public final static initDataConsumer asynchronusInitializer(final String name, final int keylength, final ByteOrder objectOrder, final int idxbytes, final int expectedspace) {- final initDataConsumer initializer = new initDataConsumer(new HandleMap(keylength, objectOrder, idxbytes, expectedspace, name));+ final initDataConsumer initializer = new initDataConsumer(new RowHandleMap(keylength, objectOrder, idxbytes, expectedspace, name));final ExecutorService service = Executors.newSingleThreadExecutor();initializer.setResult(service.submit(initializer));service.shutdown();@@ -376,18 +404,18 @@ public final class HandleMap implements Iterable<Row.Entry> {protected static final entry poisonEntry = new entry(new byte[0], 0);- public final static class initDataConsumer implements Callable<HandleMap> {+ public final static class initDataConsumer implements Callable<RowHandleMap> {private final BlockingQueue<entry> cache;- private final HandleMap map;- private Future<HandleMap> result;+ private final RowHandleMap map;+ private Future<RowHandleMap> result;- public initDataConsumer(final HandleMap map) {+ public initDataConsumer(final RowHandleMap map) {this.map = map;this.cache = new LinkedBlockingQueue<entry>();}- protected final void setResult(final Future<HandleMap> result) {+ protected final void setResult(final Future<RowHandleMap> result) {this.result = result;}@@ -426,12 +454,12 @@ public final class HandleMap implements Iterable<Row.Entry> {* @throws InterruptedException* @throws ExecutionException*/- public final HandleMap result() throws InterruptedException, ExecutionException {+ public final RowHandleMap result() throws InterruptedException, ExecutionException {return this.result.get();}@Override- public final HandleMap call() throws IOException {+ public final RowHandleMap call() throws IOException {try {finishloop: while (true) {entry c;@@ -444,7 +472,7 @@ public final class HandleMap implements Iterable<Row.Entry> {continue finishloop;}}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return this.map;@@ -455,8 +483,28 @@ public final class HandleMap implements Iterable<Row.Entry> {}}- @Override- public Iterator<Row.Entry> iterator() {- return rows(true, null);- }+ @Override+ public Iterator<Entry<byte[], Long>> iterator() {+ final Iterator<Row.Entry> i = this.index.iterator();+ return new Iterator<Entry<byte[], Long>>() {++ @Override+ public boolean hasNext() {+ return i.hasNext();+ }++ @Override+ public Entry<byte[], Long> next() {+ Row.Entry row = i.next();+ return new AbstractMap.SimpleEntry<byte[], Long>(row.getPrimaryKeyBytes(), row.getColLong(1));+ }++ @Override+ public void remove() {+ i.remove();+ }++ };+ }+}diff --git a/source/net/yacy/kelondro/index/HandleSet.java b/source/net/yacy/kelondro/index/RowHandleSet.javasimilarity index 81%rename from source/net/yacy/kelondro/index/HandleSet.javarename to source/net/yacy/kelondro/index/RowHandleSet.javaindex b93175953..e1fcfbecb 100644--- a/source/net/yacy/kelondro/index/HandleSet.java+++ b/source/net/yacy/kelondro/index/RowHandleSet.java@@ -40,47 +40,50 @@ import java.util.Iterator;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;import net.yacy.kelondro.util.SetTools;-public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializable {+public final class RowHandleSet implements HandleSet, Iterable<byte[]>, Cloneable, Serializable {private static final long serialVersionUID=444204785291174968L;private final Row rowdef;private RowSet index;- public HandleSet(final int keylength, final ByteOrder objectOrder, final int expectedspace) {+ public RowHandleSet(final int keylength, final ByteOrder objectOrder, final int expectedspace) {this.rowdef = new Row(new Column[]{new Column("key", Column.celltype_binary, Column.encoder_bytes, keylength, "key")}, objectOrder);try {this.index = new RowSet(this.rowdef, expectedspace);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {try {this.index = new RowSet(this.rowdef, 0);- } catch (RowSpaceExceededException ee) {+ } catch (SpaceExceededException ee) {Log.logException(ee);this.index = null;}}}- private HandleSet(Row rowdef, RowSet index) {+ private RowHandleSet(Row rowdef, RowSet index) {this.rowdef = rowdef;this.index = index;}- public HandleSet(Row rowdef, byte[] b) throws RowSpaceExceededException {+ public RowHandleSet(Row rowdef, byte[] b) throws SpaceExceededException {this.rowdef = rowdef;this.index = RowSet.importRowSet(b, this.rowdef);}@Override- public HandleSet clone() {- return new HandleSet(this.rowdef, this.index.clone());+ public RowHandleSet clone() {+ return new RowHandleSet(this.rowdef, this.index.clone());}+ @Overridepublic byte[] export() {return this.index.exportCollection();}@@ -91,9 +94,9 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl* @param objectOrder* @param file* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public HandleSet(final int keylength, final ByteOrder objectOrder, final File file) throws IOException, RowSpaceExceededException {+ public RowHandleSet(final int keylength, final ByteOrder objectOrder, final File file) throws IOException, SpaceExceededException {this(keylength, objectOrder, (int) (file.length() / (keylength + 8)));// read the index dump and fill the indexfinal InputStream is = new BufferedInputStream(new FileInputStream(file), 1024 * 1024);@@ -115,6 +118,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl* @return the number of written entries* @throws IOException*/+ @Overridepublic final int dump(final File file) throws IOException {// we must use an iterator from the combined index, because we need the entries sorted// otherwise we could just write the byte[] from the in kelondroRowSet which would make@@ -136,14 +140,17 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn c;}+ @Overridepublic final synchronized byte[] smallestKey() {return this.index.smallestKey();}+ @Overridepublic final synchronized byte[] largestKey() {return this.index.largestKey();}+ @Overridepublic ByteOrder comparator() {return this.rowdef.objectOrder;}@@ -152,16 +159,24 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn this.index.row();}+ @Override+ public int keylen() {+ return this.index.rowdef.primaryKeyLength;+ }++ @Overridepublic final void clear() {this.index.clear();}+ @Overridepublic final synchronized boolean has(final byte[] key) {assert (key != null);return this.index.has(key);}- public final void putAll(final HandleSet aset) throws RowSpaceExceededException {+ @Override+ public final void putAll(final HandleSet aset) throws SpaceExceededException {for (byte[] b: aset) put(b);}@@ -170,20 +185,23 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl* @param key* @return true if this set did _not_ already contain the given key.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public final boolean put(final byte[] key) throws RowSpaceExceededException {+ @Override+ public final boolean put(final byte[] key) throws SpaceExceededException {assert (key != null);final Row.Entry newentry = this.index.row().newEntry(key);return this.index.put(newentry);}- public final void putUnique(final byte[] key) throws RowSpaceExceededException {+ @Override+ public final void putUnique(final byte[] key) throws SpaceExceededException {assert (key != null);final Row.Entry newentry = this.index.row().newEntry(key);this.index.addUnique(newentry);}+ @Overridepublic final boolean remove(final byte[] key) {assert (key != null);Row.Entry indexentry;@@ -191,6 +209,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn indexentry != null;}+ @Overridepublic final synchronized byte[] removeOne() {Row.Entry indexentry;indexentry = this.index.removeOne();@@ -204,6 +223,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl* @param idx* @return entry from the end of the list*/+ @Overridepublic final synchronized byte[] getOne(int idx) {if (idx >= this.size()) return null;Row.Entry indexentry;@@ -212,14 +232,17 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn indexentry.getPrimaryKeyBytes();}+ @Overridepublic final synchronized boolean isEmpty() {return this.index.isEmpty();}+ @Overridepublic final synchronized int size() {return this.index.size();}+ @Overridepublic final synchronized CloneableIterator<byte[]> keys(final boolean up, final byte[] firstKey) {return this.index.keys(up, firstKey);}@@ -229,6 +252,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn keys(true, null);}+ @Overridepublic final synchronized void close() {this.index.close();this.index = null;@@ -241,17 +265,17 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl// set tools- public HandleSet joinConstructive(final HandleSet other) throws RowSpaceExceededException {+ public HandleSet joinConstructive(final HandleSet other) throws SpaceExceededException {return joinConstructive(this, other);}// now the same for set-set- public static HandleSet joinConstructive(final HandleSet set1, final HandleSet set2) throws RowSpaceExceededException {+ public static HandleSet joinConstructive(final HandleSet set1, final HandleSet set2) throws SpaceExceededException {// comparators must be equalif ((set1 == null) || (set2 == null)) return null;assert set1.comparator() == set2.comparator();if (set1.comparator() != set2.comparator()) return null;- if (set1.isEmpty() || set2.isEmpty()) return new HandleSet(set1.rowdef.primaryKeyLength, set1.comparator(), 0);+ if (set1.isEmpty() || set2.isEmpty()) return new RowHandleSet(set1.keylen(), set1.comparator(), 0);// decide which method to usefinal int high = ((set1.size() > set2.size()) ? set1.size() : set2.size());@@ -267,9 +291,9 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn joinConstructiveByEnumeration(set1, set2);}- private static HandleSet joinConstructiveByTest(final HandleSet small, final HandleSet large) throws RowSpaceExceededException {+ private static HandleSet joinConstructiveByTest(final HandleSet small, final HandleSet large) throws SpaceExceededException {final Iterator<byte[]> mi = small.iterator();- final HandleSet result = new HandleSet(small.rowdef.primaryKeyLength, small.comparator(), 0);+ final HandleSet result = new RowHandleSet(small.keylen(), small.comparator(), 0);byte[] o;while (mi.hasNext()) {o = mi.next();@@ -278,12 +302,12 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn result;}- private static HandleSet joinConstructiveByEnumeration(final HandleSet set1, final HandleSet set2) throws RowSpaceExceededException {+ private static HandleSet joinConstructiveByEnumeration(final HandleSet set1, final HandleSet set2) throws SpaceExceededException {// implement pairwise enumerationfinal ByteOrder comp = set1.comparator();final Iterator<byte[]> mi = set1.iterator();final Iterator<byte[]> si = set2.iterator();- final HandleSet result = new HandleSet(set1.rowdef.primaryKeyLength, comp, 0);+ final HandleSet result = new RowHandleSet(set1.keylen(), comp, 0);int c;if (mi.hasNext() && si.hasNext()) {byte[] mobj = mi.next();@@ -304,6 +328,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializablreturn result;}+ @Overridepublic void excludeDestructive(final HandleSet other) {excludeDestructive(this, other);}@@ -331,7 +356,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl}public static void main(String[] args) {- HandleSet s = new HandleSet(8, NaturalOrder.naturalOrder, 100);+ HandleSet s = new RowHandleSet(8, NaturalOrder.naturalOrder, 100);try {s.put(UTF8.getBytes("Hello"));s.put(UTF8.getBytes("World"));@@ -346,7 +371,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl// read from fileObjectInputStream in = new ObjectInputStream(new FileInputStream(f));- HandleSet s1 = (HandleSet) in.readObject();+ RowHandleSet s1 = (RowHandleSet) in.readObject();in.close();for (byte[] b: s1) {@@ -358,7 +383,7 @@ public final class HandleSet implements Iterable<byte[]>, Cloneable, Serializabl} catch (ClassNotFoundException e) {e.printStackTrace();}- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {e.printStackTrace();}s.close();diff --git a/source/net/yacy/kelondro/index/RowSet.java b/source/net/yacy/kelondro/index/RowSet.javaindex fb8807a92..1b3d8f860 100644--- a/source/net/yacy/kelondro/index/RowSet.java+++ b/source/net/yacy/kelondro/index/RowSet.java@@ -37,6 +37,7 @@ import java.util.TreeMap;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -57,7 +58,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,assert rowdef.objectOrder != null;}- public RowSet(final Row rowdef, final int objectCount) throws RowSpaceExceededException {+ public RowSet(final Row rowdef, final int objectCount) throws SpaceExceededException {super(rowdef, objectCount);assert rowdef.objectOrder != null;}@@ -78,7 +79,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,assert rowdef.objectOrder != null;}- public final static RowSet importRowSet(final byte[] b, final Row rowdef) throws RowSpaceExceededException {+ public final static RowSet importRowSet(final byte[] b, final Row rowdef) throws SpaceExceededException {assert b.length >= exportOverheadSize : "b.length = " + b.length;if (b.length < exportOverheadSize) return new RowSet(rowdef, 0);final int size = (int) NaturalOrder.decodeLong(b, 0, 4);@@ -89,15 +90,15 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,if (orderbound < 0) return new RowSet(rowdef, 0); // errorfinal long alloc = ((long) size) * ((long) rowdef.objectsize);assert alloc <= Integer.MAX_VALUE : "alloc = " + alloc;- if (alloc > Integer.MAX_VALUE) throw new RowSpaceExceededException((int) alloc, "importRowSet: alloc > Integer.MAX_VALUE");+ if (alloc > Integer.MAX_VALUE) throw new SpaceExceededException((int) alloc, "importRowSet: alloc > Integer.MAX_VALUE");assert alloc == b.length - exportOverheadSize;- if (alloc != b.length - exportOverheadSize) throw new RowSpaceExceededException((int) alloc, "importRowSet: alloc != b.length - exportOverheadSize");+ if (alloc != b.length - exportOverheadSize) throw new SpaceExceededException((int) alloc, "importRowSet: alloc != b.length - exportOverheadSize");MemoryControl.request((int) alloc, true);final byte[] chunkcache;try {chunkcache = new byte[(int) alloc];} catch (final OutOfMemoryError e) {- throw new RowSpaceExceededException((int) alloc, "importRowSet: OutOfMemoryError");+ throw new SpaceExceededException((int) alloc, "importRowSet: OutOfMemoryError");}//assert b.length - exportOverheadSize == size * rowdef.objectsize : "b.length = " + b.length + ", size * rowdef.objectsize = " + size * rowdef.objectsize;if (b.length - exportOverheadSize != alloc) {@@ -161,10 +162,10 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public final boolean put(final Row.Entry entry) throws RowSpaceExceededException {+ public final boolean put(final Row.Entry entry) throws SpaceExceededException {assert (entry != null);final byte[] key = entry.getPrimaryKeyBytes();assert (key != null);@@ -184,7 +185,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,}@Override- public final Row.Entry replace(final Row.Entry entry) throws RowSpaceExceededException {+ public final Row.Entry replace(final Row.Entry entry) throws SpaceExceededException {assert (entry != null);final byte[] key = entry.getPrimaryKeyBytes();assert (key != null);@@ -210,7 +211,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,}}- public final synchronized long inc(final byte[] key, final int col, final long add, final Row.Entry initrow) throws RowSpaceExceededException {+ public final synchronized long inc(final byte[] key, final int col, final long add, final Row.Entry initrow) throws SpaceExceededException {assert key.length == this.rowdef.primaryKeyLength;final int index = find(key, 0);if (index >= 0) {@@ -484,9 +485,9 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,* After this merge, none of the input collections should be used, because they can be altered* @param c* @return- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public final RowSet merge(final RowSet c) throws RowSpaceExceededException {+ public final RowSet merge(final RowSet c) throws SpaceExceededException {assert c != null;return mergeEnum(this, c);}@@ -496,9 +497,9 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,* the current collection is not altered in any way, the returned collection is a new collection with copied content.* @param c* @return- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- protected final static RowSet mergeEnum(final RowCollection c0, final RowCollection c1) throws RowSpaceExceededException {+ protected final static RowSet mergeEnum(final RowCollection c0, final RowCollection c1) throws SpaceExceededException {assert c0.rowdef == c1.rowdef : c0.rowdef.toString() + " != " + c1.rowdef.toString();final RowSet r = new RowSet(c0.rowdef, c0.size() + c1.size());try {@@ -588,13 +589,13 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,for (final String element : test)try {d.add(element.getBytes());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {e.printStackTrace();}for (final String element : test)try {d.add(element.getBytes());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {e.printStackTrace();}d.sort();@@ -631,7 +632,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,try {c.put(row.newEntry(new byte[][]{w.getBytes(), "000".getBytes()}));//c.add(w.getBytes());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {e.printStackTrace();}if (k % 10000 == 0)@@ -664,7 +665,7 @@ public class RowSet extends RowCollection implements Index, Iterable<Row.Entry>,key = randomHash(random);try {c.put(c.rowdef.newEntry(new byte[][]{key, key}));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {e.printStackTrace();}if (i % 1000 == 0) {diff --git a/source/net/yacy/kelondro/index/RowSpaceExceededException.java b/source/net/yacy/kelondro/index/RowSpaceExceededException.javadeleted file mode 100644index 5d741d1cf..000000000--- a/source/net/yacy/kelondro/index/RowSpaceExceededException.java+++ /dev/null@@ -1,72 +0,0 @@-// RowSpaceExceededException-// (C) 2009 by Michael Peter Christen; [email protected], Frankfurt a. M., Germany-// first published 06.12.2009 on http://yacy.net-//-// This is a part of YaCy, a peer-to-peer based web search engine-//-// $LastChangedDate$-// $LastChangedRevision$-// $LastChangedBy$-//-// LICENSE-//-// This program is free software; you can redistribute it and/or modify-// it under the terms of the GNU General Public License as published by-// the Free Software Foundation; either version 2 of the License, or-// (at your option) any later version.-//-// This program is distributed in the hope that it will be useful,-// but WITHOUT ANY WARRANTY; without even the implied warranty of-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the-// GNU General Public License for more details.-//-// You should have received a copy of the GNU General Public License-// along with this program; if not, write to the Free Software-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA--package net.yacy.kelondro.index;--import java.util.Date;--import net.yacy.kelondro.util.MemoryControl;--public class RowSpaceExceededException extends Exception {-- private static final long serialVersionUID = 9059516027929222151L;-- private final String forUsage;- private final long neededRAM, availableRAM, time;-- public RowSpaceExceededException(final long neededRAM, final String forUsage) {- super(Long.toString(neededRAM) + " bytes needed for " + forUsage + ": " + MemoryControl.available() + " free at " + (new Date()).toString());- this.time = System.currentTimeMillis();- this.availableRAM = MemoryControl.available();- this.neededRAM = neededRAM;- this.forUsage = forUsage;- }-- public RowSpaceExceededException(final long neededRAM, final String forUsage, final Throwable t) {- super(Long.toString(neededRAM) + " bytes needed for " + forUsage + ": " + MemoryControl.available() + " free at " + (new Date()).toString(), t);- this.time = System.currentTimeMillis();- this.availableRAM = MemoryControl.available();- this.neededRAM = neededRAM;- this.forUsage = forUsage;- }-- public String getUsage() {- return forUsage;- }-- public long getNeededRAM() {- return neededRAM;- }-- public long getAvailableRAM() {- return availableRAM;- }-- public long getTime() {- return time;- }--}diff --git a/source/net/yacy/kelondro/order/NaturalOrder.java b/source/net/yacy/kelondro/order/NaturalOrder.javaindex 4f18b845a..b8deb1a2f 100644--- a/source/net/yacy/kelondro/order/NaturalOrder.java+++ b/source/net/yacy/kelondro/order/NaturalOrder.java@@ -33,7 +33,8 @@ import java.util.Iterator;import net.yacy.cora.order.AbstractOrder;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.Order;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;+import net.yacy.kelondro.index.RowHandleSet;public final class NaturalOrder extends AbstractOrder<byte[]> implements ByteOrder, Comparator<byte[]>, Cloneable, Serializable {@@ -46,7 +47,7 @@ public final class NaturalOrder extends AbstractOrder<byte[]> implements ByteOrd}public HandleSet getHandleSet(final int keylength, final int space) {- return new HandleSet(keylength, this, space);+ return new RowHandleSet(keylength, this, space);}@Overridediff --git a/source/net/yacy/kelondro/rwi/AbstractIndex.java b/source/net/yacy/kelondro/rwi/AbstractIndex.javaindex f6a9108bb..c1b31e754 100644--- a/source/net/yacy/kelondro/rwi/AbstractIndex.java+++ b/source/net/yacy/kelondro/rwi/AbstractIndex.java@@ -33,9 +33,9 @@ import java.util.TreeMap;import java.util.TreeSet;import net.yacy.cora.order.Order;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;@@ -52,10 +52,10 @@ public abstract class AbstractIndex <ReferenceType extends Reference> implements* merge this index with another index* @param otherIndex* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public void merge(final Index<ReferenceType> otherIndex) throws IOException, RowSpaceExceededException {+ public void merge(final Index<ReferenceType> otherIndex) throws IOException, SpaceExceededException {byte[] term;for (final ReferenceContainer<ReferenceType> otherContainer: otherIndex) {term = otherContainer.getTermHash();@@ -174,9 +174,9 @@ public abstract class AbstractIndex <ReferenceType extends Reference> implements* @param urlselection* @param maxDistance the maximum distance that the words in the result may have* @return ReferenceContainer the join result- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public ReferenceContainer<ReferenceType> searchJoin(final HandleSet wordHashes, final HandleSet urlselection, final int maxDistance) throws RowSpaceExceededException {+ public ReferenceContainer<ReferenceType> searchJoin(final HandleSet wordHashes, final HandleSet urlselection, final int maxDistance) throws SpaceExceededException {// first check if there is any entry that has no match;// this uses only operations in ramfor (final byte[] wordHash: wordHashes) {@@ -212,7 +212,7 @@ public abstract class AbstractIndex <ReferenceType extends Reference> implementsfinal HandleSet excludeHashes,final HandleSet urlselection,final ReferenceFactory<ReferenceType> termFactory,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {return new TermSearch<ReferenceType>(this, queryHashes, excludeHashes, urlselection, termFactory, maxDistance);}diff --git a/source/net/yacy/kelondro/rwi/Index.java b/source/net/yacy/kelondro/rwi/Index.javaindex c307efad7..fe375f2b9 100644--- a/source/net/yacy/kelondro/rwi/Index.java+++ b/source/net/yacy/kelondro/rwi/Index.java@@ -35,9 +35,9 @@ import java.util.TreeSet;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.sorting.Rating;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;public interface Index <ReferenceType extends Reference> extends Iterable<ReferenceContainer<ReferenceType>> {@@ -52,7 +52,7 @@ public interface Index <ReferenceType extends Reference> extends Iterable<Refere* merge this index with another index* @param otherIndex*/- public void merge(Index<ReferenceType> otherIndex) throws IOException, RowSpaceExceededException;+ public void merge(Index<ReferenceType> otherIndex) throws IOException, SpaceExceededException;/*** add references to the reverse index@@ -61,9 +61,9 @@ public interface Index <ReferenceType extends Reference> extends Iterable<Refere* reference to be stored, then the old and the new references are merged* @param newEntries the References to be merged with existing references* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public void add(ReferenceContainer<ReferenceType> newEntries) throws IOException, RowSpaceExceededException;+ public void add(ReferenceContainer<ReferenceType> newEntries) throws IOException, SpaceExceededException;/*** add a single reference to the reverse index@@ -73,9 +73,9 @@ public interface Index <ReferenceType extends Reference> extends Iterable<Refere* @param termHash* @param entry* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public void add(final byte[] termHash, final ReferenceType entry) throws IOException, RowSpaceExceededException;+ public void add(final byte[] termHash, final ReferenceType entry) throws IOException, SpaceExceededException;/*** check if there are references stored to the given word hashdiff --git a/source/net/yacy/kelondro/rwi/IndexCell.java b/source/net/yacy/kelondro/rwi/IndexCell.javaindex e46faa545..db9cbda4a 100644--- a/source/net/yacy/kelondro/rwi/IndexCell.java+++ b/source/net/yacy/kelondro/rwi/IndexCell.java@@ -37,9 +37,10 @@ import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.order.Order;import net.yacy.cora.sorting.Rating;import net.yacy.cora.storage.ComparableARC;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.URIMetadataRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.MergeIterator;import net.yacy.kelondro.util.MemoryControl;@@ -224,17 +225,17 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu/*** add entries to the cell: this adds the new entries always to the RAM part, never to BLOBs* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public void add(final ReferenceContainer<ReferenceType> newEntries) throws IOException, RowSpaceExceededException {+ public void add(final ReferenceContainer<ReferenceType> newEntries) throws IOException, SpaceExceededException {try {this.ram.add(newEntries);final long t = System.currentTimeMillis();if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < t || this.lastDump + dumpCycle < t) {EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);this.ram.add(newEntries);}@@ -242,14 +243,14 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu}@Override- public void add(final byte[] termHash, final ReferenceType entry) throws IOException, RowSpaceExceededException {+ public void add(final byte[] termHash, final ReferenceType entry) throws IOException, SpaceExceededException {try {this.ram.add(termHash, entry);final long t = System.currentTimeMillis();if (this.ram.size() % 1000 == 0 || this.lastCleanup + cleanupCycle < t || this.lastDump + dumpCycle < t) {EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {EventTracker.update(EventTracker.EClass.WORDCACHE, Long.valueOf(this.ram.size()), true);this.ram.add(termHash, entry);}@@ -311,18 +312,18 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBuReferenceContainer<ReferenceType> c1 = null;try {c1 = this.array.get(termHash);- } catch (final RowSpaceExceededException e2) {+ } catch (final SpaceExceededException e2) {Log.logException(e2);}ReferenceContainer<ReferenceType> result = null;if (c0 != null && c1 != null) {try {result = c1.merge(c0);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// try to free some ramtry {result = c1.merge(c0);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// go silently over the problemresult = (c1.size() > c0.size()) ? c1: c0;}@@ -352,7 +353,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBuReferenceContainer<ReferenceType> c1 = null;try {c1 = this.array.get(termHash);- } catch (final RowSpaceExceededException e2) {+ } catch (final SpaceExceededException e2) {Log.logException(e2);}if (c1 != null) {@@ -363,11 +364,11 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBuif (c0 == null) return c1;try {return c1.merge(c0);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {// try to free some ramtry {return c1.merge(c0);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {// go silently over the problemreturn (c1.size() > c0.size()) ? c1: c0;}@@ -380,7 +381,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBuReferenceContainer<ReferenceType> c1 = null;try {c1 = this.array.get(termHash);- } catch (final RowSpaceExceededException e2) {+ } catch (final SpaceExceededException e2) {Log.logException(e2);}if (c1 != null) {@@ -397,11 +398,11 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBur = this.removeDelayedURLs.get(termHash);}if (r == null) {- r = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ r = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);}try {r.putAll(urlHashes);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {remove(termHash, urlHashes);} catch (final IOException e1) {}return;}@@ -417,11 +418,11 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBur = this.removeDelayedURLs.get(termHash);}if (r == null) {- r = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ r = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);}try {r.put(urlHashBytes);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {remove(termHash, urlHashBytes);} catch (final IOException e1) {}return;}@@ -432,9 +433,9 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu@Overridepublic void removeDelayed() throws IOException {- final HandleSet words = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0); // a set of url hashes where a worker thread tried to work on, but failed.+ final HandleSet words = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0); // a set of url hashes where a worker thread tried to work on, but failed.synchronized (this.removeDelayedURLs) {- for (final byte[] b: this.removeDelayedURLs.keySet()) try {words.put(b);} catch (final RowSpaceExceededException e) {}+ for (final byte[] b: this.removeDelayedURLs.keySet()) try {words.put(b);} catch (final SpaceExceededException e) {}}synchronized (this.removeDelayedURLs) {@@ -461,7 +462,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu//final long am = this.array.mem();try {reduced = this.array.reduce(termHash, new RemoveReducer<ReferenceType>(urlHashes));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {reduced = 0;Log.logWarning("IndexCell", "not possible to remove urlHashes from a RWI because of too low memory. Remove was not applied. Please increase RAM assignment");}@@ -477,7 +478,7 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu//final long am = this.array.mem();try {reduced = this.array.reduce(termHash, new RemoveReducer<ReferenceType>(urlHashBytes));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {reduced = 0;Log.logWarning("IndexCell", "not possible to remove urlHashes from a RWI because of too low memory. Remove was not applied. Please increase RAM assignment");}@@ -494,10 +495,10 @@ public final class IndexCell<ReferenceType extends Reference> extends AbstractBu}public RemoveReducer(final byte[] urlHashBytes) {- this.urlHashes = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ this.urlHashes = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);try {this.urlHashes.put(urlHashBytes);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/kelondro/rwi/IndexReader.java b/source/net/yacy/kelondro/rwi/IndexReader.javaindex c1051e6fc..692b5974a 100644--- a/source/net/yacy/kelondro/rwi/IndexReader.java+++ b/source/net/yacy/kelondro/rwi/IndexReader.java@@ -27,7 +27,7 @@package net.yacy.kelondro.rwi;import net.yacy.cora.order.CloneableIterator;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;public interface IndexReader<ReferenceType extends Reference> {diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainer.java b/source/net/yacy/kelondro/rwi/ReferenceContainer.javaindex 3512ec89b..38acff343 100644--- a/source/net/yacy/kelondro/rwi/ReferenceContainer.java+++ b/source/net/yacy/kelondro/rwi/ReferenceContainer.java@@ -37,10 +37,10 @@ import java.util.TreeMap;import net.yacy.cora.document.ASCII;import net.yacy.cora.order.ByteOrder;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;@@ -75,7 +75,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetthis.lastTimeWrote = 0;}- public ReferenceContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final int objectCount) throws RowSpaceExceededException {+ public ReferenceContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final int objectCount) throws SpaceExceededException {super(factory.getRow(), objectCount);assert termHash == null || (termHash[2] != '@' && termHash.length == this.rowdef.primaryKeyLength);this.termHash = termHash;@@ -83,7 +83,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetthis.lastTimeWrote = 0;}- public ReferenceContainer<ReferenceType> topLevelClone() throws RowSpaceExceededException {+ public ReferenceContainer<ReferenceType> topLevelClone() throws SpaceExceededException {final ReferenceContainer<ReferenceType> newContainer = new ReferenceContainer<ReferenceType>(this.factory, this.termHash, size());newContainer.addAllUnique(this);return newContainer;@@ -94,7 +94,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetreturn new ReferenceContainer<ReferenceType>(factory, termHash);}- public static <ReferenceType extends Reference> ReferenceContainer<ReferenceType> emptyContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final int elementCount) throws RowSpaceExceededException {+ public static <ReferenceType extends Reference> ReferenceContainer<ReferenceType> emptyContainer(final ReferenceFactory<ReferenceType> factory, final byte[] termHash, final int elementCount) throws SpaceExceededException {assert termHash == null || (termHash[2] != '@' && termHash.length == factory.getRow().primaryKeyLength);return new ReferenceContainer<ReferenceType>(factory, termHash, elementCount);}@@ -112,29 +112,29 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetreturn this.termHash;}- public void add(final Reference entry) throws RowSpaceExceededException {+ public void add(final Reference entry) throws SpaceExceededException {// add without double-occurrence testassert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;this.addUnique(entry.toKelondroEntry());}- public ReferenceContainer<ReferenceType> merge(final ReferenceContainer<ReferenceType> c) throws RowSpaceExceededException {+ public ReferenceContainer<ReferenceType> merge(final ReferenceContainer<ReferenceType> c) throws SpaceExceededException {return new ReferenceContainer<ReferenceType>(this.factory, this.termHash, super.merge(c));}- public Reference replace(final Reference entry) throws RowSpaceExceededException {+ public Reference replace(final Reference entry) throws SpaceExceededException {assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;final Row.Entry r = super.replace(entry.toKelondroEntry());if (r == null) return null;return this.factory.produceSlow(r);}- public void put(final Reference entry) throws RowSpaceExceededException {+ public void put(final Reference entry) throws SpaceExceededException {assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;super.put(entry.toKelondroEntry());}- public boolean putRecent(final Reference entry) throws RowSpaceExceededException {+ public boolean putRecent(final Reference entry) throws SpaceExceededException {assert entry.toKelondroEntry().objectsize() == super.rowdef.objectsize;// returns true if the new entry was added, false if it already existedfinal Row.Entry oldEntryRow = this.replace(entry.toKelondroEntry());@@ -149,7 +149,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetreturn true;}- public int putAllRecent(final ReferenceContainer<ReferenceType> c) throws RowSpaceExceededException {+ public int putAllRecent(final ReferenceContainer<ReferenceType> c) throws SpaceExceededException {// adds all entries in c and checks every entry for double-occurrence// returns the number of new elementsif (c == null) return 0;@@ -276,7 +276,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSet}- public static Object mergeUnique(final Object a, final Object b) throws RowSpaceExceededException {+ public static Object mergeUnique(final Object a, final Object b) throws SpaceExceededException {if (a instanceof ReferenceContainer<?>) {final ReferenceContainer<?> c = (ReferenceContainer<?>) a;c.addAllUnique((ReferenceContainer<?>) b);@@ -306,7 +306,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetfinal ReferenceFactory<ReferenceType> factory,final Collection<ReferenceContainer<ReferenceType>> includeContainers,final Collection<ReferenceContainer<ReferenceType>> excludeContainers,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {// join a search result and return the joincount (number of pages after join)// since this is a conjunction we return an empty entity if any word is not known@@ -323,7 +323,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetpublic static <ReferenceType extends Reference> ReferenceContainer<ReferenceType> joinContainers(final ReferenceFactory<ReferenceType> factory,final Collection<ReferenceContainer<ReferenceType>> containers,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {// order entities by their sizefinal TreeMap<Long, ReferenceContainer<ReferenceType>> map = new TreeMap<Long, ReferenceContainer<ReferenceType>>();@@ -393,7 +393,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetfinal ReferenceFactory<ReferenceType> factory,final ReferenceContainer<ReferenceType> i1,final ReferenceContainer<ReferenceType> i2,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {if ((i1 == null) || (i2 == null)) return null;if (i1.isEmpty() || i2.isEmpty()) return null;@@ -415,7 +415,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetfinal ReferenceFactory<ReferenceType> factory,final ReferenceContainer<ReferenceType> small,final ReferenceContainer<ReferenceType> large,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {//System.out.println("DEBUG: JOIN METHOD BY TEST, maxdistance = " + maxDistance);assert small.rowdef.equals(large.rowdef) : "small = " + small.rowdef.toString() + "; large = " + large.rowdef.toString();final int keylength = small.rowdef.width(0);@@ -444,7 +444,7 @@ public class ReferenceContainer<ReferenceType extends Reference> extends RowSetfinal ReferenceFactory<ReferenceType> factory,final ReferenceContainer<ReferenceType> i1,final ReferenceContainer<ReferenceType> i2,- final int maxDistance) throws RowSpaceExceededException {+ final int maxDistance) throws SpaceExceededException {//System.out.println("DEBUG: JOIN METHOD BY ENUMERATION, maxdistance = " + maxDistance);assert i1.rowdef.equals(i2.rowdef) : "i1 = " + i1.rowdef.toString() + "; i2 = " + i2.rowdef.toString();final int keylength = i1.rowdef.width(0);diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.javaindex 66b234dd9..82cbe8e63 100644--- a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java+++ b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java@@ -32,13 +32,14 @@ import java.util.Iterator;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.sorting.Rating;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.ArrayStack;import net.yacy.kelondro.blob.BLOB;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleMap;import net.yacy.kelondro.index.Row;+import net.yacy.kelondro.index.RowHandleMap;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.search.index.Segment;@@ -305,9 +306,9 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {* @param key* @return the indexContainer if one exist, null otherwise* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public ReferenceContainer<ReferenceType> get(final byte[] termHash) throws IOException, RowSpaceExceededException {+ public ReferenceContainer<ReferenceType> get(final byte[] termHash) throws IOException, SpaceExceededException {final long timeout = System.currentTimeMillis() + METHOD_MAXRUNTIME;final Iterator<byte[]> entries = this.array.getAll(termHash).iterator();if (entries == null || !entries.hasNext()) return null;@@ -377,7 +378,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {this.array.delete(termHash);}- public int reduce(final byte[] termHash, final ContainerReducer<ReferenceType> reducer) throws IOException, RowSpaceExceededException {+ public int reduce(final byte[] termHash, final ContainerReducer<ReferenceType> reducer) throws IOException, SpaceExceededException {return this.array.reduce(termHash, new BLOBReducer(termHash, reducer));}@@ -392,7 +393,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {}@Override- public byte[] rewrite(final byte[] b) throws RowSpaceExceededException {+ public byte[] rewrite(final byte[] b) throws SpaceExceededException {if (b == null) return null;final ReferenceContainer<ReferenceType> c = this.rewriter.reduce(new ReferenceContainer<ReferenceType>(ReferenceContainerArray.this.factory, this.wordHash, RowSet.importRowSet(b, ReferenceContainerArray.this.factory.getRow())));if (c == null) return null;@@ -448,10 +449,10 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {final File heapLocation,final ReferenceFactory<ReferenceType> factory,final ByteOrder termOrder,- final Row payloadrow) throws IOException, RowSpaceExceededException {+ final Row payloadrow) throws IOException, SpaceExceededException {System.out.println("CELL REFERENCE COLLECTION startup");- final HandleMap references = new HandleMap(payloadrow.primaryKeyLength, termOrder, 4, 1000000, heapLocation.getAbsolutePath());+ final HandleMap references = new RowHandleMap(payloadrow.primaryKeyLength, termOrder, 4, 1000000, heapLocation.getAbsolutePath());final String[] files = heapLocation.list();for (final String f: files) {if (f.length() < 22 || !f.startsWith(Segment.termIndexName) || !f.endsWith(".blob")) continue;diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java b/source/net/yacy/kelondro/rwi/ReferenceContainerCache.javaindex c923e1769..70bed64a3 100644--- a/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java+++ b/source/net/yacy/kelondro/rwi/ReferenceContainerCache.java@@ -39,11 +39,11 @@ import java.util.concurrent.ConcurrentHashMap;import net.yacy.cora.order.ByteOrder;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.sorting.Rating;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.HeapWriter;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.FileUtils;@@ -154,7 +154,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> extedump.add(term, container.exportCollection());} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}if (destructive) container.clear(); // this memory is not needed any more@@ -285,7 +285,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exteif (this.excludePrivate && Word.isPrivate(this.latestTermHash)) continue;try {return c.topLevelClone();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return null;}@@ -302,7 +302,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exteif (this.excludePrivate && Word.isPrivate(this.latestTermHash)) continue;try {return c.topLevelClone();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return null;}@@ -446,7 +446,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte}}return c1;- } catch (final RowSpaceExceededException e2) {+ } catch (final SpaceExceededException e2) {Log.logException(e2);}return null;@@ -541,7 +541,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> extepublic void removeDelayed() {}@Override- public void add(final ReferenceContainer<ReferenceType> container) throws RowSpaceExceededException {+ public void add(final ReferenceContainer<ReferenceType> container) throws SpaceExceededException {// this puts the entries into the cacheif (this.cache == null || container == null || container.isEmpty()) return;@@ -565,7 +565,7 @@ public final class ReferenceContainerCache<ReferenceType extends Reference> exte}@Override- public void add(final byte[] termHash, final ReferenceType newEntry) throws RowSpaceExceededException {+ public void add(final byte[] termHash, final ReferenceType newEntry) throws SpaceExceededException {assert this.cache != null;if (this.cache == null) return;final ByteArray tha = new ByteArray(termHash);diff --git a/source/net/yacy/kelondro/rwi/ReferenceIterator.java b/source/net/yacy/kelondro/rwi/ReferenceIterator.javaindex 5bb7fa6ad..a605ecc70 100644--- a/source/net/yacy/kelondro/rwi/ReferenceIterator.java+++ b/source/net/yacy/kelondro/rwi/ReferenceIterator.java@@ -32,9 +32,9 @@ import java.util.Map;import net.yacy.cora.document.UTF8;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.HeapReader;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.LookAheadIterator;@@ -71,7 +71,7 @@ public class ReferenceIterator <ReferenceType extends Reference> extends LookAhecontinue; // thats a fail but not as REALLY bad if the whole method would crash here}return new ReferenceContainer<ReferenceType>(this.factory, entry.getKey(), row);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logSevere("ReferenceIterator", "lost entry '" + UTF8.String(entry.getKey()) + "' because of too low memory: " + e.toString());continue;} catch (final Throwable e) {diff --git a/source/net/yacy/kelondro/rwi/TermSearch.java b/source/net/yacy/kelondro/rwi/TermSearch.javaindex 2211536c9..11b55c2fe 100644--- a/source/net/yacy/kelondro/rwi/TermSearch.java+++ b/source/net/yacy/kelondro/rwi/TermSearch.java@@ -10,7 +10,7 @@// $LastChangedBy$//// LICENSE-//+//// This program is free software; you can redistribute it and/or modify// it under the terms of the GNU General Public License as published by// the Free Software Foundation; either version 2 of the License, or@@ -29,8 +29,8 @@ package net.yacy.kelondro.rwi;import java.util.TreeMap;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.order.Base64Order;@@ -38,43 +38,43 @@ public class TermSearch <ReferenceType extends Reference> {private final ReferenceContainer<ReferenceType> joinResult;TreeMap<byte[], ReferenceContainer<ReferenceType>> inclusionContainers;-+public TermSearch(Index<ReferenceType> base,final HandleSet queryHashes,final HandleSet excludeHashes,final HandleSet urlselection,ReferenceFactory<ReferenceType> termFactory,- int maxDistance) throws RowSpaceExceededException {-+ int maxDistance) throws SpaceExceededException {+this.inclusionContainers =(queryHashes.isEmpty()) ?new TreeMap<byte[], ReferenceContainer<ReferenceType>>(Base64Order.enhancedCoder) :base.searchConjunction(queryHashes, urlselection);-- if (!inclusionContainers.isEmpty() &&- (inclusionContainers.size() < queryHashes.size()))- inclusionContainers = new TreeMap<byte[], ReferenceContainer<ReferenceType>>(Base64Order.enhancedCoder); // prevent that only a subset is returned-++ if (!this.inclusionContainers.isEmpty() &&+ (this.inclusionContainers.size() < queryHashes.size()))+ this.inclusionContainers = new TreeMap<byte[], ReferenceContainer<ReferenceType>>(Base64Order.enhancedCoder); // prevent that only a subset is returned+TreeMap<byte[], ReferenceContainer<ReferenceType>> exclusionContainers =- (inclusionContainers.isEmpty()) ?+ (this.inclusionContainers.isEmpty()) ?new TreeMap<byte[], ReferenceContainer<ReferenceType>>(Base64Order.enhancedCoder) :base.searchConjunction(excludeHashes, urlselection);-+// join and exclude the resultthis.joinResult = ReferenceContainer.joinExcludeContainers(termFactory,- inclusionContainers.values(),+ this.inclusionContainers.values(),exclusionContainers.values(),- maxDistance);+ maxDistance);}-+public ReferenceContainer<ReferenceType> joined() {return this.joinResult;}-+public TreeMap<byte[], ReferenceContainer<ReferenceType>> inclusion() {return this.inclusionContainers;}-+}diff --git a/source/net/yacy/kelondro/table/Relations.java b/source/net/yacy/kelondro/table/Relations.javaindex 9cb056e79..a0ac5113f 100644--- a/source/net/yacy/kelondro/table/Relations.java+++ b/source/net/yacy/kelondro/table/Relations.java@@ -32,9 +32,9 @@ import java.util.HashMap;import net.yacy.cora.document.UTF8;import net.yacy.cora.util.NumberTools;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;@@ -81,7 +81,7 @@ public class Relations {return tablename + "-" + keysize + "-" + payloadsize + ".eco";}- public void declareRelation(final String name, final int keysize, final int payloadsize) throws RowSpaceExceededException {+ public void declareRelation(final String name, final int keysize, final int payloadsize) throws SpaceExceededException {// try to get the relation from the relation-cachefinal Index relation = this.relations.get(name);if (relation != null) return;@@ -96,7 +96,7 @@ public class Relations {Index table;try {table = new Table(new File(this.baseDir, list[i]), row, 1024*1024, 0, this.useTailCache, this.exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {table = new Table(new File(this.baseDir, list[i]), row, 0, 0, false, this.exceed134217727, true);}this.relations.put(name, table);@@ -108,13 +108,13 @@ public class Relations {Index table;try {table = new Table(new File(this.baseDir, targetfilename), row, 1024*1024, 0, this.useTailCache, this.exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {table = new Table(new File(this.baseDir, targetfilename), row, 0, 0, false, this.exceed134217727, true);}this.relations.put(name, table);}- public Index getRelation(final String name) throws RowSpaceExceededException {+ public Index getRelation(final String name) throws SpaceExceededException {// try to get the relation from the relation-cachefinal Index relation = this.relations.get(name);if (relation != null) return relation;@@ -126,7 +126,7 @@ public class Relations {Index table;try {table = new Table(new File(this.baseDir, element), row, 1024*1024, 0, this.useTailCache, this.exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {table = new Table(new File(this.baseDir, element), row, 0, 0, false, this.exceed134217727, true);}this.relations.put(name, table);@@ -137,13 +137,13 @@ public class Relations {return null;}- public String putRelation(final String name, final String key, final String value) throws IOException, RowSpaceExceededException {+ public String putRelation(final String name, final String key, final String value) throws IOException, SpaceExceededException {final byte[] r = putRelation(name, UTF8.getBytes(key), UTF8.getBytes(value));if (r == null) return null;return UTF8.String(r);}- public byte[] putRelation(final String name, final byte[] key, final byte[] value) throws IOException, RowSpaceExceededException {+ public byte[] putRelation(final String name, final byte[] key, final byte[] value) throws IOException, SpaceExceededException {final Index table = getRelation(name);if (table == null) return null;final Row.Entry entry = table.row().newEntry();@@ -156,13 +156,13 @@ public class Relations {return oldentry.getColBytes(3, true);}- public String getRelation(final String name, final String key) throws IOException, RowSpaceExceededException {+ public String getRelation(final String name, final String key) throws IOException, SpaceExceededException {final byte[] r = getRelation(name, UTF8.getBytes(key));if (r == null) return null;return UTF8.String(r);}- public byte[] getRelation(final String name, final byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] getRelation(final String name, final byte[] key) throws IOException, SpaceExceededException {final Index table = getRelation(name);if (table == null) return null;final Row.Entry entry = table.get(key, false);@@ -170,13 +170,13 @@ public class Relations {return entry.getColBytes(3, true);}- public boolean hasRelation(final String name, final byte[] key) throws RowSpaceExceededException {+ public boolean hasRelation(final String name, final byte[] key) throws SpaceExceededException {final Index table = getRelation(name);if (table == null) return false;return table.has(key);}- public byte[] removeRelation(final String name, final byte[] key) throws IOException, RowSpaceExceededException {+ public byte[] removeRelation(final String name, final byte[] key) throws IOException, SpaceExceededException {final Index table = getRelation(name);if (table == null) return null;final Row.Entry entry = table.remove(key);@@ -193,7 +193,7 @@ public class Relations {r.putRelation(table1, "abcdefg", "eineintrag");} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/kelondro/table/SplitTable.java b/source/net/yacy/kelondro/table/SplitTable.javaindex 9400b627a..4bfb9a867 100644--- a/source/net/yacy/kelondro/table/SplitTable.java+++ b/source/net/yacy/kelondro/table/SplitTable.java@@ -42,14 +42,15 @@ import java.util.TreeMap;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.order.CloneableIterator;import net.yacy.cora.order.Order;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.ArrayStack;import net.yacy.kelondro.index.Cache;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.index.RowCollection;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.MergeIterator;import net.yacy.kelondro.order.StackIterator;@@ -115,10 +116,10 @@ public class SplitTable implements Index, Iterable<Row.Entry> {@Overridepublic final byte[] smallestKey() {- final HandleSet keysort = new HandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.tables.size());+ final HandleSet keysort = new RowHandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.tables.size());for (final Index oi: this.tables.values()) try {keysort.put(oi.smallestKey());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return keysort.smallestKey();@@ -126,10 +127,10 @@ public class SplitTable implements Index, Iterable<Row.Entry> {@Overridepublic final byte[] largestKey() {- final HandleSet keysort = new HandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.tables.size());+ final HandleSet keysort = new RowHandleSet(this.rowdef.primaryKeyLength, this.rowdef.objectOrder, this.tables.size());for (final Index oi: this.tables.values()) try {keysort.put(oi.largestKey());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}return keysort.largestKey();@@ -215,10 +216,10 @@ public class SplitTable implements Index, Iterable<Row.Entry> {Table table;try {table = new Table(f, this.rowdef, EcoFSBufferSize, 0, this.useTailCache, this.exceed134217727, false);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {table = new Table(f, this.rowdef, 0, 0, false, this.exceed134217727, false);- } catch (final RowSpaceExceededException ee) {+ } catch (final SpaceExceededException ee) {Log.logSevere("SplitTable", "Table " + f.toString() + " cannot be initialized: " + ee.getMessage(), ee);continue maxfind;}@@ -343,10 +344,10 @@ public class SplitTable implements Index, Iterable<Row.Entry> {Table table = null;try {table = new Table(f, this.rowdef, EcoFSBufferSize, 0, this.useTailCache, this.exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {table = new Table(f, this.rowdef, 0, 0, false, this.exceed134217727, true);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {Log.logException(e1);}}@@ -376,7 +377,7 @@ public class SplitTable implements Index, Iterable<Row.Entry> {}@Override- public Row.Entry replace(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public Row.Entry replace(final Row.Entry row) throws IOException, SpaceExceededException {assert row.objectsize() <= this.rowdef.objectsize;Index keeper = keeperOf(row.getPrimaryKeyBytes());if (keeper != null) synchronized (this) { // avoid concurrent IO from different methods@@ -395,10 +396,10 @@ public class SplitTable implements Index, Iterable<Row.Entry> {* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public boolean put(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public boolean put(final Row.Entry row) throws IOException, SpaceExceededException {assert row.objectsize() <= this.rowdef.objectsize;final byte[] key = row.getPrimaryKeyBytes();if (this.tables == null) return true;@@ -427,7 +428,7 @@ public class SplitTable implements Index, Iterable<Row.Entry> {}@Override- public void addUnique(final Row.Entry row) throws IOException, RowSpaceExceededException {+ public void addUnique(final Row.Entry row) throws IOException, SpaceExceededException {assert row.objectsize() <= this.rowdef.objectsize;Index keeper = (this.current == null) ? null : this.tables.get(this.current);synchronized (this) {@@ -438,7 +439,7 @@ public class SplitTable implements Index, Iterable<Row.Entry> {}@Override- public List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException {+ public List<RowCollection> removeDoubles() throws IOException, SpaceExceededException {final Iterator<Index> i = this.tables.values().iterator();final List<RowCollection> report = new ArrayList<RowCollection>();while (i.hasNext()) {diff --git a/source/net/yacy/kelondro/table/Table.java b/source/net/yacy/kelondro/table/Table.javaindex ee92b70dd..3ada98225 100644--- a/source/net/yacy/kelondro/table/Table.java+++ b/source/net/yacy/kelondro/table/Table.java@@ -39,14 +39,15 @@ import java.util.TreeMap;import java.util.TreeSet;import net.yacy.cora.order.CloneableIterator;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Column;-import net.yacy.kelondro.index.HandleMap;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.Row.Entry;import net.yacy.kelondro.index.RowCollection;+import net.yacy.kelondro.index.RowHandleMap;import net.yacy.kelondro.index.RowSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.io.BufferedRecords;import net.yacy.kelondro.io.Records;import net.yacy.kelondro.logging.Log;@@ -87,7 +88,7 @@ public class Table implements Index, Iterable<Row.Entry> {final int initialSpace,boolean useTailCache,final boolean exceed134217727,- final boolean warmUp) throws RowSpaceExceededException {+ final boolean warmUp) throws SpaceExceededException {this.rowdef = rowdef;this.buffersize = buffersize;@@ -126,7 +127,7 @@ public class Table implements Index, Iterable<Row.Entry> {try {this.table = ((exceed134217727 || neededRAM4table < maxarraylength) &&useTailCache && MemoryControl.request(neededRAM4table, true)) ? new RowSet(this.taildef, records) : null;- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {this.table = null;} catch (Throwable e) {this.table = null;@@ -141,8 +142,8 @@ public class Table implements Index, Iterable<Row.Entry> {this.table = null; System.gc();Log.logSevere("TABLE", tablefile.getName() + ": RAM after releasing the table: " + (MemoryControl.available() / 1024L / 1024L) + "MB");}- this.index = new HandleMap(rowdef.primaryKeyLength, rowdef.objectOrder, 4, records, tablefile.getAbsolutePath());- final HandleMap errors = new HandleMap(rowdef.primaryKeyLength, NaturalOrder.naturalOrder, 4, records, tablefile.getAbsolutePath() + ".errors");+ this.index = new RowHandleMap(rowdef.primaryKeyLength, rowdef.objectOrder, 4, records, tablefile.getAbsolutePath());+ final RowHandleMap errors = new RowHandleMap(rowdef.primaryKeyLength, NaturalOrder.naturalOrder, 4, records, tablefile.getAbsolutePath() + ".errors");Log.logInfo("TABLE", tablefile + ": TABLE " + tablefile.toString() + " has table copy " + ((this.table == null) ? "DISABLED" : "ENABLED"));// read all elements from the file into the copy table@@ -178,7 +179,7 @@ public class Table implements Index, Iterable<Row.Entry> {// write the tail into the tabletry {this.table.addUnique(this.taildef.newEntry(record, rowdef.primaryKeyLength, true));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;break;}@@ -201,10 +202,10 @@ public class Table implements Index, Iterable<Row.Entry> {final int errorc = errors.size();int errorcc = 0;int idx;- for (final Entry entry: errors) {- idx = (int) entry.getColLong(1);+ for (final Map.Entry<byte[], Long> entry: errors) {+ idx = (int) entry.getValue().longValue();removeInFile(idx);- key = entry.getPrimaryKeyBytes();+ key = entry.getKey();if (key == null) continue;Log.logWarning("Table", "removing not well-formed entry " + idx + " with key: " + NaturalOrder.arrayList(key, 0, key.length) + ", " + errorcc++ + "/" + errorc);}@@ -260,7 +261,7 @@ public class Table implements Index, Iterable<Row.Entry> {delpos.remove(top);removeInFile(top.intValue());}- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logSevere("Table", "", e);} catch (final IOException e) {Log.logSevere("Table", "", e);@@ -332,8 +333,8 @@ public class Table implements Index, Iterable<Row.Entry> {final HashMap<StatKeys, String> map = new HashMap<StatKeys, String>(8);if (this.index == null) return map; // possibly closed or beeing closedmap.put(StatKeys.tableSize, Integer.toString(this.index.size()));- map.put(StatKeys.tableKeyChunkSize, Integer.toString(this.index.row().objectsize));- map.put(StatKeys.tableKeyMem, Integer.toString(this.index.row().objectsize * this.index.size()));+ map.put(StatKeys.tableKeyChunkSize, (this.index instanceof RowHandleMap) ? Integer.toString(((RowHandleMap) this.index).row().objectsize) : "-1");+ map.put(StatKeys.tableKeyMem, (this.index instanceof RowHandleMap) ? Integer.toString(((RowHandleMap) this.index).row().objectsize * this.index.size()) : "-1");map.put(StatKeys.tableValueChunkSize, (this.table == null) ? "0" : Integer.toString(this.table.row().objectsize));map.put(StatKeys.tableValueMem, (this.table == null) ? "0" : Integer.toString(this.table.row().objectsize * this.table.size()));return map;@@ -357,13 +358,13 @@ public class Table implements Index, Iterable<Row.Entry> {}@Override- public synchronized void addUnique(final Entry row) throws IOException, RowSpaceExceededException {+ public synchronized void addUnique(final Entry row) throws IOException, SpaceExceededException {assert this.file.size() == this.index.size() : "file.size() = " + this.file.size() + ", index.size() = " + this.index.size();assert this.table == null || this.table.size() == this.index.size() : "table.size() = " + this.table.size() + ", index.size() = " + this.index.size();final int i = (int) this.file.size();try {this.index.putUnique(row.getPrimaryKeyBytes(), i);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e; // in case the table is not used, there is no help herethis.table = null;// try again with less memory@@ -374,7 +375,7 @@ public class Table implements Index, Iterable<Row.Entry> {assert this.table.size() == i;try {this.table.addUnique(this.taildef.newEntry(rowbytes, this.rowdef.primaryKeyLength, true));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;}if (abandonTable()) this.table = null;@@ -383,12 +384,12 @@ public class Table implements Index, Iterable<Row.Entry> {assert this.file.size() == this.index.size() : "file.size() = " + this.file.size() + ", index.size() = " + this.index.size();}- public synchronized void addUnique(final List<Entry> rows) throws IOException, RowSpaceExceededException {+ public synchronized void addUnique(final List<Entry> rows) throws IOException, SpaceExceededException {assert this.file.size() == this.index.size() : "file.size() = " + this.file.size() + ", index.size() = " + this.index.size();for (final Entry entry: rows) {try {addUnique(entry);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e;this.table = null;addUnique(entry);@@ -398,14 +399,14 @@ public class Table implements Index, Iterable<Row.Entry> {}/**- * @throws RowSpaceExceededException+ * @throws SpaceExceededException* remove double-entries from the table* this process calls the underlying removeDoubles() method from the table index* and* @throws*/@Override- public synchronized List<RowCollection> removeDoubles() throws IOException, RowSpaceExceededException {+ public synchronized List<RowCollection> removeDoubles() throws IOException, SpaceExceededException {assert this.file.size() == this.index.size() : "file.size() = " + this.file.size() + ", index.size() = " + this.index.size();final List<RowCollection> report = new ArrayList<RowCollection>();RowSet rows;@@ -417,7 +418,7 @@ public class Table implements Index, Iterable<Row.Entry> {List<long[]> doubles;try {doubles = this.index.removeDoubles();- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e;this.table = null;doubles = this.index.removeDoubles();@@ -434,7 +435,7 @@ public class Table implements Index, Iterable<Row.Entry> {inconsistentEntry = this.rowdef.newEntry(b);try {rows.addUnique(inconsistentEntry);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e;this.table = null;rows.addUnique(inconsistentEntry);@@ -540,7 +541,7 @@ public class Table implements Index, Iterable<Row.Entry> {}@Override- public Entry replace(final Entry row) throws IOException, RowSpaceExceededException {+ public Entry replace(final Entry row) throws IOException, SpaceExceededException {assert row != null;if (this.file == null || row == null) return null;final byte[] rowb = row.bytes();@@ -554,7 +555,7 @@ public class Table implements Index, Iterable<Row.Entry> {if (i == -1) {try {addUnique(row);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e;this.table = null;addUnique(row);@@ -577,7 +578,7 @@ public class Table implements Index, Iterable<Row.Entry> {// write new valuetry {this.table.set(i, this.taildef.newEntry(rowb, this.rowdef.primaryKeyLength, true));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;}if (abandonTable()) this.table = null;@@ -595,10 +596,10 @@ public class Table implements Index, Iterable<Row.Entry> {* @param row a index row* @return true if this set did _not_ already contain the given row.* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@Override- public boolean put(final Entry row) throws IOException, RowSpaceExceededException {+ public boolean put(final Entry row) throws IOException, SpaceExceededException {assert row != null;if (this.file == null || row == null) return true;final byte[] rowb = row.bytes();@@ -612,7 +613,7 @@ public class Table implements Index, Iterable<Row.Entry> {if (i == -1) {try {addUnique(row);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {if (this.table == null) throw e;this.table = null;addUnique(row);@@ -628,7 +629,7 @@ public class Table implements Index, Iterable<Row.Entry> {this.file.put(i, rowb, 0);if (abandonTable()) this.table = null; else try {this.table.set(i, this.taildef.newEntry(rowb, this.rowdef.primaryKeyLength, true));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;}}@@ -642,9 +643,9 @@ public class Table implements Index, Iterable<Row.Entry> {* remove one entry from the file* @param i an index position within the file (not a byte position)* @throws IOException- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- private void removeInFile(final int i) throws IOException, RowSpaceExceededException {+ private void removeInFile(final int i) throws IOException, SpaceExceededException {assert i >= 0;final byte[] p = new byte[this.rowdef.objectsize];@@ -674,7 +675,7 @@ public class Table implements Index, Iterable<Row.Entry> {final Row.Entry te = this.table.removeOne();try {this.table.set(i, te);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;}@@ -746,7 +747,7 @@ public class Table implements Index, Iterable<Row.Entry> {System.arraycopy(p, 0, k, 0, this.rowdef.primaryKeyLength);try {this.index.put(k, i);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);throw new IOException("RowSpaceExceededException: " + e.getMessage());}@@ -776,7 +777,7 @@ public class Table implements Index, Iterable<Row.Entry> {// fill the gap in file copytry {this.table.set(i, te);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);this.table = null;}@@ -788,7 +789,7 @@ public class Table implements Index, Iterable<Row.Entry> {final Row.Entry lr = this.rowdef.newEntry(p);try {this.index.put(lr.getPrimaryKeyBytes(), i);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.table = null;throw new IOException("RowSpaceExceededException: " + e.getMessage());}@@ -901,8 +902,8 @@ public class Table implements Index, Iterable<Row.Entry> {}private class rowIteratorNoOrder implements CloneableIterator<Entry> {- Iterator<Row.Entry> i;- int idx;+ Iterator<Map.Entry<byte[], Long>> i;+ long idx;byte[] key;public rowIteratorNoOrder() {@@ -923,11 +924,11 @@ public class Table implements Index, Iterable<Row.Entry> {@Overridepublic Entry next() {- final Row.Entry entry = this.i.next();+ final Map.Entry<byte[], Long> entry = this.i.next();if (entry == null) return null;- this.key = entry.getPrimaryKeyBytes();+ this.key = entry.getKey();if (this.key == null) return null;- this.idx = (int) entry.getColLong(1);+ this.idx = entry.getValue().longValue();try {return get(this.key, false);} catch (final IOException e) {@@ -939,9 +940,9 @@ public class Table implements Index, Iterable<Row.Entry> {public void remove() {if (this.key != null) {try {- removeInFile(this.idx);+ removeInFile((int) this.idx);} catch (final IOException e) {- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {}this.i.remove();}@@ -950,7 +951,7 @@ public class Table implements Index, Iterable<Row.Entry> {@Overridepublic void close() {if (this.i instanceof CloneableIterator) {- ((CloneableIterator<Entry>) this.i).close();+ ((CloneableIterator<Map.Entry<byte[], Long>>) this.i).close();}}@@ -1046,7 +1047,7 @@ public class Table implements Index, Iterable<Row.Entry> {return result;}- private static Table testTable(final File f, final String testentities, final boolean useTailCache, final boolean exceed134217727) throws IOException, RowSpaceExceededException {+ private static Table testTable(final File f, final String testentities, final boolean useTailCache, final boolean exceed134217727) throws IOException, SpaceExceededException {if (f.exists()) FileUtils.deletedelete(f);final Row rowdef = new Row("byte[] a-4, byte[] b-4", NaturalOrder.naturalOrder);final Table tt = new Table(f, rowdef, 100, 0, useTailCache, exceed134217727, true);diff --git a/source/net/yacy/kelondro/util/SetTools.java b/source/net/yacy/kelondro/util/SetTools.javaindex 43f225c56..526a49964 100644--- a/source/net/yacy/kelondro/util/SetTools.java+++ b/source/net/yacy/kelondro/util/SetTools.java@@ -44,7 +44,7 @@ import java.util.TreeMap;import java.util.TreeSet;import net.yacy.cora.document.UTF8;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;import net.yacy.kelondro.logging.Log;public final class SetTools {diff --git a/source/net/yacy/peers/NewsDB.java b/source/net/yacy/peers/NewsDB.javaindex 4355c7d96..3e08c3e77 100644--- a/source/net/yacy/peers/NewsDB.java+++ b/source/net/yacy/peers/NewsDB.java@@ -55,10 +55,10 @@ import java.util.Properties;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.NaturalOrder;@@ -99,10 +99,10 @@ public class NewsDB {);try {this.news = new Table(path, this.rowdef, 10, 0, useTailCache, exceed134217727, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {this.news = new Table(path, this.rowdef, 0, 0, false, exceed134217727, true);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {Log.logException(e1);}}@@ -113,10 +113,10 @@ public class NewsDB {if (this.path.exists()) FileUtils.deletedelete(this.path);try {this.news = new Table(this.path, this.rowdef, 10, 0, false, false, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {try {this.news = new Table(this.path, this.rowdef, 0, 0, false, false, true);- } catch (final RowSpaceExceededException e1) {+ } catch (final SpaceExceededException e1) {Log.logException(e1);}}@@ -140,7 +140,7 @@ public class NewsDB {this.news.delete(UTF8.getBytes(id));}- public synchronized Record put(final Record record) throws IOException, RowSpaceExceededException {+ public synchronized Record put(final Record record) throws IOException, SpaceExceededException {try {return b2r(this.news.replace(r2b(record)));} catch (final Exception e) {diff --git a/source/net/yacy/peers/NewsPool.java b/source/net/yacy/peers/NewsPool.javaindex 265546135..11f025515 100644--- a/source/net/yacy/peers/NewsPool.java+++ b/source/net/yacy/peers/NewsPool.java@@ -53,8 +53,8 @@ import java.util.Map;import java.util.Properties;import java.util.Set;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.repository.Blacklist.BlacklistType;import net.yacy.search.Switchboard;@@ -315,7 +315,7 @@ public class NewsPool {}}- public NewsDB.Record myPublication() throws IOException, RowSpaceExceededException {+ public NewsDB.Record myPublication() throws IOException, SpaceExceededException {// generate a record for next peer-pingif (this.outgoingNews.isEmpty()) return null;final NewsDB.Record record = this.outgoingNews.pop();@@ -332,7 +332,7 @@ public class NewsPool {return record;}- public void enqueueIncomingNews(final NewsDB.Record record) throws IOException, RowSpaceExceededException {+ public void enqueueIncomingNews(final NewsDB.Record record) throws IOException, SpaceExceededException {// called if a news is attached to a seed// check consistency@@ -367,7 +367,7 @@ public class NewsPool {return switchQueue(dbKey).size();}- public int automaticProcess(final SeedDB seedDB) throws IOException, InterruptedException, RowSpaceExceededException {+ public int automaticProcess(final SeedDB seedDB) throws IOException, InterruptedException, SpaceExceededException {// processes news in the incoming-db// returns number of processesNewsDB.Record record;@@ -493,7 +493,7 @@ public class NewsPool {}}- public void moveOff(final int dbKey, final String id) throws IOException, RowSpaceExceededException {+ public void moveOff(final int dbKey, final String id) throws IOException, SpaceExceededException {// this is called if a queue element shall be moved to another queue or off the queue// it depends on the dbKey how the record is handledswitch (dbKey) {@@ -505,7 +505,7 @@ public class NewsPool {}}- private boolean moveOff(final NewsQueue fromqueue, final NewsQueue toqueue, final String id) throws IOException, RowSpaceExceededException {+ private boolean moveOff(final NewsQueue fromqueue, final NewsQueue toqueue, final String id) throws IOException, SpaceExceededException {// called if a published news shall be removedfinal NewsDB.Record record = fromqueue.remove(id);if (record == null) {@@ -519,7 +519,7 @@ public class NewsPool {return true;}- public void moveOffAll(final int dbKey) throws IOException, RowSpaceExceededException {+ public void moveOffAll(final int dbKey) throws IOException, SpaceExceededException {// this is called if a queue element shall be moved to another queue or off the queue// it depends on the dbKey how the record is handledswitch (dbKey) {@@ -530,7 +530,7 @@ public class NewsPool {}}- private static int moveOffAll(final NewsQueue fromqueue, final NewsQueue toqueue) throws IOException, RowSpaceExceededException {+ private static int moveOffAll(final NewsQueue fromqueue, final NewsQueue toqueue) throws IOException, SpaceExceededException {// move off all news from a specific queue to another queuefinal Iterator<NewsDB.Record> i = fromqueue.iterator();NewsDB.Record record;diff --git a/source/net/yacy/peers/NewsQueue.java b/source/net/yacy/peers/NewsQueue.javaindex de52ae597..5b0c2bf48 100644--- a/source/net/yacy/peers/NewsQueue.java+++ b/source/net/yacy/peers/NewsQueue.java@@ -51,9 +51,9 @@ import java.util.Iterator;import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.Column;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.NaturalOrder;import net.yacy.kelondro.table.Table;@@ -77,7 +77,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {this.newsDB = newsDB;try {this.queueStack = new Table(path, rowdef, 10, 0, false, false, true);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);this.queueStack = null;}@@ -91,7 +91,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {if (this.path.exists()) FileUtils.deletedelete(this.path);try {this.queueStack = new Table(this.path, rowdef, 10, 0, false, false, true);- } catch (final RowSpaceExceededException ee) {+ } catch (final SpaceExceededException ee) {Log.logException(e);this.queueStack = null;}@@ -116,7 +116,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {return this.queueStack.isEmpty();}- public synchronized void push(final NewsDB.Record entry) throws IOException, RowSpaceExceededException {+ public synchronized void push(final NewsDB.Record entry) throws IOException, SpaceExceededException {if (!this.queueStack.consistencyCheck()) {Log.logSevere("yacyNewsQueue", "reset of table " + this.path);this.queueStack.clear();@@ -163,7 +163,7 @@ public class NewsQueue implements Iterable<NewsDB.Record> {return this.newsDB.get(id);}- private Row.Entry r2b(final NewsDB.Record r) throws IOException, RowSpaceExceededException {+ private Row.Entry r2b(final NewsDB.Record r) throws IOException, SpaceExceededException {if (r == null) return null;this.newsDB.put(r);final Row.Entry b = this.queueStack.row().newEntry(new byte[][]{diff --git a/source/net/yacy/peers/Protocol.java b/source/net/yacy/peers/Protocol.javaindex b5902dc54..0f577efa3 100644--- a/source/net/yacy/peers/Protocol.java+++ b/source/net/yacy/peers/Protocol.java@@ -78,12 +78,12 @@ import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.http.HTTPClient;import net.yacy.cora.services.federated.opensearch.SRURSSConnector;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceFactory;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;@@ -680,7 +680,7 @@ public final class ProtocolSegment.wordReferenceFactory,ASCII.getBytes(wordhashes.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)),count));- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);return -1;}@@ -776,7 +776,7 @@ public final class Protocolfor ( final ReferenceContainer<WordReference> c : container ) {try {c.add(entry);- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);break;}diff --git a/source/net/yacy/peers/RemoteSearch.java b/source/net/yacy/peers/RemoteSearch.javaindex a6d8f6094..c6a380b38 100644--- a/source/net/yacy/peers/RemoteSearch.java+++ b/source/net/yacy/peers/RemoteSearch.java@@ -31,7 +31,7 @@ import java.util.SortedMap;import java.util.regex.Pattern;import net.yacy.cora.document.ASCII;-import net.yacy.kelondro.index.HandleSet;+import net.yacy.cora.storage.HandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Bitfield;import net.yacy.peers.dht.PeerSelection;diff --git a/source/net/yacy/peers/Seed.java b/source/net/yacy/peers/Seed.javaindex 27ce23723..af7e24698 100644--- a/source/net/yacy/peers/Seed.java+++ b/source/net/yacy/peers/Seed.java@@ -65,8 +65,8 @@ import net.yacy.cora.document.UTF8;import net.yacy.cora.protocol.Domains;import net.yacy.cora.sorting.ClusteredScoreMap;import net.yacy.cora.sorting.ScoreMap;+import net.yacy.cora.storage.HandleSet;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;import net.yacy.kelondro.util.MapTools;diff --git a/source/net/yacy/peers/SeedDB.java b/source/net/yacy/peers/SeedDB.javaindex fcf3ae7da..801adc4b0 100644--- a/source/net/yacy/peers/SeedDB.java+++ b/source/net/yacy/peers/SeedDB.java@@ -47,10 +47,10 @@ import net.yacy.cora.protocol.Domains;import net.yacy.cora.protocol.HeaderFramework;import net.yacy.cora.protocol.RequestHeader;import net.yacy.cora.protocol.http.HTTPClient;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.blob.MapDataMining;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.FileUtils;@@ -567,7 +567,7 @@ public final class SeedDB implements AlternativeDomainNames {} catch (final IOException e) {Log.logException(e);return null;- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);return null;}diff --git a/source/net/yacy/peers/dht/Dispatcher.java b/source/net/yacy/peers/dht/Dispatcher.javaindex 84078ec37..9754d4a50 100644--- a/source/net/yacy/peers/dht/Dispatcher.java+++ b/source/net/yacy/peers/dht/Dispatcher.java@@ -33,11 +33,12 @@ import java.util.Map;import java.util.concurrent.ConcurrentHashMap;import net.yacy.cora.document.ASCII;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.rwi.ReferenceContainer;@@ -194,12 +195,12 @@ public class Dispatcher {final ArrayList<ReferenceContainer<WordReference>> rc;if (ram) {// selection was only from ram, so we have to carefully remove only the selected entries- final HandleSet urlHashes = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);+ final HandleSet urlHashes = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0);Iterator<WordReference> it;for (final ReferenceContainer<WordReference> c: containers) {urlHashes.clear();it = c.entries();- while (it.hasNext()) try { urlHashes.put(it.next().urlhash()); } catch (final RowSpaceExceededException e) { Log.logException(e); }+ while (it.hasNext()) try { urlHashes.put(it.next().urlhash()); } catch (final SpaceExceededException e) { Log.logException(e); }if (this.log.isFine()) this.log.logFine("selected " + urlHashes.size() + " urls for word '" + ASCII.String(c.getTermHash()) + "'");if (!urlHashes.isEmpty()) this.segment.termIndex().remove(c.getTermHash(), urlHashes);}@@ -227,10 +228,10 @@ public class Dispatcher {* @param containers* @param scheme* @return- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/@SuppressWarnings("unchecked")- private List<ReferenceContainer<WordReference>>[] splitContainers(final List<ReferenceContainer<WordReference>> containers) throws RowSpaceExceededException {+ private List<ReferenceContainer<WordReference>>[] splitContainers(final List<ReferenceContainer<WordReference>> containers) throws SpaceExceededException {// init the result vectorfinal int partitionCount = this.seeds.scheme.verticalPartitions();@@ -309,7 +310,7 @@ public class Dispatcher {for (final ReferenceContainer<WordReference> c: containers[vertical]) {try {entry.add(c);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);break;}@@ -345,7 +346,7 @@ public class Dispatcher {List<ReferenceContainer<WordReference>>[] splitContainerCache;try {splitContainerCache = splitContainers(selectedContainerCache);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {this.log.logSevere("selectContainersEnqueueToCloud: splitContainers failed because of too low RAM", e);return false;}diff --git a/source/net/yacy/peers/dht/FlatWordPartitionScheme.java b/source/net/yacy/peers/dht/FlatWordPartitionScheme.javaindex 1b1655c01..b6eeea6f8 100644--- a/source/net/yacy/peers/dht/FlatWordPartitionScheme.java+++ b/source/net/yacy/peers/dht/FlatWordPartitionScheme.java@@ -1,4 +1,4 @@-// FlatWordPartitionScheme.java+// FlatWordPartitionScheme.java// ------------------------------// part of YaCy// (C) 2009 by Michael Peter Christen; [email protected]@@ -29,8 +29,9 @@ import java.util.Random;import java.util.TreeMap;import net.yacy.cora.document.ASCII;-import net.yacy.kelondro.index.HandleMap;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.cora.storage.HandleMap;+import net.yacy.cora.util.SpaceExceededException;+import net.yacy.kelondro.index.RowHandleMap;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.MemoryControl;@@ -45,25 +46,28 @@ import net.yacy.peers.Seed;public class FlatWordPartitionScheme implements PartitionScheme {public static final FlatWordPartitionScheme std = new FlatWordPartitionScheme();-+public FlatWordPartitionScheme() {// nothing to initialize}+ @Overridepublic int verticalPartitions() {return 1;}-++ @Overridepublic long dhtPosition(byte[] wordHash, String urlHash) {// the urlHash has no relevance here// normalized to Long.MAX_VALUEreturn Base64Order.enhancedCoder.cardinal(wordHash);}+ @Overridepublic final long dhtDistance(final byte[] word, final String urlHash, final Seed peer) {return dhtDistance(word, urlHash, ASCII.getBytes(peer.hash));}-+private final long dhtDistance(final byte[] from, final String urlHash, final byte[] to) {// the dht distance is a positive value between 0 and 1// if the distance is small, the word more probably belongs to the peer@@ -74,16 +78,19 @@ public class FlatWordPartitionScheme implements PartitionScheme {return dhtDistance(fromPos, toPos);}+ @Overridepublic long dhtPosition(byte[] wordHash, int verticalPosition) {return dhtPosition(wordHash, null);}+ @Overridepublic long[] dhtPositions(byte[] wordHash) {long[] l = new long[1];l[1] = dhtPosition(wordHash, null);return l;}+ @Overridepublic int verticalPosition(byte[] urlHash) {return 0; // this is not a method stub, this is actually true for all FlatWordPartitionScheme}@@ -93,14 +100,14 @@ public class FlatWordPartitionScheme implements PartitionScheme {toPos - fromPos :(Long.MAX_VALUE - fromPos) + toPos + 1;}-+public static byte[] positionToHash(final long l) {// transform the position of a peer position into a close peer hashString s = ASCII.String(Base64Order.enhancedCoder.uncardinal(l));while (s.length() < 12) s += "A";return ASCII.getBytes(s);}-+public static void main(String[] args) {int count = (args.length == 0) ? 1000000 : Integer.parseInt(args[0]);@@ -112,11 +119,11 @@ public class FlatWordPartitionScheme implements PartitionScheme {System.gc(); // for resource measurementlong a = MemoryControl.available();- HandleMap idx = new HandleMap(12, Base64Order.enhancedCoder, 4, 150000, "test");+ HandleMap idx = new RowHandleMap(12, Base64Order.enhancedCoder, 4, 150000, "test");for (int i = 0; i < count; i++) {try {idx.inc(FlatWordPartitionScheme.positionToHash(r.nextInt(count)));- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);break;}@@ -128,7 +135,7 @@ public class FlatWordPartitionScheme implements PartitionScheme {System.out.println("Used Memory: " + memk + " bytes");System.out.println("x " + idx.get(FlatWordPartitionScheme.positionToHash(0)));idx.close();-+r = new Random(0);start = System.currentTimeMillis();byte[] hash;diff --git a/source/net/yacy/peers/dht/PeerSelection.java b/source/net/yacy/peers/dht/PeerSelection.javaindex 0a30d63c2..38fb896f9 100644--- a/source/net/yacy/peers/dht/PeerSelection.java+++ b/source/net/yacy/peers/dht/PeerSelection.java@@ -37,9 +37,10 @@ import net.yacy.cora.date.AbstractFormatter;import net.yacy.cora.document.ASCII;import net.yacy.cora.sorting.ConcurrentScoreMap;import net.yacy.cora.sorting.ScoreMap;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;@@ -237,7 +238,7 @@ public class PeerSelection {this.seedDB = seedDB;this.se = getDHTSeeds(seedDB, starthash, yacyVersion.YACY_HANDLES_COLLECTION_INDEX, alsoMyOwn);this.remaining = max;- this.doublecheck = new HandleSet(12, Base64Order.enhancedCoder, 0);+ this.doublecheck = new RowHandleSet(12, Base64Order.enhancedCoder, 0);this.nextSeed = nextInternal();this.alsoMyOwn = alsoMyOwn;}@@ -258,7 +259,7 @@ public class PeerSelection {if (this.doublecheck.has(hashb)) return null;try {this.doublecheck.put(hashb);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);break;}diff --git a/source/net/yacy/peers/dht/Transmission.java b/source/net/yacy/peers/dht/Transmission.javaindex 5060b3240..e5a890cdd 100644--- a/source/net/yacy/peers/dht/Transmission.java+++ b/source/net/yacy/peers/dht/Transmission.java@@ -32,12 +32,13 @@ import java.util.SortedMap;import java.util.TreeMap;import net.yacy.cora.document.ASCII;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.rwi.ReferenceContainer;@@ -88,12 +89,12 @@ public class Transmission {* - a set of yacy seeds which will shrink as the containers are transmitted to them* - a counter that gives the number of sucessful and unsuccessful transmissions so far*/- private final byte[] primaryTarget;+ private final byte[] primaryTarget;private final ReferenceContainerCache<WordReference> containers;private final SortedMap<byte[], URIMetadata> references;- private final HandleSet badReferences;- private final List<Seed> targets;- private int hit, miss;+ private final HandleSet badReferences;+ private final List<Seed> targets;+ private int hit, miss;/*** generate a new dispatcher target. such a target is defined with a primary target and@@ -107,7 +108,7 @@ public class Transmission {this.primaryTarget = primaryTarget;this.containers = new ReferenceContainerCache<WordReference>(Segment.wordReferenceFactory, Segment.wordOrder, Word.commonHashLength);this.references = new TreeMap<byte[], URIMetadata>(Base64Order.enhancedCoder);- this.badReferences = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);+ this.badReferences = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);this.targets = targets;this.hit = 0;this.miss = 0;@@ -121,7 +122,7 @@ public class Transmission {* @throws RowSpaceExceededException* @return*/- private ReferenceContainer<WordReference> trimContainer(final ReferenceContainer<WordReference> container, final int max) throws RowSpaceExceededException {+ private ReferenceContainer<WordReference> trimContainer(final ReferenceContainer<WordReference> container, final int max) throws SpaceExceededException {final ReferenceContainer<WordReference> c = new ReferenceContainer<WordReference>(Segment.wordReferenceFactory, container.getTermHash(), max);final int part = container.size() / max + 1;final Random r = new Random();@@ -150,9 +151,9 @@ public class Transmission {* add a container to the Entry cache.* all entries in the container are checked and only such are stored which have a reference entry* @param container- * @throws RowSpaceExceededException+ * @throws SpaceExceededException*/- public void add(final ReferenceContainer<WordReference> container) throws RowSpaceExceededException {+ public void add(final ReferenceContainer<WordReference> container) throws SpaceExceededException {int remaining = maxRWIsCount;for (final ReferenceContainer<WordReference> ic : this) remaining -= ic.size();if (remaining <= 0) {@@ -193,6 +194,7 @@ public class Transmission {* get all containers from the entry. This method may be used to flush remaining entries* if they had been finished transmission without success (not enough peers arrived)*/+ @Overridepublic Iterator<ReferenceContainer<WordReference>> iterator() {return this.containers.iterator();}diff --git a/source/net/yacy/peers/graphics/WebStructureGraph.java b/source/net/yacy/peers/graphics/WebStructureGraph.javaindex 1a1a0068c..04e822450 100644--- a/source/net/yacy/peers/graphics/WebStructureGraph.java+++ b/source/net/yacy/peers/graphics/WebStructureGraph.java@@ -47,11 +47,11 @@ import net.yacy.cora.date.GenericFormatter;import net.yacy.cora.document.ASCII;import net.yacy.cora.document.MultiProtocolURI;import net.yacy.cora.document.UTF8;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Document;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.index.Row;import net.yacy.kelondro.index.Row.Entry;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.MicroDate;@@ -498,7 +498,7 @@ public class WebStructureGraph} else {r.put(hr);}- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {continue refloop;}}diff --git a/source/net/yacy/repository/Blacklist.java b/source/net/yacy/repository/Blacklist.javaindex cfc583048..90f6fe164 100644--- a/source/net/yacy/repository/Blacklist.java+++ b/source/net/yacy/repository/Blacklist.java@@ -44,18 +44,19 @@ import java.util.concurrent.ConcurrentMap;import java.util.regex.Pattern;import java.util.regex.PatternSyntaxException;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.meta.URIMetadataRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.FileUtils;import net.yacy.kelondro.util.SetTools;import net.yacy.search.Switchboard;public class Blacklist {-+public enum BlacklistType {DHT, CRAWLER, PROXY, SEARCH, SURFTIPS, NEWS;@@ -352,7 +353,7 @@ public class Blacklist {if (temp) {try {urlHashCache.put(url.hash());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -528,7 +529,7 @@ public class Blacklist {String BLACKLIST_DHT_CACHEFILE_NAME = "DATA/LISTS/blacklist_" + type.name() + "_Cache.ser";return new File(Switchboard.getSwitchboard().dataPath, BLACKLIST_DHT_CACHEFILE_NAME);}-+private final void saveDHTCache(BlacklistType type) {try {final ObjectOutputStream out = new ObjectOutputStream(new FileOutputStream(DHTCacheFile(type)));@@ -545,10 +546,11 @@ public class Blacklist {File cachefile = DHTCacheFile(type);if (cachefile.exists()) {final ObjectInputStream in = new ObjectInputStream(new FileInputStream(cachefile));- this.cachedUrlHashs.put(type, (HandleSet) in.readObject());+ RowHandleSet rhs = (RowHandleSet) in.readObject();+ this.cachedUrlHashs.put(type, rhs == null ? new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0) : rhs);in.close();} else {- this.cachedUrlHashs.put(type, new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0));+ this.cachedUrlHashs.put(type, new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 0));}} catch (final ClassNotFoundException e) {Log.logException(e);diff --git a/source/net/yacy/search/Switchboard.java b/source/net/yacy/search/Switchboard.javaindex 8a29de350..1f49a50e5 100644--- a/source/net/yacy/search/Switchboard.java+++ b/source/net/yacy/search/Switchboard.java@@ -98,6 +98,8 @@ import net.yacy.cora.services.federated.solr.ShardSelection;import net.yacy.cora.services.federated.solr.ShardSolrConnector;import net.yacy.cora.services.federated.solr.SolrConnector;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.document.Document;import net.yacy.document.LibraryProvider;@@ -113,8 +115,6 @@ import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;@@ -1992,7 +1992,7 @@ public final class Switchboard extends serverSwitch} catch ( final IOException e ) {Log.logException(e);continue;- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {Log.logException(e);continue;}diff --git a/source/net/yacy/search/index/MetadataRepository.java b/source/net/yacy/search/index/MetadataRepository.javaindex fd458f54c..266a09492 100644--- a/source/net/yacy/search/index/MetadataRepository.java+++ b/source/net/yacy/search/index/MetadataRepository.java@@ -44,16 +44,16 @@ import net.yacy.cora.services.federated.solr.DoubleSolrConnector;import net.yacy.cora.services.federated.solr.SolrConnector;import net.yacy.cora.sorting.ConcurrentScoreMap;import net.yacy.cora.sorting.ScoreMap;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.parser.html.CharacterCoding;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.WordReferenceVars;import net.yacy.kelondro.index.Cache;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.index.Index;import net.yacy.kelondro.index.Row;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.table.SplitTable;import net.yacy.kelondro.util.MemoryControl;@@ -239,7 +239,7 @@ public final class MetadataRepository implements /*Metadata,*/ Iterable<byte[]>try {this.urlIndexFile.put(((URIMetadataRow) entry).toRowEntry());- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {throw new IOException("RowSpaceExceededException in " + this.urlIndexFile.filename() + ": " + e.getMessage());}this.statsDump = null;diff --git a/source/net/yacy/search/index/Segment.java b/source/net/yacy/search/index/Segment.javaindex 51b7a3ee4..dc0fe7f25 100644--- a/source/net/yacy/search/index/Segment.java+++ b/source/net/yacy/search/index/Segment.java@@ -42,6 +42,8 @@ import net.yacy.cora.protocol.ResponseHeader;import net.yacy.cora.services.federated.solr.SolrConnector;import net.yacy.cora.services.federated.solr.SolrDoc;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.document.Document;import net.yacy.document.Parser;@@ -54,8 +56,7 @@ import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceFactory;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;@@ -251,12 +252,12 @@ public class Segment {*/private Iterator<byte[]> hostSelector(String host) {String hh = DigestURI.hosthash(host);- final HandleSet ref = new HandleSet(12, Base64Order.enhancedCoder, 100);+ final HandleSet ref = new RowHandleSet(12, Base64Order.enhancedCoder, 100);for (byte[] b: this.urlMetadata) {if (hh.equals(ASCII.String(b, 6, 6))) {try {ref.putUnique(b);- } catch (RowSpaceExceededException e) {+ } catch (SpaceExceededException e) {Log.logException(e);break;}@@ -512,7 +513,7 @@ public class Segment {container = ReferenceContainer.emptyContainer(Segment.wordReferenceFactory, wordhash, 1);container.add(ientry);rankingProcess.add(container, true, sourceName, -1, 5000);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {continue;}}diff --git a/source/net/yacy/search/query/QueryParams.java b/source/net/yacy/search/query/QueryParams.javaindex 652bcb91f..b8cd4c482 100644--- a/source/net/yacy/search/query/QueryParams.java+++ b/source/net/yacy/search/query/QueryParams.java@@ -45,14 +45,15 @@ import net.yacy.cora.document.MultiProtocolURI;import net.yacy.cora.document.UTF8;import net.yacy.cora.lod.vocabulary.Tagging;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.document.parser.html.AbstractScraper;import net.yacy.document.parser.html.CharacterCoding;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReferenceRow;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Bitfield;@@ -152,11 +153,11 @@ public final class QueryParams {byte[] queryHash;if ((queryString.length() == 12) && (Base64Order.enhancedCoder.wellformed(queryHash = UTF8.getBytes(queryString)))) {this.queryString = null;- this.query_include_hashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);- this.query_exclude_hashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);+ this.query_include_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);+ this.query_exclude_hashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);try {this.query_include_hashes.put(queryHash);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}} else {@@ -309,11 +310,11 @@ public final class QueryParams {}public static HandleSet hashes2Set(final String query) {- final HandleSet keyhashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);+ final HandleSet keyhashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);if (query != null) {for (int i = 0; i < (query.length() / Word.commonHashLength); i++) try {keyhashes.put(ASCII.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -321,11 +322,11 @@ public final class QueryParams {}public static HandleSet hashes2Handles(final String query) {- final HandleSet keyhashes = new HandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);+ final HandleSet keyhashes = new RowHandleSet(WordReferenceRow.urlEntryRow.primaryKeyLength, WordReferenceRow.urlEntryRow.objectOrder, 0);if (query != null) {for (int i = 0; i < (query.length() / Word.commonHashLength); i++) try {keyhashes.put(ASCII.getBytes(query.substring(i * Word.commonHashLength, (i + 1) * Word.commonHashLength)));- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/search/query/RWIProcess.java b/source/net/yacy/search/query/RWIProcess.javaindex 93e975e9e..fa3f0551c 100644--- a/source/net/yacy/search/query/RWIProcess.java+++ b/source/net/yacy/search/query/RWIProcess.java@@ -52,6 +52,8 @@ import net.yacy.cora.sorting.ConcurrentScoreMap;import net.yacy.cora.sorting.ScoreMap;import net.yacy.cora.sorting.WeakPriorityBlockingQueue;import net.yacy.cora.sorting.WeakPriorityBlockingQueue.ReverseElement;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.document.LibraryProvider;import net.yacy.kelondro.data.meta.DigestURI;@@ -60,8 +62,7 @@ import net.yacy.kelondro.data.meta.URIMetadataRow;import net.yacy.kelondro.data.word.Word;import net.yacy.kelondro.data.word.WordReference;import net.yacy.kelondro.data.word.WordReferenceVars;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.rwi.ReferenceContainer;import net.yacy.kelondro.rwi.TermSearch;@@ -132,8 +133,8 @@ public final class RWIProcess extends Threadthis.remote_resourceSize = 0;this.remote_indexCount = 0;this.local_indexCount = 0;- this.urlhashes = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 100);- this.misses = new HandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 100);+ this.urlhashes = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 100);+ this.misses = new RowHandleSet(URIMetadataRow.rowdef.primaryKeyLength, URIMetadataRow.rowdef.objectOrder, 100);this.sortout = 0;this.flagcount = new int[32];for ( int i = 0; i < 32; i++ ) {@@ -425,7 +426,7 @@ public final class RWIProcess extends Threadif (System.currentTimeMillis() >= timeout) Log.logWarning("RWIProcess", "rwi normalization ended with timeout = " + maxtime);} catch ( final InterruptedException e ) {- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {}//if ((query.neededResults() > 0) && (container.size() > query.neededResults())) remove(true, true);@@ -632,7 +633,7 @@ public final class RWIProcess extends Threadif ( page == null ) {try {this.misses.putUnique(obrwi.getElement().urlhash());- } catch ( final RowSpaceExceededException e ) {+ } catch ( final SpaceExceededException e ) {}continue;}diff --git a/source/net/yacy/search/query/SnippetProcess.java b/source/net/yacy/search/query/SnippetProcess.javaindex d381d7d9e..aec342789 100644--- a/source/net/yacy/search/query/SnippetProcess.java+++ b/source/net/yacy/search/query/SnippetProcess.java@@ -40,11 +40,12 @@ import net.yacy.cora.sorting.ScoreMap;import net.yacy.cora.sorting.WeakPriorityBlockingQueue;import net.yacy.cora.sorting.WeakPriorityBlockingQueue.Element;import net.yacy.cora.sorting.WeakPriorityBlockingQueue.ReverseElement;+import net.yacy.cora.storage.HandleSet;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Condenser;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.util.MemoryControl;import net.yacy.peers.SeedDB;@@ -117,10 +118,10 @@ public class SnippetProcess {// only with the query minus the stopwords which had not been used for the searchHandleSet filtered;try {- filtered = HandleSet.joinConstructive(query.query_include_hashes, Switchboard.stopwordHashes);- } catch (final RowSpaceExceededException e) {+ filtered = RowHandleSet.joinConstructive(query.query_include_hashes, Switchboard.stopwordHashes);+ } catch (final SpaceExceededException e) {Log.logException(e);- filtered = new HandleSet(query.query_include_hashes.row().primaryKeyLength, query.query_include_hashes.comparator(), 0);+ filtered = new RowHandleSet(query.query_include_hashes.keylen(), query.query_include_hashes.comparator(), 0);}this.snippetFetchWordHashes = query.query_include_hashes.clone();if (filtered != null && !filtered.isEmpty()) {@@ -498,7 +499,9 @@ public class SnippetProcess {String solrContent = null;if (this.solr != null) {SolrDocument sd = null;- final SolrDocumentList sdl = this.solr.query(SolrField.id.getSolrFieldName()+ ":" + ASCII.String(page.hash()), 0, 1);+ StringBuilder querystring = new StringBuilder(17);+ querystring.append(SolrField.id.getSolrFieldName()).append(':').append('"').append(ASCII.String(page.hash())).append('"');+ final SolrDocumentList sdl = this.solr.query(querystring.toString(), 0, 1);if (!sdl.isEmpty()) {sd = sdl.get(0);}diff --git a/source/net/yacy/search/ranking/BlockRank.java b/source/net/yacy/search/ranking/BlockRank.javaindex 7ea68f3d1..d3fca5789 100644--- a/source/net/yacy/search/ranking/BlockRank.java+++ b/source/net/yacy/search/ranking/BlockRank.java@@ -35,8 +35,8 @@ import java.util.Map;import net.yacy.cora.document.ASCII;import net.yacy.cora.sorting.OrderedScoreMap;import net.yacy.cora.sorting.ScoreMap;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.kelondro.index.BinSearch;-import net.yacy.kelondro.index.RowSpaceExceededException;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.order.Digest;@@ -85,7 +85,7 @@ public class BlockRank {index.merge(myIndex);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}@@ -115,7 +115,7 @@ public class BlockRank {this.index.merge(partialIndex);} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}@@ -147,7 +147,7 @@ public class BlockRank {ri.close();} catch (final IOException e) {Log.logException(e);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}diff --git a/source/net/yacy/search/snippet/MediaSnippet.java b/source/net/yacy/search/snippet/MediaSnippet.javaindex b2409d734..74a93acc3 100644--- a/source/net/yacy/search/snippet/MediaSnippet.java+++ b/source/net/yacy/search/snippet/MediaSnippet.java@@ -40,14 +40,15 @@ import net.yacy.cora.document.Classification;import net.yacy.cora.document.Classification.ContentDomain;import net.yacy.cora.document.MultiProtocolURI;import net.yacy.cora.services.federated.yacy.CacheStrategy;+import net.yacy.cora.storage.HandleSet;import net.yacy.cora.util.NumberTools;+import net.yacy.cora.util.SpaceExceededException;import net.yacy.document.Document;import net.yacy.document.Parser;import net.yacy.document.WordTokenizer;import net.yacy.document.parser.html.ImageEntry;import net.yacy.kelondro.data.meta.DigestURI;-import net.yacy.kelondro.index.HandleSet;-import net.yacy.kelondro.index.RowSpaceExceededException;+import net.yacy.kelondro.index.RowHandleSet;import net.yacy.kelondro.logging.Log;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.ByteArray;@@ -230,14 +231,14 @@ public class MediaSnippet implements Comparable<MediaSnippet>, Comparator<MediaSfinal Iterator<byte[]> j = queryhashes.iterator();byte[] hash;Integer pos;- final HandleSet remaininghashes = new HandleSet(queryhashes.row().primaryKeyLength, queryhashes.comparator(), queryhashes.size());+ final HandleSet remaininghashes = new RowHandleSet(queryhashes.keylen(), queryhashes.comparator(), queryhashes.size());while (j.hasNext()) {hash = j.next();pos = hs.get(hash);if (pos == null) {try {remaininghashes.put(hash);- } catch (final RowSpaceExceededException e) {+ } catch (final SpaceExceededException e) {Log.logException(e);}}diff --git a/source/net/yacy/search/snippet/TextSnippet.java b/source/net/yacy/search/snippet/TextSnippet.javaindex 09bd4da0c..4070caf6e 100644--- a/source/net/yacy/search/snippet/TextSnippet.java+++ b/source/net/yacy/search/snippet/TextSnippet.java@@ -38,6 +38,7 @@ import net.yacy.cora.document.ASCII;import net.yacy.cora.services.federated.yacy.CacheStrategy;import net.yacy.cora.storage.ARC;import net.yacy.cora.storage.ConcurrentARC;+import net.yacy.cora.storage.HandleSet;import net.yacy.document.Document;import net.yacy.document.Parser;import net.yacy.document.SentenceReader;@@ -47,7 +48,6 @@ import net.yacy.document.parser.html.CharacterCoding;import net.yacy.kelondro.data.meta.DigestURI;import net.yacy.kelondro.data.meta.URIMetadata;import net.yacy.kelondro.data.word.Word;-import net.yacy.kelondro.index.HandleSet;import net.yacy.kelondro.order.Base64Order;import net.yacy.kelondro.util.ByteArray;import net.yacy.kelondro.util.ByteBuffer;