Author: toad
Date: 2008-01-05 21:14:50 +0000 (Sat, 05 Jan 2008)
New Revision: 16917

Modified:
   trunk/freenet/src/freenet/store/CHKStore.java
   trunk/freenet/src/freenet/store/PubkeyStore.java
Log:
Add missing fetch/put methods.

Modified: trunk/freenet/src/freenet/store/CHKStore.java
===================================================================
--- trunk/freenet/src/freenet/store/CHKStore.java       2008-01-05 19:49:47 UTC 
(rev 16916)
+++ trunk/freenet/src/freenet/store/CHKStore.java       2008-01-05 21:14:50 UTC 
(rev 16917)
@@ -1,5 +1,7 @@
 package freenet.store;

+import java.io.IOException;
+
 import freenet.keys.CHKBlock;
 import freenet.keys.CHKVerifyException;
 import freenet.keys.KeyVerifyException;
@@ -17,6 +19,15 @@
                return CHKBlock.construct(data, headers);
        }

+       public CHKBlock fetch(NodeCHK chk, boolean dontPromote) throws 
IOException {
+               return (CHKBlock) store.fetch(chk.getRoutingKey(), null, 
dontPromote);
+       }
+       
+       public void put(CHKBlock b) throws IOException, KeyCollisionException {
+               NodeCHK key = (NodeCHK) b.getKey();
+               store.put(b, key.getRoutingKey(), null, b.getRawData(), 
b.getRawHeaders(), false);
+       }
+       
        public int dataLength() {
                return CHKBlock.DATA_LENGTH;
        }

Modified: trunk/freenet/src/freenet/store/PubkeyStore.java
===================================================================
--- trunk/freenet/src/freenet/store/PubkeyStore.java    2008-01-05 19:49:47 UTC 
(rev 16916)
+++ trunk/freenet/src/freenet/store/PubkeyStore.java    2008-01-05 21:14:50 UTC 
(rev 16917)
@@ -1,5 +1,7 @@
 package freenet.store;

+import java.io.IOException;
+
 import freenet.crypt.CryptFormatException;
 import freenet.crypt.DSAPublicKey;
 import freenet.keys.KeyVerifyException;
@@ -21,6 +23,16 @@
                }
        }

+       public DSAPublicKey fetch(byte[] hash, boolean dontPromote) throws 
IOException {
+               return (DSAPublicKey) store.fetch(hash, null, dontPromote);
+       }
+       
+       final private static byte[] empty = new byte[0];
+       
+       public void put(byte[] hash, DSAPublicKey key) throws IOException, 
KeyCollisionException {
+               store.put(key, key.getRoutingKey(), null, key.asPaddedBytes(), 
empty, false);
+       }
+       
        public int dataLength() {
                return DSAPublicKey.PADDED_SIZE;
        }


Reply via email to