Update of /cvsroot/freenet/freenet/src/freenet/node
In directory sc8-pr-cvs1:/tmp/cvs-serv24032/src/freenet/node

Modified Files:
        NodeConsole.java Main.java 
Removed Files:
        FSTool.java 
Log Message:
Remove the monolithic datastore, and about fscking time! Made rather easy by Eclipse.

Index: NodeConsole.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/NodeConsole.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -w -r1.6 -r1.7
--- NodeConsole.java    27 Oct 2003 14:45:17 -0000      1.6
+++ NodeConsole.java    30 Oct 2003 02:39:38 -0000      1.7
@@ -143,14 +143,6 @@
         out.println("<td> &nbsp; </td>");
         out.println("<td>" + node.dir.available() + "</td>");
         out.println("</tr>");
-
-        // fs version
-
-        out.println("<tr>");
-        out.println("<td valign=\"top\" align=\"right\" nowrap=\"nowrap\"><b>FS 
version</b></td>");
-        out.println("<td> &nbsp; </td>");
-        out.println("<td>" + freenet.fs.dir.FSDirectoryRoot.VERSION + "</td>");
-        out.println("</tr>");
         
         // interfaces
         

Index: Main.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/Main.java,v
retrieving revision 1.284
retrieving revision 1.285
diff -u -w -r1.284 -r1.285
--- Main.java   30 Oct 2003 01:34:02 -0000      1.284
+++ Main.java   30 Oct 2003 02:39:38 -0000      1.285
@@ -68,13 +68,8 @@
 import freenet.diagnostics.DiagnosticsCheckpoint;
 import freenet.diagnostics.DiagnosticsException;
 import freenet.diagnostics.StandardDiagnostics;
-import freenet.fs.EncryptedFileSystem;
-import freenet.fs.FileSystem;
-import freenet.fs.RAFStorage;
-import freenet.fs.Storage;
 import freenet.fs.dir.Buffer;
 import freenet.fs.dir.Directory;
-import freenet.fs.dir.FSDirectory;
 import freenet.fs.dir.FileNumber;
 import freenet.fs.dir.LossyDirectory;
 import freenet.fs.dir.NativeFSDirectory;
@@ -616,116 +611,6 @@
                     getAbsoluteFile().getParentFile();
         
             Node.storeType = params.getString("storeType");
-            if(Node.storeType.equals("convert")) {
-                if(storeFiles[0].isDirectory()) {
-                    Node.storeType = "native";
-                }
-                storeSize *= storeFiles.length;
-            }
-            if (!(Node.storeType.equals("monolithic") || 
-                  Node.storeType.equals("native") ||
-                  Node.storeType.equals("convert"))) {
-                // Auto-select
-                if(storeFiles[0].isFile()) {
-                    Node.storeType="monolithic";
-                } else {
-                    Node.storeType="native";
-                }
-            }
-        
-            if(Node.storeType.equals("monolithic") || 
Node.storeType.equals("convert")) {
-                Storage storage = new RAFStorage(storeFiles, Node.storeSize);
-                FileSystem fs;
-                if (cipher == null) {
-                    fs = new FileSystem(storage);
-                }
-                else {
-                    cipher.initialize(cipherKey);
-                    fs = new EncryptedFileSystem(storage, cipher, baseIV);
-                }
-                
-                // FIXME:  there need to be some sanity checks on the
-                //         ranges for the directory root, accounting tables,
-                //         and files, to see if any of them were truncated.
-                if (fs.truncation() < fs.size()) {
-                    FSInitializer fsini = new FSInitializer(fs);
-                    synchronized (fsini) {
-                        try {
-                            fsini.start();
-                            fsini.wait();
-                        }
-                        catch (InterruptedException e) {}
-                    }
-                    if (fsini.delayedThrow != null)
-                        throw fsini.delayedThrow; //.fillInStackTrace();
-                }
-                //
-                // FIXME: replace literals with config values
-                //
-                dir = new FSDirectory(fs, new SHA1(), 10000, 10000, 1000, 100);
-                storeSize = fs.size();
-                if (!Node.storeType.equals("convert")) {
-                    Core.logger.log(Main.class, "Monolithic datastore no longer 
supported. Converting to native. You had better have enough disk space for the 
conversion. If you don't, remove the old storefile.", Core.logger.ERROR);
-                    Node.storeType = "convert";
-                }
-                String name = storeFiles[0].toString();
-                if(name.charAt(name.length()-1) == File.separatorChar)
-                    name = name.substring(0,name.length()-1);
-                name += "-temp";
-                try {
-                    newDir = new 
-                        NativeFSDirectory(new File(name),
-                                          storeSize,
-                                          Node.storeBlockSize,
-                                          Node.useDSIndex,
-                                          Node.storeMaxTempFraction,
-                                          Node.maxNodeFilesOpen);
-                    Enumeration e = dir.keys(true);
-                    Core.logger.log(Main.class, "Trying to convert datastore",
-                                    Core.logger.NORMAL);
-                    long num = 0;
-                    long bytes = 0;
-                    while(e.hasMoreElements()) {
-                        num++;
-                        FileNumber fn = (FileNumber)e.nextElement();
-                        Buffer bIn = dir.fetch(fn);
-                        Core.logger.log(Main.class, "Converted "+num+" files "+
-                                        bytes + " bytes.", Core.logger.NORMAL);
-                        bytes += bIn.length();
-                        Buffer bOut = newDir.store(bIn.length(), fn);
-                        InputStream i = bIn.getInputStream();
-                        OutputStream o = bOut.getOutputStream();
-                        byte[] b = new byte[4096];
-                        int x;
-                        while((x = i.read(b)) > 0) {
-                            o.write(b, 0, x);
-                        };
-                        bOut.commit();
-                        bIn.release();
-                        bOut.release();
-                    }
-                    Core.logger.log(Main.class, "Conversion nearly done", 
-                                    Core.logger.NORMAL);
-                } finally {
-                    dir = null;
-                    newDir = null;
-                    // Try to close both of them
-                    System.gc();
-                    System.runFinalization();
-                    System.gc();
-                    System.runFinalization();
-                    // Delete old files
-                    for(int x=0;x<storeFiles.length;x++)
-                        storeFiles[x].delete();
-                    new File(name).renameTo(storeFiles[0]);
-                    dir = newDir = new NativeFSDirectory
-                        (storeFiles[0], Node.storeSize, Node.storeBlockSize,
-                         Node.useDSIndex, Node.storeMaxTempFraction,
-                         Node.maxNodeFilesOpen);
-                    Core.logger.log(Main.class, "Conversion done", 
-                                    Core.logger.NORMAL);
-                }
-            } else {
                 dir = newDir = new NativeFSDirectory(storeFiles[0], 
                                                      Node.storeSize, 
                                                      Node.storeBlockSize,
@@ -733,7 +618,6 @@
                                                      Node.storeMaxTempFraction,
                                                      Node.maxNodeFilesOpen);
                 Node.storeFile = new String[] { Node.storeFile[0] };
-            }
         
             Enumeration en = dir.lruKeys(false);
             long dirLastModified = -1;
@@ -1430,47 +1314,6 @@
                     }
                 }
                 params.put("services", Fields.commaList(newList));
