LevelProvider: Remove cyclic dependency between Level and LevelProvider

This will now allow LevelProviders to be constructed on threads.
This commit is contained in:
Dylan K. Taylor
2017-12-31 17:06:18 +00:00
parent d19683b7dd
commit 1a615591e2
5 changed files with 17 additions and 29 deletions

View File

@ -87,10 +87,9 @@ class LevelDB extends BaseLevelProvider{
}
}
public function __construct(Level $level, string $path){
public function __construct(string $path){
self::checkForLevelDBExtension();
$this->level = $level;
$this->path = $path;
if(!file_exists($this->path)){
mkdir($this->path, 0777, true);
@ -530,6 +529,5 @@ class LevelDB extends BaseLevelProvider{
public function close(){
$this->unloadChunks();
$this->db->close();
$this->level = null;
}
}