| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 m_comparatorAdapter.clear(); | 126 m_comparatorAdapter.clear(); |
| 127 m_env.clear(); | 127 m_env.clear(); |
| 128 } | 128 } |
| 129 | 129 |
| 130 static leveldb::Status openDB(leveldb::Comparator* comparator, leveldb::Env* env
, const String& path, leveldb::DB** db) | 130 static leveldb::Status openDB(leveldb::Comparator* comparator, leveldb::Env* env
, const String& path, leveldb::DB** db) |
| 131 { | 131 { |
| 132 leveldb::Options options; | 132 leveldb::Options options; |
| 133 options.comparator = comparator; | 133 options.comparator = comparator; |
| 134 options.create_if_missing = true; | 134 options.create_if_missing = true; |
| 135 options.paranoid_checks = true; | 135 options.paranoid_checks = true; |
| 136 // 20 max_open_files is the minimum LevelDB allows. |
| 137 options.max_open_files = 20; |
| 136 options.env = env; | 138 options.env = env; |
| 137 | 139 |
| 138 return leveldb::DB::Open(options, path.utf8().data(), db); | 140 return leveldb::DB::Open(options, path.utf8().data(), db); |
| 139 } | 141 } |
| 140 | 142 |
| 141 bool LevelDBDatabase::destroy(const String& fileName) | 143 bool LevelDBDatabase::destroy(const String& fileName) |
| 142 { | 144 { |
| 143 leveldb::Options options; | 145 leveldb::Options options; |
| 144 options.env = leveldb::IDBEnv(); | 146 options.env = leveldb::IDBEnv(); |
| 145 const leveldb::Status s = leveldb::DestroyDB(fileName.utf8().data(), options
); | 147 const leveldb::Status s = leveldb::DestroyDB(fileName.utf8().data(), options
); |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 } | 337 } |
| 336 | 338 |
| 337 const LevelDBComparator* LevelDBDatabase::comparator() const | 339 const LevelDBComparator* LevelDBDatabase::comparator() const |
| 338 { | 340 { |
| 339 return m_comparator; | 341 return m_comparator; |
| 340 } | 342 } |
| 341 | 343 |
| 342 } | 344 } |
| 343 | 345 |
| 344 #endif | 346 #endif |
| OLD | NEW |