Author: toad
Date: 2006-01-08 00:36:15 +0000 (Sun, 08 Jan 2006)
New Revision: 7812

Modified:
   trunk/freenet/src/freenet/client/FileInserter.java
   trunk/freenet/src/freenet/client/InserterException.java
   trunk/freenet/src/freenet/keys/CHKBlock.java
   trunk/freenet/src/freenet/keys/ClientCHKBlock.java
   trunk/freenet/src/freenet/keys/ClientKeyBlock.java
   trunk/freenet/src/freenet/keys/ClientSSKBlock.java
   trunk/freenet/src/freenet/keys/InsertableClientSSK.java
   trunk/freenet/src/freenet/keys/KeyBlock.java
   trunk/freenet/src/freenet/keys/SSKBlock.java
   trunk/freenet/src/freenet/node/Node.java
   trunk/freenet/src/freenet/node/QueuedInsertRequest.java
   trunk/freenet/src/freenet/node/QueueingSimpleLowLevelClient.java
   trunk/freenet/src/freenet/node/RealNodeRequestInsertTest.java
   trunk/freenet/src/freenet/node/RequestStarterClient.java
   trunk/freenet/src/freenet/node/SimpleLowLevelClient.java
   trunk/freenet/src/freenet/node/Version.java
Log:
335: Almost there... just need to implement the actual insert code in TMCI, and 
test it.

Modified: trunk/freenet/src/freenet/client/FileInserter.java
===================================================================
--- trunk/freenet/src/freenet/client/FileInserter.java  2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/client/FileInserter.java  2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -4,10 +4,17 @@

 import freenet.client.events.BlockInsertErrorEvent;
 import freenet.client.events.SimpleBlockPutEvent;
+import freenet.keys.CHKBlock;
 import freenet.keys.CHKEncodeException;
 import freenet.keys.ClientCHKBlock;
+import freenet.keys.ClientSSK;
+import freenet.keys.ClientSSKBlock;
 import freenet.keys.FreenetURI;
+import freenet.keys.InsertableClientSSK;
 import freenet.keys.NodeCHK;
+import freenet.keys.NodeSSK;
+import freenet.keys.SSKBlock;
+import freenet.keys.SSKEncodeException;
 import freenet.node.LowLevelPutException;
 import freenet.support.Bucket;
 import freenet.support.BucketTools;
@@ -45,14 +52,34 @@

                // First, can it fit into a single block?

+               Bucket origData = block.data;
                Bucket data = block.data;
+               int blockSize;
+               int maxSourceDataSize;
+               boolean isSSK = false;
+               boolean dontCompress = false;
+               
+               long origSize = data.size();
+               if(block.desiredURI.getKeyType().equals("SSK")) {
+                       blockSize = SSKBlock.DATA_LENGTH;
+                       isSSK = true;
+                       maxSourceDataSize = 
ClientSSKBlock.MAX_DECOMPRESSED_DATA_LENGTH;
+                       if(origSize > maxSourceDataSize)
+                               dontCompress = true;
+                       // If too big to fit in an SSK, don't even try.
+               } else if(block.desiredURI.getKeyType().equals("CHK")) {
+                       blockSize = CHKBlock.DATA_LENGTH;
+                       maxSourceDataSize = 
ClientCHKBlock.MAX_LENGTH_BEFORE_COMPRESSION;
+               } else {
+                       throw new 
InserterException(InserterException.INVALID_URI);
+               }
+               
                ClientCHKBlock chk;
-
+               
                Compressor bestCodec = null;
                Bucket bestCompressedData = null;

