generalized index object for eurl, nurl and lurl to prepare move

of these tables to new kelondroFlexTable Object

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2382 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 19 years ago
parent acdf24877f
commit 130e6d4719

@ -33,6 +33,7 @@ import java.text.SimpleDateFormat;
import java.util.HashMap;
import de.anomic.kelondro.kelondroBase64Order;
import de.anomic.kelondro.kelondroIndex;
import de.anomic.kelondro.kelondroTree;
import de.anomic.server.serverCodings;
import de.anomic.yacy.yacySeedDB;
@ -405,14 +406,18 @@ public class indexURL {
// the class object
protected kelondroTree urlHashCache;
protected kelondroIndex urlHashCache;
public indexURL() {
urlHashCache = null;
}
public int size() {
try {
return urlHashCache.size();
} catch (IOException e) {
return 0;
}
}
public boolean remove(String hash) {
@ -429,15 +434,18 @@ public class indexURL {
}
public int cacheNodeChunkSize() {
return urlHashCache.cacheNodeChunkSize();
if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheNodeChunkSize();
return 0;
}
public int[] cacheNodeStatus() {
return urlHashCache.cacheNodeStatus();
if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheNodeStatus();
return null;
}
public String[] cacheObjectStatus() {
return urlHashCache.cacheObjectStatus();
if (urlHashCache instanceof kelondroTree) return ((kelondroTree) urlHashCache).cacheObjectStatus();
return null;
}

@ -140,8 +140,9 @@ public class plasmaCrawlEURL extends indexURL {
if (cachePath.exists()) try {
// open existing cache
urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
urlHashCache.assignRowdef(rowdef);
kelondroTree tree = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
tree.assignRowdef(rowdef);
urlHashCache = tree;
} catch (IOException e) {
cachePath.delete();
urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true);

@ -115,8 +115,9 @@ public final class plasmaCrawlLURL extends indexURL {
if (cachePath.exists()) {
// open existing cache
try {
urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
urlHashCache.assignRowdef(rowdef);
kelondroTree tree = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
tree.assignRowdef(rowdef);
urlHashCache = tree;
} catch (IOException e) {
cachePath.getParentFile().mkdirs();
urlHashCache = new kelondroTree(cachePath, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true);

@ -168,8 +168,9 @@ public class plasmaCrawlNURL extends indexURL {
File cacheFile = new File(cacheStacksPath, "urlNotice1.db");
if (cacheFile.exists()) try {
// open existing cache
urlHashCache = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
urlHashCache.assignRowdef(rowdef);
kelondroTree tree = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent);
tree.assignRowdef(rowdef);
urlHashCache = tree;
} catch (IOException e) {
cacheFile.delete();
urlHashCache = new kelondroTree(cacheFile, bufferkb * 0x400, preloadTime, kelondroTree.defaultObjectCachePercent, rowdef, true);
@ -250,15 +251,6 @@ public class plasmaCrawlNURL extends indexURL {
}
}
/*
private static String normalizeHost(String host) {
if (host.length() > urlHostLength) host = host.substring(0, urlHostLength);
host = host.toLowerCase();
while (host.length() < urlHostLength) host = host + " ";
return host;
}
*/
private static String normalizeHandle(int h) {
String d = Integer.toHexString(h);
while (d.length() < urlHandleLength) d = "0" + d;
@ -484,7 +476,6 @@ public class plasmaCrawlNURL extends indexURL {
this.flags = new bitfield(urlFlagLength);
this.handle = 0;
this.stored = false;
store();
}
public Entry(String hash) throws IOException {

Loading…
Cancel
Save