예제 #1
0
            /// <exception cref="System.IO.IOException"/>
            internal LevelDBMetadataMap(string baseDir)
            {
                FilePath dbDir = new FilePath(baseDir);

                if (dbDir.Exists())
                {
                    FileUtils.DeleteDirectory(dbDir);
                }
                if (!dbDir.Mkdirs())
                {
                    throw new IOException("Failed to mkdir on " + dbDir);
                }
                try
                {
                    dirChildMap = new PBImageTextWriter.LevelDBMetadataMap.LevelDBStore(new FilePath(
                                                                                            dbDir, "dirChildMap"));
                    dirMap = new PBImageTextWriter.LevelDBMetadataMap.LevelDBStore(new FilePath(dbDir
                                                                                                , "dirMap"));
                }
                catch (IOException e)
                {
                    Log.Error("Failed to open LevelDBs", e);
                    IOUtils.Cleanup(null, this);
                }
            }
예제 #2
0
 /// <exception cref="System.IO.IOException"/>
 public virtual void Close()
 {
     IOUtils.Cleanup(null, dirChildMap, dirMap);
     dirChildMap = null;
     dirMap      = null;
 }