-            }
-        }
-    }
-
-    private static final class FSInitializer extends Thread {
-
-        final FileSystem fs;
-        Throwable delayedThrow = null;
-
-        FSInitializer(FileSystem fs) {
-            super("store-initializer");
-            setDaemon(true);
-            this.fs = fs;
-        }
-
-        public void run() {
-            Node.logger.log(this,
-                            "initializing data store ("+fs.size()+" bytes)",
-                            Logger.NORMAL);
-            try {
-                long t = System.currentTimeMillis();
-                fs.initialize(Node.getRandSource(), this);
-                t = System.currentTimeMillis() - t;
-                Node.logger.log(this, "finished initializing store ("+(t/1000)+" 
sec)",
-                                Logger.NORMAL);
-            }
-            catch (IOException e) {
-                delayedThrow = e;
-                Node.logger.log(this, "I/O error while initializing datastore",
-                                e, Logger.ERROR);
-            }
-            catch (Throwable e) {
-                delayedThrow = e;
-                Node.logger.log(this, "Unhandled error while initializing datastore",
-                                e, Logger.ERROR);
-            }
-            finally {
-                // in case it wasn't reached by fs.initialize()
-                synchronized (this) {
-                    notify();
-                }
             }
         }
     }

--- FSTool.java DELETED ---

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to