Author: toad
Date: 2008-10-23 22:53:14 +0000 (Thu, 23 Oct 2008)
New Revision: 23064

Modified:
   branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
Log:
This class does NOT support persistence. Explain why.


Modified: 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java
===================================================================
--- 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java    
    2008-10-23 18:49:30 UTC (rev 23063)
+++ 
branches/db4o/freenet/src/freenet/support/io/SegmentedBucketChainBucket.java    
    2008-10-23 22:53:14 UTC (rev 23064)
@@ -16,6 +16,22 @@
 /**
  * Splits a large persistent file into a series of buckets, which are 
collected 
  * into groups called segments to avoid huge transactions/memory usage.
+ * 
+ * NON-PERSISTENT: This class uses persistent buckets, it stores them in the 
+ * database to save memory, but the bucket itself does not support persistence.
+ * Making it support persistence cleanly requires major refactoring. The 
obvious
+ * avenues are:
+ * 
+ * 1. Pass DBJobRunner in to getOutputStream(), getInputStream(), free(), 
+ * storeTo(). This will touch hundreds of files, mostly it is trivial though. 
It
+ * will however increase the overhead for all buckets slightly.
+ * 2. Make DBJobRunner a static variable, hence there will be only one database
+ * thread for the whole VM, even in a simulation with more than one node. One
+ * difficulty with this is that the node.db4o needs to be in the correct 
directory,
+ * yet the database would need to be initiated very early on.
+ * 
+ * Generally we create it, write to it, call getBuckets() and clear(), anyway 
...
+ * 
  * @author Matthew Toseland <toad at amphibian.dyndns.org> (0xE43DA450)
  */
 public class SegmentedBucketChainBucket implements Bucket {
@@ -28,7 +44,6 @@
        private boolean freed;
        final BucketFactory bf;
        private transient DBJobRunner dbJobRunner;
-       boolean stored;

        public SegmentedBucketChainBucket(int blockSize, BucketFactory factory, 
                        DBJobRunner runner, int segmentSize2) {
@@ -272,7 +287,7 @@
        }

        public void removeFrom(ObjectContainer container) {
-               // FIXME do something
+               throw new UnsupportedOperationException();
        }

        public void setReadOnly() {
@@ -293,10 +308,7 @@
         * calling storeTo().
         */
        public void storeTo(ObjectContainer container) {
-               stored = true;
-               dbJobRunner.removeRestartJob(killMe, 
NativeThread.HIGH_PRIORITY, container);
-               container.ext().store(segments, 1);
-               container.ext().store(this, 1);
+               throw new UnsupportedOperationException();
        }

        public Bucket[] getBuckets() {


Reply via email to