Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

update to kelondro data structures

orbitereb79ceb3ffbe
diff --git a/source/net/yacy/kelondro/blob/Heap.java b/source/net/yacy/kelondro/blob/Heap.java
index e1b32405c..49252f29f 100755
--- a/source/net/yacy/kelondro/blob/Heap.java
+++ b/source/net/yacy/kelondro/blob/Heap.java
@@ -281,6 +281,10 @@ public final class Heap extends HeapModifier implements BLOB {
public void finalize() {
this.close();
}
+
+ public int getBuffermax() {
+ return this.buffermax;
+ }
/**
* write a whole byte array as BLOB to the table
diff --git a/source/net/yacy/kelondro/blob/HeapReader.java b/source/net/yacy/kelondro/blob/HeapReader.java
index e0f70864d..dbaeb5394 100644
--- a/source/net/yacy/kelondro/blob/HeapReader.java
+++ b/source/net/yacy/kelondro/blob/HeapReader.java
@@ -256,6 +256,10 @@ public class HeapReader {
return this.heapFile.getName();
}
+ public File location() {
+ return this.heapFile;
+ }
+
/**
* the number of BLOBs in the heap
* @return the number of BLOBs in the heap
@@ -491,14 +495,14 @@ public class HeapReader {
* this is used to import heap dumps into a write-enabled index heap
*/
public static class entries implements
- CloneableIterator<Map.Entry<String, byte[]>>,
- Iterator<Map.Entry<String, byte[]>>,
- Iterable<Map.Entry<String, byte[]>> {
+ CloneableIterator<Map.Entry<byte[], byte[]>>,
+ Iterator<Map.Entry<byte[], byte[]>>,
+ Iterable<Map.Entry<byte[], byte[]>> {
DataInputStream is;
int keylen;
private final File blobFile;
- Map.Entry<String, byte[]> nextEntry;
+ Map.Entry<byte[], byte[]> nextEntry;
public entries(final File blobFile, final int keylen) throws IOException {
if (!(blobFile.exists())) throw new IOException("file " + blobFile + " does not exist");
@@ -508,7 +512,7 @@ public class HeapReader {
this.nextEntry = next0();
}
- public CloneableIterator<Entry<String, byte[]>> clone(Object modifier) {
+ public CloneableIterator<Entry<byte[], byte[]>> clone(Object modifier) {
// if the entries iterator is cloned, close the file!
if (is != null) try { is.close(); } catch (final IOException e) {}
is = null;
@@ -527,7 +531,7 @@ public class HeapReader {
return false;
}
- private Map.Entry<String, byte[]> next0() {
+ private Map.Entry<byte[], byte[]> next0() {
try {
while (true) {
int len = is.readInt();
@@ -536,15 +540,15 @@ public class HeapReader {
byte[] payload = new byte[len - this.keylen];
if (is.read(payload) < payload.length) return null;
if (key[0] == 0) continue; // this is an empty gap
- return new entry(new String(key), payload);
+ return new entry(key, payload);
}
} catch (final IOException e) {
return null;
}
}
- public Map.Entry<String, byte[]> next() {
- final Map.Entry<String, byte[]> n = this.nextEntry;
+ public Map.Entry<byte[], byte[]> next() {
+ final Map.Entry<byte[], byte[]> n = this.nextEntry;
this.nextEntry = next0();
return n;
}
@@ -553,7 +557,7 @@ public class HeapReader {
throw new UnsupportedOperationException("blobs cannot be altered during read-only iteration");
}
- public Iterator<Map.Entry<String, byte[]>> iterator() {
+ public Iterator<Map.Entry<byte[], byte[]>> iterator() {
return this;
}
@@ -568,16 +572,16 @@ public class HeapReader {
}
}
- public static class entry implements Map.Entry<String, byte[]> {
- private final String s;
+ public static class entry implements Map.Entry<byte[], byte[]> {
+ private final byte[] s;
private byte[] b;
- public entry(final String s, final byte[] b) {
+ public entry(final byte[] s, final byte[] b) {
this.s = s;
this.b = b;
}
- public String getKey() {
+ public byte[] getKey() {
return s;
}
diff --git a/source/net/yacy/kelondro/blob/HeapWriter.java b/source/net/yacy/kelondro/blob/HeapWriter.java
index 30e01844f..df3b014b8 100644
--- a/source/net/yacy/kelondro/blob/HeapWriter.java
+++ b/source/net/yacy/kelondro/blob/HeapWriter.java
@@ -38,7 +38,7 @@ import net.yacy.kelondro.order.Digest;
import net.yacy.kelondro.util.FileUtils;
-public final class HeapWriter {
+public final class HeapWriter {
private final int keylength; // the length of the primary key
private HandleMap index; // key/seek relation for used records
diff --git a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
index 3464890c3..605375d96 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceContainerArray.java
@@ -310,7 +310,7 @@ public final class ReferenceContainerArray<ReferenceType extends Reference> {
donesomething = true;
}
- // merge very old files with it self (hack from sixcooler, see http://forum.yacy-websuche.de/viewtopic.php?p=15004#p15004)
+ // rewrite old files (hack from sixcooler, see http://forum.yacy-websuche.de/viewtopic.php?p=15004#p15004)
while (this.merger.queueLength() < 1) {
File ff = this.array.unmountOldest();
if (ff == null) break;
diff --git a/source/net/yacy/kelondro/rwi/ReferenceIterator.java b/source/net/yacy/kelondro/rwi/ReferenceIterator.java
index 47d755c43..60878d15a 100644
--- a/source/net/yacy/kelondro/rwi/ReferenceIterator.java
+++ b/source/net/yacy/kelondro/rwi/ReferenceIterator.java
@@ -65,9 +65,9 @@ public class ReferenceIterator <ReferenceType extends Reference> implements Clon
* because they may get very large, it is wise to deallocate some memory before calling next()
*/
public ReferenceContainer<ReferenceType> next() {
- Map.Entry<String, byte[]> entry = blobs.next();
+ Map.Entry<byte[], byte[]> entry = blobs.next();
byte[] payload = entry.getValue();
- return new ReferenceContainer<ReferenceType>(factory, entry.getKey().getBytes(), RowSet.importRowSet(payload, payloadrow));
+ return new ReferenceContainer<ReferenceType>(factory, entry.getKey(), RowSet.importRowSet(payload, payloadrow));
}
public void remove() {