-               long origSize = data.size();
-               if(data.size() > NodeCHK.BLOCK_SIZE && (!ctx.dontCompress)) {
+               if(origSize > blockSize && (!ctx.dontCompress) && 
(!dontCompress)) {
                        // Try to compress the data.
                        // Try each algorithm, starting with the fastest and 
weakest.
                        // Stop when run out of algorithms, or the compressed 
data fits in a single block.
@@ -61,8 +88,8 @@
                                for(int i=0;i<algos;i++) {
                                        Compressor comp = 
Compressor.getCompressionAlgorithmByDifficulty(i);
                                        Bucket result;
-                                       result = comp.compress(data, ctx.bf, 
Long.MAX_VALUE);
-                                       if(result.size() < NodeCHK.BLOCK_SIZE) {
+                                       result = comp.compress(origData, 
ctx.bf, Long.MAX_VALUE);
+                                       if(result.size() < blockSize) {
                                                bestCodec = comp;
                                                data = result;
                                                if(bestCompressedData != null)
@@ -72,10 +99,12 @@
                                        if(bestCompressedData != null && 
result.size() <  bestCompressedData.size()) {
                                                
ctx.bf.freeBucket(bestCompressedData);
                                                bestCompressedData = result;
+                                               data = result;
                                                bestCodec = comp;
                                        } else if(bestCompressedData == null && 
result.size() < data.size()) {
                                                bestCompressedData = result;
                                                bestCodec = comp;
+                                               data = result;
                                        }
                                }
                        } catch (IOException e) {
@@ -86,6 +115,41 @@
                        }
                }

+               InsertableClientSSK isk = null;
+               
+               if(isSSK && data.size() <= SSKBlock.DATA_LENGTH && 
block.clientMetadata.isTrivial()) {
+                       short codec;
+                       if(bestCodec == null) {
+                               codec = -1;
+                       } else {
+                               codec = bestCodec.codecNumberForMetadata();
+                       }
+                       isk = InsertableClientSSK.create(block.desiredURI);
+                       ClientSSKBlock ssk;
+                       try {
+                               ssk = isk.encode(data, metadata, true, codec, 
data.size(), ctx.random);
+                       } catch (SSKEncodeException e) {
+                               throw new 
InserterException(InserterException.INTERNAL_ERROR, e, isk.getURI());
+                       } catch (IOException e) {
+                               throw new 
InserterException(InserterException.INTERNAL_ERROR, e, isk.getURI());
+                       }
+                       return simplePutSSK(ssk, getCHKOnly, noRetries);
+               }
+               
+               if(isSSK) {
+                       // Insert as CHK
+                       // Create metadata pointing to it (include the 
clientMetadata if there is any).
+                       FreenetURI uri = run(new InsertBlock(block.data, new 
ClientMetadata(), FreenetURI.EMPTY_CHK_URI), metadata, getCHKOnly, noRetries);
+                       Metadata m = new Metadata(Metadata.SIMPLE_REDIRECT, 
uri, block.clientMetadata);
+                       Bucket bucket;
+                       try {
+                               bucket = 
BucketTools.makeImmutableBucket(ctx.bf, m.writeToByteArray());
+                       } catch (IOException e) {
+                               throw new 
InserterException(InserterException.INTERNAL_ERROR, e, isk.getURI());
+                       }
+                       return run(new InsertBlock(bucket, new 
ClientMetadata(), block.desiredURI), metadata, getCHKOnly, noRetries);
+               }
+               
                if(data.size() <= NodeCHK.BLOCK_SIZE) {
                        try {
                                if(bestCodec == null) {
@@ -125,7 +189,7 @@
                                if(!getCHKOnly)
                                        ctx.eventProducer.produceEvent(new 
SimpleBlockPutEvent(chk.getClientKey()));
                                if(!getCHKOnly)
-                                       ctx.client.putCHK(chk, 
ctx.starterClient, ctx.cacheLocalRequests);
+                                       ctx.client.putKey(chk, 
ctx.starterClient, ctx.cacheLocalRequests);
                                break;
                        } catch (LowLevelPutException e) {
                                le = e;
@@ -163,6 +227,43 @@
                return uri;
        }

+       private FreenetURI simplePutSSK(ClientSSKBlock ssk, boolean getCHKOnly, 
boolean noRetries) throws InserterException {
+               LowLevelPutException le = null;
+               int rnfs = 0;
+               for(int i=0;i<=ctx.maxInsertRetries;i++) {
+                       try {
+                               if(!getCHKOnly)
+                                       ctx.eventProducer.produceEvent(new 
SimpleBlockPutEvent(ssk.getClientKey()));
+                               if(!getCHKOnly)
+                                       ctx.client.putKey(ssk, 
ctx.starterClient, ctx.cacheLocalRequests);
+                               break;
+                       } catch (LowLevelPutException e) {
+                               le = e;
+                               switch(le.code) {
+                               case 
LowLevelPutException.ROUTE_REALLY_NOT_FOUND:
+                               case LowLevelPutException.REJECTED_OVERLOAD:
+                                       rnfs = 0;
+                               }
+                               if(noRetries)
+                                       break;
+                               if(le.code == 
LowLevelPutException.ROUTE_NOT_FOUND && ctx.consecutiveRNFsCountAsSuccess > 0) {
+                                       rnfs++;
+                                       if(rnfs >= 
ctx.consecutiveRNFsCountAsSuccess) {
+                                               le = null;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+               
+               FreenetURI uri = ssk.getClientKey().getURI();
+               
+               if(le != null)
+                       translateException(le, uri);
+               
+               return uri;
+       }
+
        private void translateException(LowLevelPutException e, FreenetURI uri) 
throws InserterException {
                switch(e.code) {
                case LowLevelPutException.INTERNAL_ERROR:

Modified: trunk/freenet/src/freenet/client/InserterException.java
===================================================================
--- trunk/freenet/src/freenet/client/InserterException.java     2006-01-07 
23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/client/InserterException.java     2006-01-08 
00:36:15 UTC (rev 7812)
@@ -50,6 +50,12 @@
                this.uri = expectedURI;
        }

+       public InserterException(int mode) {
+               this.mode = mode;
+               this.errorCodes = null;
+               this.uri = null;
+       }
+
        /** Caller supplied a URI we cannot use */
        public static final int INVALID_URI = 1;
        /** Failed to read from or write to a bucket; a kind of internal error 
*/

Modified: trunk/freenet/src/freenet/keys/CHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/CHKBlock.java        2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/CHKBlock.java        2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -17,6 +17,7 @@
     final NodeCHK chk;
     public static final int MAX_LENGTH_BEFORE_COMPRESSION = Integer.MAX_VALUE;
     public static final int TOTAL_HEADERS_LENGTH = 36;
+    public static final int DATA_LENGTH = 32768;

     public String toString() {
         return super.toString()+": chk="+chk;

Modified: trunk/freenet/src/freenet/keys/ClientCHKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientCHKBlock.java  2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/ClientCHKBlock.java  2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -242,10 +242,7 @@
                }
     }

-    /**
-     * @return The ClientCHK for this key.
-     */
-    public ClientCHK getClientKey() {
+    public ClientKey getClientKey() {
         return key;
     }


Modified: trunk/freenet/src/freenet/keys/ClientKeyBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientKeyBlock.java  2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/ClientKeyBlock.java  2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -18,4 +18,9 @@
         */
        boolean isMetadata();

+    /**
+     * @return The ClientKey for this key.
+     */
+    public ClientKey getClientKey();
+
 }

Modified: trunk/freenet/src/freenet/keys/ClientSSKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/ClientSSKBlock.java  2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/ClientSSKBlock.java  2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -12,7 +12,7 @@

        static final int DATA_DECRYPT_KEY_LENGTH = 32;

-       static final int MAX_DECOMPRESSED_DATA_LENGTH = 32768;
+       static public final int MAX_DECOMPRESSED_DATA_LENGTH = 32768;

        /** Is metadata. Set on decode. */
        private boolean isMetadata;
@@ -83,4 +83,8 @@
                return isMetadata;
        }

+       public ClientKey getClientKey() {
+               return key;
+       }
+
 }

Modified: trunk/freenet/src/freenet/keys/InsertableClientSSK.java
===================================================================
--- trunk/freenet/src/freenet/keys/InsertableClientSSK.java     2006-01-07 
23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/keys/InsertableClientSSK.java     2006-01-08 
00:36:15 UTC (rev 7812)
@@ -30,6 +30,13 @@
                this.privKey = privKey;
        }

+       public static InsertableClientSSK create(FreenetURI uri) {
+               DSAGroup g = Global.DSAgroupBigA;
+               DSAPrivateKey privKey = new DSAPrivateKey(new 
NativeBigInteger(1, uri.getKeyVal()));
+               DSAPublicKey pubKey = new DSAPublicKey(g, privKey);
+               return new InsertableClientSSK(uri.getDocName(), pubKey, 
privKey, uri.getCryptoKey());
+       }
+       
        public ClientSSKBlock encode(Bucket sourceData, boolean asMetadata, 
boolean dontCompress, short alreadyCompressedCodec, long sourceLength, 
RandomSource r) throws SSKEncodeException, IOException {
                byte[] compressedData;
                short compressionAlgo;

Modified: trunk/freenet/src/freenet/keys/KeyBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/KeyBlock.java        2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/KeyBlock.java        2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -10,4 +10,5 @@
     public Key getKey();
     public byte[] getRawHeaders();
     public byte[] getRawData();
+
 }

Modified: trunk/freenet/src/freenet/keys/SSKBlock.java
===================================================================
--- trunk/freenet/src/freenet/keys/SSKBlock.java        2006-01-07 23:31:16 UTC 
(rev 7811)
+++ trunk/freenet/src/freenet/keys/SSKBlock.java        2006-01-08 00:36:15 UTC 
(rev 7812)
@@ -43,7 +43,7 @@
     final short hashIdentifier;
     final short symCipherIdentifier;

-    static final short DATA_LENGTH = 1024;
+    public static final short DATA_LENGTH = 1024;

     static final short SIG_R_LENGTH = 32;
     static final short SIG_S_LENGTH = 32;

Modified: trunk/freenet/src/freenet/node/Node.java
===================================================================
--- trunk/freenet/src/freenet/node/Node.java    2006-01-07 23:31:16 UTC (rev 
7811)
+++ trunk/freenet/src/freenet/node/Node.java    2006-01-08 00:36:15 UTC (rev 
7812)
@@ -47,6 +47,7 @@
 import freenet.keys.ClientCHKBlock;
 import freenet.keys.ClientKey;
 import freenet.keys.ClientKeyBlock;
+import freenet.keys.ClientSSKBlock;
 import freenet.keys.Key;
 import freenet.keys.KeyBlock;
 import freenet.keys.NodeCHK;
@@ -552,10 +553,19 @@
         }
     }

-    public void putCHK(ClientCHKBlock block, RequestStarterClient starter, 
boolean cache) throws LowLevelPutException {
-               starter.putCHK(block, cache);
+    public void putKey(ClientKeyBlock block, RequestStarterClient client, 
boolean cache) throws LowLevelPutException {
+       client.putKey(block, cache);
     }

+    public void realPut(ClientKeyBlock block, boolean cache) throws 
LowLevelPutException {
+       if(block instanceof ClientCHKBlock)
+               realPutCHK((ClientCHKBlock)block, cache);
+       else if(block instanceof ClientSSKBlock)
+               realPutSSK((ClientSSKBlock)block, cache);
+       else
+               throw new IllegalArgumentException("Unknown put type 
"+block.getClass());
+    }
+    
     public void realPutCHK(ClientCHKBlock block, boolean cache) throws 
LowLevelPutException {
         byte[] data = block.getData();
         byte[] headers = block.getHeaders();
@@ -575,7 +585,7 @@
                                Logger.error(this, "Datastore failure: "+e, e);
                        }
                }
-            is = makeInsertSender(block.getClientKey().getNodeCHK(), 
+            is = makeInsertSender((NodeCHK)block.getClientKey().getNodeKey(), 
                     MAX_HTL, uid, null, headers, prb, false, 
lm.getLocation().getValue(), cache);
         }
         boolean hasForwardedRejectedOverload = false;
@@ -659,6 +669,105 @@
         }
     }

+    public void realPutSSK(ClientSSKBlock block, boolean cache) throws 
LowLevelPutException {
+        byte[] data = block.getRawData();
+        byte[] headers = block.getRawHeaders();
+        PartiallyReceivedBlock prb = new 
PartiallyReceivedBlock(PACKETS_IN_BLOCK, PACKET_SIZE, data);
+        SSKInsertSender is;
+        long uid = random.nextLong();
+        if(!lockUID(uid)) {
+            Logger.error(this, "Could not lock UID just randomly generated: 
"+uid+" - probably indicates broken PRNG");
+            throw new 
LowLevelPutException(LowLevelPutException.INTERNAL_ERROR);
+        }
+        long startTime = System.currentTimeMillis();
+        synchronized(this) {
+               if(cache) {
+                       try {
+                               sskDatastore.put(block);
+                       } catch (IOException e) {
+                               Logger.error(this, "Datastore failure: "+e, e);
+                       }
+               }
+            is = makeInsertSender(block, 
+                    MAX_HTL, uid, null, false, lm.getLocation().getValue(), 
cache);
+        }
+        boolean hasForwardedRejectedOverload = false;
+        // Wait for status
+        while(true) {
+               synchronized(is) {
+                       if(is.getStatus() == SSKInsertSender.NOT_FINISHED) {
+                               try {
+                                       is.wait(5*1000);
+                               } catch (InterruptedException e) {
+                                       // Ignore
+                               }
+                       }
+                       if(is.getStatus() != SSKInsertSender.NOT_FINISHED) 
break;
+               }
+               if((!hasForwardedRejectedOverload) && 
is.receivedRejectedOverload()) {
+                       hasForwardedRejectedOverload = true;
+                       insertThrottle.requestRejectedOverload();
+               }
+        }
+        
+        // Wait for completion
+        while(true) {
+               synchronized(is) {
+                       if(is.getStatus() != SSKInsertSender.NOT_FINISHED) 
break;
+                       try {
+                                       is.wait(10*1000);
+                               } catch (InterruptedException e) {
+                                       // Go around again
+                               }
+               }
+        }
+        
+        Logger.minor(this, "Completed "+uid+" 
overload="+hasForwardedRejectedOverload+" "+is.getStatusString());
+        
+        // Finished?
+        if(!hasForwardedRejectedOverload) {
+               // Is it ours? Did we send a request?
+               if(is.sentRequest() && is.uid == uid && (is.getStatus() == 
SSKInsertSender.ROUTE_NOT_FOUND 
+                               || is.getStatus() == SSKInsertSender.SUCCESS)) {
+                       // It worked!
+                       long endTime = System.currentTimeMillis();
+                       long len = endTime - startTime;
+                       insertThrottle.requestCompleted(len);
+               }
+        }
+        
+        if(is.getStatus() == SSKInsertSender.SUCCESS) {
+               Logger.normal(this, "Succeeded inserting "+block);
+               return;
+        } else {
+               int status = is.getStatus();
+               String msg = "Failed inserting "+block+" : 
"+is.getStatusString();
+               if(status == CHKInsertSender.ROUTE_NOT_FOUND)
+                       msg += " - this is normal on small networks; the data 
will still be propagated, but it can't find the 20+ nodes needed for full 
success";
+               if(is.getStatus() != SSKInsertSender.ROUTE_NOT_FOUND)
+                       Logger.error(this, msg);
+               else
+                       Logger.normal(this, msg);
+               switch(is.getStatus()) {
+               case SSKInsertSender.NOT_FINISHED:
+                       Logger.error(this, "IS still running in putCHK!: "+is);
+                       throw new 
LowLevelPutException(LowLevelPutException.INTERNAL_ERROR);
+               case SSKInsertSender.GENERATED_REJECTED_OVERLOAD:
+               case SSKInsertSender.TIMED_OUT:
+                       throw new 
LowLevelPutException(LowLevelPutException.REJECTED_OVERLOAD);
+               case SSKInsertSender.ROUTE_NOT_FOUND:
+                       throw new 
LowLevelPutException(LowLevelPutException.ROUTE_NOT_FOUND);
+               case SSKInsertSender.ROUTE_REALLY_NOT_FOUND:
+                       throw new 
LowLevelPutException(LowLevelPutException.ROUTE_REALLY_NOT_FOUND);
+               case SSKInsertSender.INTERNAL_ERROR:
+                       throw new 
LowLevelPutException(LowLevelPutException.INTERNAL_ERROR);
+               default:
+                       Logger.error(this, "Unknown CHKInsertSender code in 
putSSK: "+is.getStatus()+" on "+is);
+                       throw new 
LowLevelPutException(LowLevelPutException.INTERNAL_ERROR);
+               }
+        }
+    }
+
     long lastAcceptedRequest = -1;

     public synchronized boolean shouldRejectRequest() {
@@ -944,9 +1053,20 @@
         return is;
     }

+    /**
+     * Fetch or create an SSKInsertSender for a given key/htl.
+     * @param key The key to be inserted.
+     * @param htl The current HTL. We can't coalesce inserts across
+     * HTL's.
+     * @param uid The UID of the caller's request chain, or a new
+     * one. This is obviously not used if there is already an 
+     * SSKInsertSender running.
+     * @param source The node that sent the InsertRequest, or null
+     * if it originated locally.
+     */
     public synchronized SSKInsertSender makeInsertSender(SSKBlock block, short 
htl, long uid, PeerNode source,
-               boolean fromStore, double closestLoc, boolean cache) {
-       Key key = block.getKey();
+            boolean fromStore, double closestLoc, boolean cache) {
+       NodeSSK key = (NodeSSK) block.getKey();
         Logger.minor(this, 
"makeInsertSender("+key+","+htl+","+uid+","+source+",...,"+fromStore);
         KeyHTLPair kh = new KeyHTLPair(key, htl);
         SSKInsertSender is = (SSKInsertSender) insertSenders.get(kh);

Modified: trunk/freenet/src/freenet/node/QueuedInsertRequest.java
===================================================================
--- trunk/freenet/src/freenet/node/QueuedInsertRequest.java     2006-01-07 
23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/node/QueuedInsertRequest.java     2006-01-08 
00:36:15 UTC (rev 7812)
@@ -1,14 +1,15 @@
 package freenet.node;

 import freenet.keys.ClientCHKBlock;
+import freenet.keys.ClientKeyBlock;

 public class QueuedInsertRequest extends QueuedRequest {

-       private final ClientCHKBlock block;
+       private final ClientKeyBlock block;
        private final boolean cache;
        private QueueingSimpleLowLevelClient client;

-       public QueuedInsertRequest(ClientCHKBlock block, 
QueueingSimpleLowLevelClient client, boolean cache) {
+       public QueuedInsertRequest(ClientKeyBlock block, 
QueueingSimpleLowLevelClient client, boolean cache) {
                this.block = block;
                this.client = client;
                this.cache = cache;
@@ -16,6 +17,6 @@

        public void waitAndPut() throws LowLevelPutException {
                waitForSendClearance();
-               client.realPutCHK(block, cache);
+               client.realPut(block, cache);
        }
 }

Modified: trunk/freenet/src/freenet/node/QueueingSimpleLowLevelClient.java
===================================================================
--- trunk/freenet/src/freenet/node/QueueingSimpleLowLevelClient.java    
2006-01-07 23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/node/QueueingSimpleLowLevelClient.java    
2006-01-08 00:36:15 UTC (rev 7812)
@@ -12,6 +12,6 @@
        ClientKeyBlock realGetKey(ClientKey key, boolean localOnly, boolean 
cache) throws LowLevelGetException;

        /** Ditto */
-       void realPutCHK(ClientCHKBlock block, boolean cache) throws 
LowLevelPutException;
+       void realPut(ClientKeyBlock block, boolean cache) throws 
LowLevelPutException;

 }

Modified: trunk/freenet/src/freenet/node/RealNodeRequestInsertTest.java
===================================================================
--- trunk/freenet/src/freenet/node/RealNodeRequestInsertTest.java       
2006-01-07 23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/node/RealNodeRequestInsertTest.java       
2006-01-08 00:36:15 UTC (rev 7812)
@@ -175,14 +175,14 @@
                 byte[] data = dataString.getBytes();
                 ClientCHKBlock block;
                 block = ClientCHKBlock.encode(data, false, false, (short)-1, 
0);
-                ClientCHK chk = block.getClientKey();
+                ClientCHK chk = (ClientCHK) block.getClientKey();
                 byte[] encData = block.getData();
                 byte[] encHeaders = block.getHeaders();
                 ClientCHKBlock newBlock = new ClientCHKBlock(encData, 
encHeaders, chk, true);
                 Logger.error(RealNodeRequestInsertTest.class, "Decoded: "+new 
String(newBlock.memoryDecode()));
                 Logger.error(RealNodeRequestInsertTest.class,"CHK: 
"+chk.getURI());
                 Logger.error(RealNodeRequestInsertTest.class,"Headers: 
"+HexUtil.bytesToHex(block.getHeaders()));
-                randomNode.putCHK(block, starters[node1], true);
+                randomNode.putKey(block, starters[node1], true);
                 Logger.error(RealNodeRequestInsertTest.class, "Inserted to 
"+node1);
                 Logger.error(RealNodeRequestInsertTest.class, "Data: 
"+Fields.hashCode(encData)+", Headers: "+Fields.hashCode(encHeaders));
                 // Pick random node to request from

Modified: trunk/freenet/src/freenet/node/RequestStarterClient.java
===================================================================
--- trunk/freenet/src/freenet/node/RequestStarterClient.java    2006-01-07 
23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/node/RequestStarterClient.java    2006-01-08 
00:36:15 UTC (rev 7812)
@@ -6,6 +6,7 @@
 import freenet.keys.ClientCHKBlock;
 import freenet.keys.ClientKey;
 import freenet.keys.ClientKeyBlock;
+import freenet.keys.ClientSSKBlock;
 import freenet.keys.KeyBlock;
 import freenet.support.DoublyLinkedList;
 import freenet.support.UpdatableSortedLinkedListItemImpl;
@@ -53,7 +54,7 @@
         * Blocking insert of a key.
         * @throws LowLevelPutException If the fetch failed for some reason.
         */
-       public void putCHK(ClientCHKBlock block, boolean cache) throws 
LowLevelPutException {
+       public void putKey(ClientKeyBlock block, boolean cache) throws 
LowLevelPutException {
                QueuedInsertRequest qir = new QueuedInsertRequest(block, 
client, cache);
                addRequest(qir);
                qir.waitAndPut();

Modified: trunk/freenet/src/freenet/node/SimpleLowLevelClient.java
===================================================================
--- trunk/freenet/src/freenet/node/SimpleLowLevelClient.java    2006-01-07 
23:31:16 UTC (rev 7811)
+++ trunk/freenet/src/freenet/node/SimpleLowLevelClient.java    2006-01-08 
00:36:15 UTC (rev 7812)
@@ -27,5 +27,5 @@
      * @param cache If false, don't cache the data. See the comments at the top
      * of Node.java.
      */
-    public void putCHK(ClientCHKBlock key, RequestStarterClient sctx, boolean 
cache) throws LowLevelPutException;
+    public void putKey(ClientKeyBlock key, RequestStarterClient sctx, boolean 
cache) throws LowLevelPutException;
 }

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-01-07 23:31:16 UTC (rev 
7811)
+++ trunk/freenet/src/freenet/node/Version.java 2006-01-08 00:36:15 UTC (rev 
7812)
@@ -20,7 +20,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       public static final int buildNumber = 334;
+       public static final int buildNumber = 335;

        /** Oldest build of Fred we will talk to */
        public static final int lastGoodBuild = 332;


Reply via email to