refactoring of blob package classes

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@6088 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
orbiter 16 years ago
parent 8b8877c233
commit ae015e8e98

@ -30,7 +30,7 @@ import java.util.Iterator;
import java.util.Map;
import de.anomic.http.httpRequestHeader;
import de.anomic.kelondro.blob.Cache;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.table.EcoTable;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.kelondro.util.FileUtils;

@ -32,7 +32,7 @@ import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.regex.Pattern;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.order.CloneableIterator;
@ -67,7 +67,7 @@ public class CrawlProfile {
public CrawlProfile(final File file) throws IOException {
this.profileTableFile = file;
profileTableFile.getParentFile().mkdirs();
final BLOBHeap dyn = new BLOBHeap(profileTableFile, yacySeedDB.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64);
final Heap dyn = new Heap(profileTableFile, yacySeedDB.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64);
profileTable = new MapView(dyn, 500, '_');
}
@ -76,9 +76,9 @@ public class CrawlProfile {
if (profileTable != null) profileTable.close();
FileUtils.deletedelete(profileTableFile);
profileTableFile.getParentFile().mkdirs();
BLOBHeap dyn = null;
Heap dyn = null;
try {
dyn = new BLOBHeap(profileTableFile, yacySeedDB.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64);
dyn = new Heap(profileTableFile, yacySeedDB.commonHashLength, NaturalOrder.naturalOrder, 1024 * 64);
} catch (IOException e) {
e.printStackTrace();
}

@ -43,7 +43,7 @@ import java.util.concurrent.ConcurrentHashMap;
import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRequestHeader;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.NaturalOrder;
import de.anomic.kelondro.util.ByteBuffer;
@ -70,9 +70,9 @@ public class RobotsTxt {
public RobotsTxt(final File robotsTableFile) {
this.robotsTableFile = robotsTableFile;
robotsTableFile.getParentFile().mkdirs();
BLOBHeap blob = null;
Heap blob = null;
try {
blob = new BLOBHeap(robotsTableFile, 64, NaturalOrder.naturalOrder, 1024 * 1024);
blob = new Heap(robotsTableFile, 64, NaturalOrder.naturalOrder, 1024 * 1024);
} catch (final IOException e) {
e.printStackTrace();
}
@ -85,9 +85,9 @@ public class RobotsTxt {
if (robotsTable != null) robotsTable.close();
FileUtils.deletedelete(robotsTableFile);
robotsTableFile.getParentFile().mkdirs();
BLOBHeap blob = null;
Heap blob = null;
try {
blob = new BLOBHeap(robotsTableFile, 64, NaturalOrder.naturalOrder, 1024 * 1024);
blob = new Heap(robotsTableFile, 64, NaturalOrder.naturalOrder, 1024 * 1024);
} catch (final IOException e) {
e.printStackTrace();
}

@ -36,7 +36,7 @@ import java.util.Map;
import java.util.Random;
import de.anomic.http.httpRequestHeader;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.BLOBTree;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.Base64Order;
@ -69,7 +69,7 @@ public final class userDB {
FileUtils.deletedelete(userTableFile);
userTableFile.getParentFile().mkdirs();
try {
userTable = new MapView(new BLOBHeap(userTableFile, 256, NaturalOrder.naturalOrder, 1024 * 64), 10, '_');
userTable = new MapView(new Heap(userTableFile, 256, NaturalOrder.naturalOrder, 1024 * 64), 10, '_');
} catch (IOException e) {
e.printStackTrace();
}

@ -50,11 +50,11 @@ import de.anomic.kelondro.util.DateFormatter;
import de.anomic.kelondro.util.FileUtils;
import de.anomic.yacy.logging.Log;
public class BLOBArray implements BLOB {
public class ArrayStack implements BLOB {
/*
* This class implements a BLOB using a set of kelondroBLOBHeap objects
* In addition to a kelondroBLOBHeap this BLOB can delete large amounts of data using a given time limit.
* This class implements a BLOB using a set of Heap objects
* In addition to a Heap this BLOB can delete large amounts of data using a given time limit.
* This is realized by creating separate BLOB files. New Files are created when either
* - a given time limit is reached
* - a given space limit is reached
@ -78,7 +78,7 @@ public class BLOBArray implements BLOB {
private String prefix;
private int buffersize;
public BLOBArray(
public ArrayStack(
final File heapLocation,
final String prefix,
final int keylength,
@ -158,7 +158,7 @@ public class BLOBArray implements BLOB {
d = DateFormatter.parseShortMilliSecond(files[i].substring(prefix.length() + 1, prefix.length() + 18));
f = new File(heapLocation, files[i]);
time = d.getTime();
oneBlob = (time == maxtime) ? new BLOBHeap(f, keylength, ordering, buffersize) : new BLOBHeapModifier(f, keylength, ordering);
oneBlob = (time == maxtime) ? new Heap(f, keylength, ordering, buffersize) : new HeapModifier(f, keylength, ordering);
sortedItems.put(Long.valueOf(time), new blobItem(d, f, oneBlob));
} catch (ParseException e) {continue;}
}
@ -184,7 +184,7 @@ public class BLOBArray implements BLOB {
} catch (ParseException e) {
throw new IOException("date parse problem with file " + location.toString() + ": " + e.getMessage());
}
BLOB oneBlob = (full && buffersize > 0) ? new BLOBHeap(location, keylength, ordering, buffersize) : new BLOBHeapModifier(location, keylength, ordering);
BLOB oneBlob = (full && buffersize > 0) ? new Heap(location, keylength, ordering, buffersize) : new HeapModifier(location, keylength, ordering);
blobs.add(new blobItem(d, location, oneBlob));
}
@ -379,7 +379,7 @@ public class BLOBArray implements BLOB {
// make a new blob file and assign it in this item
this.creation = new Date();
this.location = newBLOB(this.creation);
this.blob = (buffer == 0) ? new BLOBHeapModifier(location, keylength, ordering) : new BLOBHeap(location, keylength, ordering, buffer);
this.blob = (buffer == 0) ? new HeapModifier(location, keylength, ordering) : new Heap(location, keylength, ordering, buffer);
}
}
@ -586,7 +586,7 @@ public class BLOBArray implements BLOB {
bi = new blobItem(buffersize);
blobs.add(bi);
}
assert bi.blob instanceof BLOBHeap;
assert bi.blob instanceof Heap;
bi.blob.put(key, b);
executeLimits();
}
@ -746,7 +746,7 @@ public class BLOBArray implements BLOB {
final File f = new File("/Users/admin/blobarraytest");
try {
//f.delete();
final BLOBArray heap = new BLOBArray(f, "test", 12, NaturalOrder.naturalOrder, 512 * 1024);
final ArrayStack heap = new ArrayStack(f, "test", 12, NaturalOrder.naturalOrder, 512 * 1024);
heap.put("aaaaaaaaaaaa".getBytes(), "eins zwei drei".getBytes());
heap.put("aaaaaaaaaaab".getBytes(), "vier fuenf sechs".getBytes());
heap.put("aaaaaaaaaaac".getBytes(), "sieben acht neun".getBytes());

@ -42,6 +42,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.Iterator;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.ObjectIndex;
import de.anomic.kelondro.io.AbstractRandomAccess;
@ -67,7 +68,7 @@ public class BLOBTree {
private final Row rowdef;
/**
* Deprecated Class. Please use kelondroBLOBHeap instead
* Deprecated Class. Please use Heap instead
*/
private BLOBTree(final File file, final boolean useNodeCache, final boolean useObjectCache, final int key,
final int nodesize, final char fillChar, final ByteOrder objectOrder) {
@ -90,15 +91,15 @@ public class BLOBTree {
buffer = new ObjectBuffer(file.toString());
}
public static BLOBHeap toHeap(final File file, final boolean useNodeCache, final boolean useObjectCache, final int key,
public static Heap toHeap(final File file, final boolean useNodeCache, final boolean useObjectCache, final int key,
final int nodesize, final char fillChar, final ByteOrder objectOrder, final File blob) throws IOException {
if (blob.exists() || !file.exists()) {
// open the blob file and ignore the tree
return new BLOBHeap(blob, key, objectOrder, 1024 * 64);
return new Heap(blob, key, objectOrder, 1024 * 64);
}
// open a Tree and migrate everything to a Heap
BLOBTree tree = new BLOBTree(file, useNodeCache, useObjectCache, key, nodesize, fillChar, objectOrder);
BLOBHeap heap = new BLOBHeap(blob, key, objectOrder, 1024 * 64);
Heap heap = new Heap(blob, key, objectOrder, 1024 * 64);
Iterator<byte[]> i = tree.keys(true, false);
byte[] k, kk = new byte[key], v;
String s;

@ -1,4 +1,4 @@
// kelondroBLOBCompressor.java
// Compressor.java
// (C) 2008 by Michael Peter Christen; mc@yacy.net, Frankfurt a. M., Germany
// first published 17.10.2008 on http://yacy.net
//
@ -41,7 +41,7 @@ import de.anomic.kelondro.order.ByteOrder;
import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.util.ByteArray;
public class BLOBCompressor implements BLOB {
public class Compressor implements BLOB {
static byte[] gzipMagic = {(byte) 'z', (byte) '|'}; // magic for gzip-encoded content
static byte[] plainMagic = {(byte) 'p', (byte) '|'}; // magic for plain content (no encoding)
@ -52,7 +52,7 @@ public class BLOBCompressor implements BLOB {
private long maxbufferlength;
private int cdr;
public BLOBCompressor(BLOB backend, long buffersize) {
public Compressor(BLOB backend, long buffersize) {
this.backend = backend;
this.maxbufferlength = buffersize;
this.cdr = 0;

@ -37,7 +37,7 @@ import de.anomic.kelondro.order.ByteOrder;
import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.order.NaturalOrder;
public final class BLOBHeap extends BLOBHeapModifier implements BLOB {
public final class Heap extends HeapModifier implements BLOB {
private HashMap<String, byte[]> buffer; // a write buffer to limit IO to the file; attention: Maps cannot use byte[] as key
private int buffersize; // bytes that are buffered in buffer
@ -73,7 +73,7 @@ public final class BLOBHeap extends BLOBHeapModifier implements BLOB {
* @param ordering
* @throws IOException
*/
public BLOBHeap(
public Heap(
final File heapFile,
final int keylength,
final ByteOrder ordering,
@ -427,7 +427,7 @@ public final class BLOBHeap extends BLOBHeapModifier implements BLOB {
final File f = new File("/Users/admin/blobtest.heap");
try {
//f.delete();
final BLOBHeap heap = new BLOBHeap(f, 12, NaturalOrder.naturalOrder, 1024 * 512);
final Heap heap = new Heap(f, 12, NaturalOrder.naturalOrder, 1024 * 512);
heap.put("aaaaaaaaaaaa".getBytes(), "eins zwei drei".getBytes());
heap.put("aaaaaaaaaaab".getBytes(), "vier fuenf sechs".getBytes());
heap.put("aaaaaaaaaaac".getBytes(), "sieben acht neun".getBytes());
@ -460,7 +460,7 @@ public final class BLOBHeap extends BLOBHeapModifier implements BLOB {
final File f = new File("/Users/admin/blobtest.heap");
try {
//f.delete();
final MapView heap = new MapView(new BLOBHeap(f, 12, NaturalOrder.naturalOrder, 1024 * 512), 500, '_');
final MapView heap = new MapView(new Heap(f, 12, NaturalOrder.naturalOrder, 1024 * 512), 500, '_');
heap.put("aaaaaaaaaaaa", map("aaaaaaaaaaaa", "eins zwei drei"));
heap.put("aaaaaaaaaaab", map("aaaaaaaaaaab", "vier fuenf sechs"));
heap.put("aaaaaaaaaaac", map("aaaaaaaaaaac", "sieben acht neun"));

@ -36,7 +36,7 @@ import de.anomic.kelondro.util.FileUtils;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.yacy.logging.Log;
public class BLOBHeapModifier extends HeapReader implements BLOB {
public class HeapModifier extends HeapReader implements BLOB {
/*
* This class adds a remove operation to a BLOBHeapReader. That means that a BLOBModifier can
@ -53,7 +53,7 @@ public class BLOBHeapModifier extends HeapReader implements BLOB {
* @param ordering
* @throws IOException
*/
public BLOBHeapModifier(final File heapFile, final int keylength, final ByteOrder ordering) throws IOException {
public HeapModifier(final File heapFile, final int keylength, final ByteOrder ordering) throws IOException {
super(heapFile, keylength, ordering);
mergeFreeEntries();
}

@ -44,7 +44,7 @@ public class MapDataMining extends MapView {
private HashMap<String, Object> accMap; // to store accumulations of specific fields
@SuppressWarnings("unchecked")
public MapDataMining(final BLOBHeap dyn, final int cachesize, final String[] sortfields, final String[] longaccfields, final String[] doubleaccfields, final Method externalInitializer, final Object externalHandler) {
public MapDataMining(final Heap dyn, final int cachesize, final String[] sortfields, final String[] longaccfields, final String[] doubleaccfields, final Method externalInitializer, final Object externalHandler) {
super(dyn, cachesize, '_');
// create fast ordering clusters and acc fields

@ -55,7 +55,7 @@ public class MapView {
private final char fillchar;
public MapView(final BLOBHeap blob, final int cachesize, char fillchar) {
public MapView(final Heap blob, final int cachesize, char fillchar) {
this.blob = blob;
this.cache = new HashMap<String, Map<String, String>>();
this.cacheScore = new ScoreCluster<String>();
@ -352,7 +352,7 @@ public class MapView {
if (f.exists()) FileUtils.deletedelete(f);
try {
// make a blob
BLOBHeap blob = new BLOBHeap(f, 12, NaturalOrder.naturalOrder, 1024 * 1024);
Heap blob = new Heap(f, 12, NaturalOrder.naturalOrder, 1024 * 1024);
// make map
MapView map = new MapView(blob, 1024, '_');
// put some values into the map

@ -25,7 +25,7 @@
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
package de.anomic.kelondro.blob;
package de.anomic.kelondro.index;
import java.io.IOException;
import java.util.ArrayList;
@ -36,12 +36,6 @@ import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import de.anomic.kelondro.index.Column;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.RowCollection;
import de.anomic.kelondro.index.RowSet;
import de.anomic.kelondro.index.ObjectIndex;
import de.anomic.kelondro.index.Row.Entry;
import de.anomic.kelondro.order.CloneableIterator;
import de.anomic.kelondro.table.CachedRecords;
import de.anomic.kelondro.util.MemoryControl;
@ -227,7 +221,7 @@ public class Cache implements ObjectIndex {
return index.has(key);
}
public synchronized Entry get(final byte[] key) throws IOException {
public synchronized Row.Entry get(final byte[] key) throws IOException {
// first look into the miss cache
if (readMissCache != null) {
if (readMissCache.get(key) == null) {
@ -238,7 +232,7 @@ public class Cache implements ObjectIndex {
}
}
Entry entry = null;
Row.Entry entry = null;
// then try the hit cache and the buffers
if (readHitCache != null) {
@ -268,7 +262,7 @@ public class Cache implements ObjectIndex {
return entry;
}
public synchronized void put(final Entry row) throws IOException {
public synchronized void put(final Row.Entry row) throws IOException {
assert (row != null);
assert (row.columns() == row().columns());
//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));
@ -298,7 +292,7 @@ public class Cache implements ObjectIndex {
}
}
public synchronized Entry replace(final Entry row) throws IOException {
public synchronized Row.Entry replace(final Row.Entry row) throws IOException {
assert (row != null);
assert (row.columns() == row().columns());
//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));
@ -320,7 +314,7 @@ public class Cache implements ObjectIndex {
}
}
Entry entry;
Row.Entry entry;
if (readHitCache != null) {
entry = readHitCache.get(key);
@ -344,7 +338,7 @@ public class Cache implements ObjectIndex {
return entry;
}
public synchronized void addUnique(final Entry row) throws IOException {
public synchronized void addUnique(final Row.Entry row) throws IOException {
assert (row != null);
assert (row.columns() == row().columns());
//assert (!(serverLog.allZero(row.getColBytes(index.primarykey()))));
@ -373,7 +367,7 @@ public class Cache implements ObjectIndex {
}
}
public synchronized void addUnique(final Entry row, final Date entryDate) throws IOException {
public synchronized void addUnique(final Row.Entry row, final Date entryDate) throws IOException {
if (entryDate == null) {
addUnique(row);
return;
@ -399,8 +393,8 @@ public class Cache implements ObjectIndex {
}
}
public synchronized void addUnique(final List<Entry> rows) throws IOException {
final Iterator<Entry> i = rows.iterator();
public synchronized void addUnique(final List<Row.Entry> rows) throws IOException {
final Iterator<Row.Entry> i = rows.iterator();
while (i.hasNext()) addUnique(i.next());
}
@ -409,7 +403,7 @@ public class Cache implements ObjectIndex {
// todo: remove reported entries from the cache!!!
}
public synchronized Entry remove(final byte[] key) throws IOException {
public synchronized Row.Entry remove(final byte[] key) throws IOException {
checkMissSpace();
// add entry to miss-cache
@ -426,7 +420,7 @@ public class Cache implements ObjectIndex {
// remove entry from hit-cache
if (readHitCache != null) {
final Entry entry = readHitCache.remove(key);
final Row.Entry entry = readHitCache.remove(key);
if (entry == null) {
this.readMiss++;
} else {
@ -438,11 +432,11 @@ public class Cache implements ObjectIndex {
return index.remove(key);
}
public synchronized Entry removeOne() throws IOException {
public synchronized Row.Entry removeOne() throws IOException {
checkMissSpace();
final Entry entry = index.removeOne();
final Row.Entry entry = index.removeOne();
if (entry == null) return null;
final byte[] key = entry.getPrimaryKeyBytes();
if (readMissCache != null) {

@ -47,8 +47,8 @@ import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import de.anomic.kelondro.blob.BLOBArray;
import de.anomic.kelondro.blob.Cache;
import de.anomic.kelondro.blob.ArrayStack;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.index.Column;
import de.anomic.kelondro.index.ObjectIndexCache;
import de.anomic.kelondro.index.Row;
@ -90,7 +90,7 @@ public class SplitTable implements ObjectIndex {
final String tablename,
final Row rowdef,
final boolean resetOnFail) {
this(path, tablename, rowdef, BLOBArray.oneMonth, (long) Integer.MAX_VALUE, resetOnFail);
this(path, tablename, rowdef, ArrayStack.oneMonth, (long) Integer.MAX_VALUE, resetOnFail);
}
public SplitTable(

@ -29,7 +29,7 @@ import java.io.IOException;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Semaphore;
import de.anomic.kelondro.blob.BLOBArray;
import de.anomic.kelondro.blob.ArrayStack;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.util.MemoryControl;
import de.anomic.yacy.logging.Log;
@ -99,7 +99,7 @@ public class IODispatcher extends Thread {
return (controlQueue == null || !this.isAlive()) ? 0 : controlQueue.availablePermits();
}
public synchronized void merge(File f1, File f2, ReferenceFactory<? extends Reference> factory, BLOBArray array, Row payloadrow, File newFile) {
public synchronized void merge(File f1, File f2, ReferenceFactory<? extends Reference> factory, ArrayStack array, Row payloadrow, File newFile) {
if (mergeQueue == null || controlQueue == null || !this.isAlive()) {
try {
Log.logWarning("IODispatcher", "emergency merge of files " + f1.getName() + ", " + f2.getName() + " to " + newFile.getName());
@ -214,7 +214,7 @@ public class IODispatcher extends Thread {
public class MergeJob {
File f1, f2, newFile;
BLOBArray array;
ArrayStack array;
Row payloadrow;
ReferenceFactory<? extends Reference> factory;
@ -222,7 +222,7 @@ public class IODispatcher extends Thread {
File f1,
File f2,
ReferenceFactory<? extends Reference> factory,
BLOBArray array,
ArrayStack array,
Row payloadrow,
File newFile) {
this.f1 = f1;

@ -43,7 +43,7 @@ import de.anomic.htmlFilter.htmlFilterCharacterCoding;
import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRemoteProxyConfig;
import de.anomic.kelondro.blob.Cache;
import de.anomic.kelondro.index.Cache;
import de.anomic.kelondro.index.HandleSet;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.ObjectIndex;

@ -30,7 +30,7 @@ import java.util.Date;
import java.util.Iterator;
import de.anomic.kelondro.blob.BLOB;
import de.anomic.kelondro.blob.BLOBArray;
import de.anomic.kelondro.blob.ArrayStack;
import de.anomic.kelondro.index.HandleMap;
import de.anomic.kelondro.index.Row;
import de.anomic.kelondro.index.RowSet;
@ -42,7 +42,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
private final ReferenceFactory<ReferenceType> factory;
private final Row payloadrow;
private final BLOBArray array;
private final ArrayStack array;
private final IODispatcher merger;
/**
@ -63,7 +63,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
IODispatcher merger) throws IOException {
this.factory = factory;
this.payloadrow = payloadrow;
this.array = new BLOBArray(
this.array = new ArrayStack(
heapLocation,
"index",
payloadrow.primaryKeyLength,

@ -42,9 +42,9 @@ import java.util.HashMap;
import java.util.Map;
import de.anomic.http.httpResponseHeader;
import de.anomic.kelondro.blob.BLOBArray;
import de.anomic.kelondro.blob.BLOBCompressor;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.ArrayStack;
import de.anomic.kelondro.blob.Compressor;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapView;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.FileUtils;
@ -61,8 +61,8 @@ public final class plasmaHTCache {
public static final long oneday = 1000L * 60L * 60L * 24L; // milliseconds of a day
private static MapView responseHeaderDB = null;
private static BLOBCompressor fileDB = null;
private static BLOBArray fileDBunbuffered = null;
private static Compressor fileDB = null;
private static ArrayStack fileDBunbuffered = null;
public static long maxCacheSize = 0l;
public static File cachePath = null;
@ -127,17 +127,17 @@ public final class plasmaHTCache {
private static void openDB() {
// open the response header database
final File dbfile = new File(cachePath, RESPONSE_HEADER_DB_NAME);
BLOBHeap blob = null;
Heap blob = null;
try {
blob = new BLOBHeap(dbfile, yacySeedDB.commonHashLength, Base64Order.enhancedCoder, 1024 * 1024);
blob = new Heap(dbfile, yacySeedDB.commonHashLength, Base64Order.enhancedCoder, 1024 * 1024);
} catch (final IOException e) {
e.printStackTrace();
}
responseHeaderDB = new MapView(blob, 500, '_');
try {
fileDBunbuffered = new BLOBArray(new File(cachePath, FILE_DB_NAME), prefix, 12, Base64Order.enhancedCoder, 1024 * 1024 * 2);
fileDBunbuffered = new ArrayStack(new File(cachePath, FILE_DB_NAME), prefix, 12, Base64Order.enhancedCoder, 1024 * 1024 * 2);
fileDBunbuffered.setMaxSize(maxCacheSize);
fileDB = new BLOBCompressor(fileDBunbuffered, 2 * 1024 * 1024);
fileDB = new Compressor(fileDBunbuffered, 2 * 1024 * 1024);
} catch (IOException e) {
e.printStackTrace();
}

@ -46,7 +46,7 @@ import de.anomic.http.httpResponse;
import de.anomic.http.httpRequestHeader;
import de.anomic.http.httpd;
import de.anomic.http.httpdAlternativeDomainNames;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapDataMining;
import de.anomic.kelondro.order.Base64Order;
import de.anomic.kelondro.util.kelondroException;
@ -264,12 +264,12 @@ public final class yacySeedDB implements httpdAlternativeDomainNames {
initializeHandlerMethod = null;
}
try {
return new MapDataMining(new BLOBHeap(seedDBFile, commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
return new MapDataMining(new Heap(seedDBFile, commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
} catch (final Exception e) {
// try again
FileUtils.deletedelete(seedDBFile);
try {
return new MapDataMining(new BLOBHeap(seedDBFile, commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
return new MapDataMining(new Heap(seedDBFile, commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, sortFields, longaccFields, doubleaccFields, initializeHandlerMethod, this);
} catch (IOException e1) {
e1.printStackTrace();
System.exit(-1);

@ -52,7 +52,7 @@ import de.anomic.http.httpClient;
import de.anomic.http.httpResponse;
import de.anomic.http.httpRequestHeader;
import de.anomic.http.httpd;
import de.anomic.kelondro.blob.BLOBHeap;
import de.anomic.kelondro.blob.Heap;
import de.anomic.kelondro.blob.MapDataMining;
import de.anomic.kelondro.index.RowCollection;
import de.anomic.kelondro.order.Base64Order;
@ -946,7 +946,7 @@ public final class yacy {
final String[] dbFileNames = {"seed.new.db","seed.old.db","seed.pot.db"};
for (int i=0; i < dbFileNames.length; i++) {
final File dbFile = new File(yacyDBPath,dbFileNames[i]);
final MapDataMining db = new MapDataMining(new BLOBHeap(dbFile, yacySeedDB.commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, yacySeedDB.sortFields, yacySeedDB.longaccFields, yacySeedDB.doubleaccFields, null, null);
final MapDataMining db = new MapDataMining(new Heap(dbFile, yacySeedDB.commonHashLength, Base64Order.enhancedCoder, 1024 * 512), 500, yacySeedDB.sortFields, yacySeedDB.longaccFields, yacySeedDB.doubleaccFields, null, null);
MapDataMining.mapIterator it;
it = db.maps(true, false);

Loading…
Cancel
Save