diff --git a/source/de/anomic/data/blogBoard.java b/source/de/anomic/data/blogBoard.java index 5e2c80c68..793ded137 100644 --- a/source/de/anomic/data/blogBoard.java +++ b/source/de/anomic/data/blogBoard.java @@ -83,7 +83,7 @@ public class blogBoard { public blogBoard(File actpath, int bufferkb, long preloadTime) { new File(actpath.getParent()).mkdir(); if (datbase == null) { - datbase = new kelondroMap(kelondroDyn.open(actpath, bufferkb / 2 * 0x40, preloadTime, keyLength, recordSize, '_', true)); + datbase = new kelondroMap(kelondroDyn.open(actpath, bufferkb / 2 * 0x40, preloadTime, keyLength, recordSize, '_', true, false)); } } diff --git a/source/de/anomic/data/bookmarksDB.java b/source/de/anomic/data/bookmarksDB.java index ce50a612d..837c80c6e 100644 --- a/source/de/anomic/data/bookmarksDB.java +++ b/source/de/anomic/data/bookmarksDB.java @@ -128,17 +128,17 @@ public class bookmarksDB { tagCache=new HashMap(); bookmarkCache=new HashMap(); bookmarksFile.getParentFile().mkdirs(); - this.bookmarksTable = new kelondroMap(kelondroDyn.open(bookmarksFile, bufferkb * 1024, preloadTime, 12, 256, '_', true)); + this.bookmarksTable = new kelondroMap(kelondroDyn.open(bookmarksFile, bufferkb * 1024, preloadTime, 12, 256, '_', true, false)); // tags tagsFile.getParentFile().mkdirs(); boolean tagsFileExisted = tagsFile.exists(); - this.tagsTable = new kelondroMap(kelondroDyn.open(tagsFile, bufferkb * 1024, preloadTime, 12, 256, '_', true)); + this.tagsTable = new kelondroMap(kelondroDyn.open(tagsFile, bufferkb * 1024, preloadTime, 12, 256, '_', true, false)); if (!tagsFileExisted) rebuildTags(); // dates boolean datesExisted = datesFile.exists(); - this.datesTable = new kelondroMap(kelondroDyn.open(datesFile, bufferkb * 1024, preloadTime, 20, 256, '_', true)); + this.datesTable = new kelondroMap(kelondroDyn.open(datesFile, bufferkb * 1024, preloadTime, 20, 256, '_', true, false)); if (!datesExisted) rebuildDates(); } diff --git a/source/de/anomic/data/messageBoard.java b/source/de/anomic/data/messageBoard.java index 6081feae7..a60b3ec7c 100644 --- a/source/de/anomic/data/messageBoard.java +++ b/source/de/anomic/data/messageBoard.java @@ -70,7 +70,7 @@ public class messageBoard { public messageBoard(File path, int bufferkb, long preloadTime) { new File(path.getParent()).mkdir(); if (database == null) { - database = new kelondroMap(kelondroDyn.open(path, bufferkb * 0x400, preloadTime, categoryLength + dateFormat.length() + 2, recordSize, '_', true)); + database = new kelondroMap(kelondroDyn.open(path, bufferkb * 0x400, preloadTime, categoryLength + dateFormat.length() + 2, recordSize, '_', true, false)); } sn = 0; } diff --git a/source/de/anomic/data/userDB.java b/source/de/anomic/data/userDB.java index cc2798bfd..9fe0cd4c5 100644 --- a/source/de/anomic/data/userDB.java +++ b/source/de/anomic/data/userDB.java @@ -5,7 +5,7 @@ //(C) 2005, 2006 by Martin Thelian // Alexander Schier // -//last change: $LastChangedDate$ by $LastChangedBy$ +//last change: $LastChangedDate$ by $LastChangedBy: $ //Revision: $LastChangedRevision$ // //This program is free software; you can redistribute it and/or modify @@ -77,7 +77,7 @@ public final class userDB { this.bufferkb = bufferkb; this.preloadTime = preloadTime; userTableFile.getParentFile().mkdirs(); - this.userTable = new kelondroMap(kelondroDyn.open(userTableFile, bufferkb * 1024, preloadTime, 128, 256, '_', true)); + this.userTable = new kelondroMap(kelondroDyn.open(userTableFile, bufferkb * 1024, preloadTime, 128, 256, '_', true, false)); } public int dbCacheNodeChunkSize() { @@ -95,7 +95,7 @@ public final class userDB { } catch (IOException e) {} if (!(userTableFile.delete())) throw new RuntimeException("cannot delete user database"); userTableFile.getParentFile().mkdirs(); - userTable = new kelondroMap(kelondroDyn.open(userTableFile, this.bufferkb, preloadTime, 256, 512, '_', true)); + userTable = new kelondroMap(kelondroDyn.open(userTableFile, this.bufferkb, preloadTime, 256, 512, '_', true, false)); } public void close() { diff --git a/source/de/anomic/data/wikiBoard.java b/source/de/anomic/data/wikiBoard.java index ae89206e5..d5ff52d03 100644 --- a/source/de/anomic/data/wikiBoard.java +++ b/source/de/anomic/data/wikiBoard.java @@ -72,11 +72,11 @@ public class wikiBoard { public wikiBoard(File actpath, File bkppath, int bufferkb, long preloadTime) { new File(actpath.getParent()).mkdirs(); if (datbase == null) { - datbase = new kelondroMap(kelondroDyn.open(actpath, bufferkb / 2 * 0x400, preloadTime, keyLength, recordSize, '_', true)); + datbase = new kelondroMap(kelondroDyn.open(actpath, bufferkb / 2 * 0x400, preloadTime, keyLength, recordSize, '_', true, false)); } new File(bkppath.getParent()).mkdirs(); if (bkpbase == null) { - bkpbase = new kelondroMap(kelondroDyn.open(bkppath, bufferkb / 2 * 0x400, preloadTime, keyLength + dateFormat.length(), recordSize, '_', true)); + bkpbase = new kelondroMap(kelondroDyn.open(bkppath, bufferkb / 2 * 0x400, preloadTime, keyLength + dateFormat.length(), recordSize, '_', true, false)); } } diff --git a/source/de/anomic/kelondro/kelondroDyn.java b/source/de/anomic/kelondro/kelondroDyn.java index 61a0fb82b..2becf5f2b 100644 --- a/source/de/anomic/kelondro/kelondroDyn.java +++ b/source/de/anomic/kelondro/kelondroDyn.java @@ -72,20 +72,20 @@ public class kelondroDyn { private kelondroObjectBuffer buffer; private kelondroRow rowdef; - public kelondroDyn(File file, long buffersize /*bytes*/, long preloadTime, int key, int nodesize, char fillChar, boolean usetree) throws IOException { - this(file, buffersize, preloadTime, key, nodesize, fillChar, new kelondroNaturalOrder(true), usetree); + public kelondroDyn(File file, long buffersize /*bytes*/, long preloadTime, int key, int nodesize, char fillChar, boolean usetree, boolean writebuffer) throws IOException { + this(file, buffersize, preloadTime, key, nodesize, fillChar, new kelondroNaturalOrder(true), usetree, writebuffer); } public kelondroDyn(File file, long buffersize /* bytes */, long preloadTime, int key, - int nodesize, char fillChar, kelondroOrder objectOrder, boolean usetree) throws IOException { + int nodesize, char fillChar, kelondroOrder objectOrder, boolean usetree, boolean writebuffer) throws IOException { // creates or opens a dynamic tree rowdef = new kelondroRow("byte[] key-" + (key + counterlen) + ", byte[] node-" + nodesize, objectOrder, 0); if (usetree) { kelondroTree tree = new kelondroTree(file, buffersize / 2, preloadTime, rowdef, 1, 8); - this.index = new kelondroCache(tree, buffersize / 2, true, false); + this.index = new kelondroCache(tree, buffersize / 2, true, writebuffer); } else { kelondroFlexTable table = new kelondroFlexTable(file.getParentFile(), file.getName(), buffersize / 2, -1, rowdef); - this.index = new kelondroCache(table, buffersize / 2, true, false); + this.index = new kelondroCache(table, buffersize / 2, true, writebuffer); } this.keylen = index.row().width(0) - counterlen; this.reclen = index.row().width(1); @@ -95,20 +95,20 @@ public class kelondroDyn { buffer = new kelondroObjectBuffer(file.toString()); } - public static final kelondroDyn open(File file, long buffersize /* bytes */, long preloadTime, int key, int nodesize, char fillChar, boolean usetree) { - return open(file, buffersize, preloadTime, key, nodesize, fillChar, new kelondroNaturalOrder(true), usetree); + public static final kelondroDyn open(File file, long buffersize /* bytes */, long preloadTime, int key, int nodesize, char fillChar, boolean usetree, boolean writebuffer) { + return open(file, buffersize, preloadTime, key, nodesize, fillChar, new kelondroNaturalOrder(true), usetree, writebuffer); } public static final kelondroDyn open(File file, long buffersize /* bytes */, long preloadTime, int key, - int nodesize, char fillChar, kelondroOrder objectOrder, boolean usetree) { + int nodesize, char fillChar, kelondroOrder objectOrder, boolean usetree, boolean writebuffer) { // opens new or existing file; in case that any error occur the file is deleted again and it is tried to create the file again // if that fails, the method returns null try { - return new kelondroDyn(file, buffersize, preloadTime, key, nodesize, fillChar, objectOrder, usetree); + return new kelondroDyn(file, buffersize, preloadTime, key, nodesize, fillChar, objectOrder, usetree, writebuffer); } catch (IOException e) { file.delete(); try { - return new kelondroDyn(file, buffersize, preloadTime, key, nodesize, fillChar, objectOrder, usetree); + return new kelondroDyn(file, buffersize, preloadTime, key, nodesize, fillChar, objectOrder, usetree, writebuffer); } catch (IOException ee) { serverLog.logSevere("kelondroDyn", "cannot open or create file " + file.toString()); e.printStackTrace(); @@ -489,7 +489,7 @@ public class kelondroDyn { if (args.length == 1) { // open a db and list keys try { - kelondroDyn kd = new kelondroDyn(new File(args[0]), 0x100000, 0, 4 ,100, '_', false); + kelondroDyn kd = new kelondroDyn(new File(args[0]), 0x100000, 0, 4 ,100, '_', false, false); System.out.println(kd.sizeDyn() + " elements in DB"); Iterator i = kd.dynKeys(true, false); while (i.hasNext()) @@ -506,7 +506,7 @@ public class kelondroDyn { File f = new File(args[3]); kelondroDyn kd; try { - kd = new kelondroDyn(db, 0x100000, 0, 80, 200, '_', false); + kd = new kelondroDyn(db, 0x100000, 0, 80, 200, '_', false, false); if (writeFile) kd.readFile(key, f); else diff --git a/source/de/anomic/kelondro/kelondroDynTree.java b/source/de/anomic/kelondro/kelondroDynTree.java index fc6a5130e..8d5c55729 100644 --- a/source/de/anomic/kelondro/kelondroDynTree.java +++ b/source/de/anomic/kelondro/kelondroDynTree.java @@ -79,7 +79,7 @@ public class kelondroDynTree { this.cache = new Hashtable(); //this.cycleCache = Long.MIN_VALUE; this.cycleBuffer = Long.MIN_VALUE; - this.table = new kelondroDyn(file, buffersize, preloadTime, keylength, nodesize, fillChar, true); + this.table = new kelondroDyn(file, buffersize, preloadTime, keylength, nodesize, fillChar, true, false); this.treeRAHandles = new Hashtable(); } diff --git a/source/de/anomic/kelondro/kelondroMapTable.java b/source/de/anomic/kelondro/kelondroMapTable.java index 146418986..f1c4cb2b4 100644 --- a/source/de/anomic/kelondro/kelondroMapTable.java +++ b/source/de/anomic/kelondro/kelondroMapTable.java @@ -82,7 +82,7 @@ public class kelondroMapTable { File tablefile = new File(tablesPath, "table." + tablename + ".mdb"); kelondroDyn dyn; if (!(tablefile.exists())) tablefile.getParentFile().mkdirs(); - dyn = new kelondroDyn(tablefile, buffersize, preloadTime, keysize, nodesize, fillChar, true); + dyn = new kelondroDyn(tablefile, buffersize, preloadTime, keysize, nodesize, fillChar, true, false); kelondroMap map = new kelondroMap(dyn, sortfields, accfields); mTables.put(tablename, map); } diff --git a/source/de/anomic/plasma/plasmaCrawlProfile.java b/source/de/anomic/plasma/plasmaCrawlProfile.java index c2d11ce26..2ebd762a8 100644 --- a/source/de/anomic/plasma/plasmaCrawlProfile.java +++ b/source/de/anomic/plasma/plasmaCrawlProfile.java @@ -69,7 +69,7 @@ public class plasmaCrawlProfile { this.bufferkb = bufferkb; this.preloadTime = preloadTime; profileTableFile.getParentFile().mkdirs(); - kelondroDyn dyn = kelondroDyn.open(profileTableFile, bufferkb * 1024, preloadTime, crawlProfileHandleLength, 2000, '#', true); + kelondroDyn dyn = kelondroDyn.open(profileTableFile, bufferkb * 1024, preloadTime, crawlProfileHandleLength, 2000, '#', true, false); profileTable = new kelondroMap(dyn); domsCache = new HashMap(); } @@ -95,7 +95,7 @@ public class plasmaCrawlProfile { if (profileTable != null) try { profileTable.close(); } catch (IOException e) {} if (!(profileTableFile.delete())) throw new RuntimeException("cannot delete crawl profile database"); profileTableFile.getParentFile().mkdirs(); - kelondroDyn dyn = kelondroDyn.open(profileTableFile, bufferkb * 1024, preloadTime, crawlProfileHandleLength, 2000, '#', true); + kelondroDyn dyn = kelondroDyn.open(profileTableFile, bufferkb * 1024, preloadTime, crawlProfileHandleLength, 2000, '#', true, false); profileTable = new kelondroMap(dyn); } diff --git a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java index 60d1ae06d..b0f14d732 100644 --- a/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java +++ b/source/de/anomic/plasma/plasmaCrawlRobotsTxt.java @@ -73,7 +73,7 @@ public class plasmaCrawlRobotsTxt { this.bufferkb = bufferkb; this.preloadTime = preloadTime; robotsTableFile.getParentFile().mkdirs(); - robotsTable = new kelondroMap(kelondroDyn.open(robotsTableFile, bufferkb * 1024, preloadTime, 256, 512, '_', true)); + robotsTable = new kelondroMap(kelondroDyn.open(robotsTableFile, bufferkb * 1024, preloadTime, 256, 512, '_', true, false)); } public int cacheNodeChunkSize() { @@ -99,7 +99,7 @@ public class plasmaCrawlRobotsTxt { } catch (IOException e) {} if (!(robotsTableFile.delete())) throw new RuntimeException("cannot delete robots.txt database"); robotsTableFile.getParentFile().mkdirs(); - robotsTable = new kelondroMap(kelondroDyn.open(robotsTableFile, this.bufferkb, preloadTime, 256, 512, '_', true)); + robotsTable = new kelondroMap(kelondroDyn.open(robotsTableFile, this.bufferkb, preloadTime, 256, 512, '_', true, false)); } public void close() { diff --git a/source/de/anomic/plasma/plasmaGrafics.java b/source/de/anomic/plasma/plasmaGrafics.java index 5ff54d66c..176e57cd0 100644 --- a/source/de/anomic/plasma/plasmaGrafics.java +++ b/source/de/anomic/plasma/plasmaGrafics.java @@ -60,7 +60,23 @@ public class plasmaGrafics { private static int shortestName = 10; private static int longestName = 12; - private static ymageMatrix networkPicture = null; + private static final String COL_DHTCIRCLE = "400030"; /*"008020"*/ + private static final long COL_HEADLINE = ymageMatrix.SUBTRACTIVE_BLACK; + private static final String COL_BACKGROUND = "080808"; /*"FFFFE0"*/ + private static final String COL_ACTIVE_DOT = "181808"; + private static final String COL_ACTIVE_LINE = "604040"; + private static final String COL_ACTIVE_TEXT = "b080b0"; + private static final String COL_PASSIVE_DOT = "101010"; + private static final String COL_PASSIVE_LINE = "404040"; + private static final String COL_PASSIVE_TEXT = "a0a0a0"; + private static final String COL_POTENTIAL_DOT = "041010"; + private static final String COL_POTENTIAL_LINE = "104040"; + private static final String COL_POTENTIAL_TEXT = "80b0b0"; + private static final String COL_WE_DOT = "206060"; + private static final String COL_WE_LINE = "b0f0f0"; + private static final String COL_WE_TEXT = "f0f0f0"; + + private static ymageMatrix networkPicture = null; private static long networkPictureDate = 0; public static ymageMatrix getSearchEventPicture() { @@ -134,11 +150,11 @@ public class plasmaGrafics { if (yacyCore.seedDB == null) return; // no other peers known - networkPicture = new ymageMatrix(width, height, "101010" /*"FFFFE0"*/); + networkPicture = new ymageMatrix(width, height, COL_BACKGROUND); networkPicture.setMode(ymageMatrix.MODE_SUB); // draw network circle - networkPicture.setColor("A02080" /*"008020"*/); + networkPicture.setColor(COL_DHTCIRCLE); networkPicture.arc(width / 2, height / 2, innerradius - 20, innerradius + 20, 0, 360); //System.out.println("Seed Maximum distance is " + yacySeed.maxDHTDistance); @@ -154,7 +170,7 @@ public class plasmaGrafics { while (e.hasMoreElements() && count < maxCount) { seed = (yacySeed) e.nextElement(); if (seed != null) { - drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "404000", "E8C0E8", "B0FFB0", corona); + drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, COL_ACTIVE_DOT, COL_ACTIVE_LINE, COL_ACTIVE_TEXT, corona); count++; } } @@ -168,7 +184,7 @@ public class plasmaGrafics { if (seed != null) { lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenTime()) / 1000 / 60); if (lastseen > passiveLimit) break; // we have enough, this list is sorted so we don't miss anything - drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "101010", "401000", "802000", corona); + drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, COL_PASSIVE_DOT, COL_PASSIVE_LINE, COL_PASSIVE_TEXT, corona); count++; } } @@ -182,17 +198,17 @@ public class plasmaGrafics { if (seed != null) { lastseen = Math.abs((System.currentTimeMillis() - seed.getLastSeenTime()) / 1000 / 60); if (lastseen > potentialLimit) break; // we have enough, this list is sorted so we don't miss anything - drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, "202040", "5050A0", "A0A0FF", corona); + drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, seed, COL_POTENTIAL_DOT, COL_POTENTIAL_LINE, COL_POTENTIAL_TEXT, corona); count++; } } totalCount += count; // draw my own peer - drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, "008080", "AAAAAA", "FFFFFF", corona); + drawNetworkPicturePeer(networkPicture, width / 2, height / 2, innerradius, outerradius, yacyCore.seedDB.mySeed, COL_WE_DOT, COL_WE_LINE, COL_WE_TEXT, corona); // draw description - networkPicture.setColor(ymageMatrix.SUBTRACTIVE_BLACK); + networkPicture.setColor(COL_HEADLINE); networkPicture.setMode(ymageMatrix.MODE_SUB); ymageToolPrint.print(networkPicture, 2, 8, 0, "THE YACY NETWORK", true); ymageToolPrint.print(networkPicture, 2, 16, 0, "DRAWING OF " + totalCount + " SELECTED PEERS", true); diff --git a/source/de/anomic/plasma/plasmaHTCache.java b/source/de/anomic/plasma/plasmaHTCache.java index 2282c9451..e940525ca 100644 --- a/source/de/anomic/plasma/plasmaHTCache.java +++ b/source/de/anomic/plasma/plasmaHTCache.java @@ -7,7 +7,7 @@ // // $LastChangedDate$ // $LastChangedRevision$ -// $LastChangedBy$ +// $LastChangedBy: $ // // 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 @@ -174,7 +174,7 @@ public final class plasmaHTCache { // open the response header database File dbfile = new File(this.cachePath, "responseHeader.db"); try { - this.responseHeaderDB = new kelondroMap(new kelondroDyn(dbfile, bufferkb * 0x400, preloadTime, yacySeedDB.commonHashLength, 150, '#', true)); + this.responseHeaderDB = new kelondroMap(new kelondroDyn(dbfile, bufferkb * 0x400, preloadTime, yacySeedDB.commonHashLength, 150, '#', true, false)); } catch (IOException e) { this.log.logSevere("the request header database could not be opened: " + e.getMessage()); System.exit(0); diff --git a/source/de/anomic/yacy/yacySeedDB.java b/source/de/anomic/yacy/yacySeedDB.java index a48ee7467..6a9960462 100644 --- a/source/de/anomic/yacy/yacySeedDB.java +++ b/source/de/anomic/yacy/yacySeedDB.java @@ -6,7 +6,7 @@ // // $LastChangedDate$ // $LastChangedRevision$ -// $LastChangedBy$ +// $LastChangedBy: $ // // 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 @@ -206,11 +206,11 @@ public final class yacySeedDB { private synchronized kelondroMap openSeedTable(File seedDBFile) { new File(seedDBFile.getParent()).mkdirs(); try { - return new kelondroMap(kelondroDyn.open(seedDBFile, (seedDBBufferKB * 0x400) / 3, preloadTime / 3, commonHashLength, 480, '#', false), sortFields, accFields); + return new kelondroMap(kelondroDyn.open(seedDBFile, (seedDBBufferKB * 0x400) / 3, preloadTime / 3, commonHashLength, 480, '#', false, false), sortFields, accFields); } catch (Exception e) { seedDBFile.delete(); // try again - return new kelondroMap(kelondroDyn.open(seedDBFile, (seedDBBufferKB * 0x400) / 3, preloadTime / 3, commonHashLength, 480, '#', false), sortFields, accFields); + return new kelondroMap(kelondroDyn.open(seedDBFile, (seedDBBufferKB * 0x400) / 3, preloadTime / 3, commonHashLength, 480, '#', false, false), sortFields, accFields); } } diff --git a/source/yacy.java b/source/yacy.java index 38a9b0908..dbc048e05 100644 --- a/source/yacy.java +++ b/source/yacy.java @@ -1324,7 +1324,7 @@ public final class yacy { String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"}; for (int i=0; i < dbFileNames.length; i++) { File dbFile = new File(yacyDBPath,dbFileNames[i]); - kelondroMap db = new kelondroMap(new kelondroDyn(dbFile, (1024 * 0x400) / 3, 3000, yacySeedDB.commonHashLength, 480, '#', true), yacySeedDB.sortFields, yacySeedDB.accFields); + kelondroMap db = new kelondroMap(new kelondroDyn(dbFile, (1024 * 0x400) / 3, 3000, yacySeedDB.commonHashLength, 480, '#', true, false), yacySeedDB.sortFields, yacySeedDB.accFields); kelondroMap.mapIterator it; it = db.maps(true, false);