public class RDBFactory extends Object implements Runnable
Tablespace.getDataDir().
It runs a thread that synchronises them from time to time and closes
those that have not been used in a while| Modifier and Type | Field and Description |
|---|---|
static org.rocksdb.FlushOptions |
flushOptions |
| Modifier and Type | Method and Description |
|---|---|
void |
close(YRDB yrdb)
immediately closes the database
|
void |
closeIfOpen(String relativePath)
Close the DB if open (called when dropping the table)
|
void |
delete(String file) |
void |
dispose(YRDB rdb) |
CompletableFuture<Void> |
doBackup(String backupDir)
Performs backup of the root database to a given directory
|
CompletableFuture<Void> |
doBackup(String relativePath,
String backupDir)
Performs a backup of the database to the given directory
|
static RDBFactory |
getInstance(String dataDir) |
List<String> |
getOpenDbPaths() |
YRDB |
getOpenRdb()
Get the root database if it's open, otherwise return null
|
YRDB |
getOpenRdb(String relativePath)
Get the database which is already open or null if it is not open
|
YRDB |
getRdb(boolean readonly)
Opens or creates a database at the root dataDir
|
YRDB |
getRdb(String relativePath,
boolean readonly)
Opens or create a database at a given relative path
|
CompletableFuture<Void> |
restoreBackup(int backupId,
String backupDir,
String relativePath) |
CompletableFuture<Void> |
restoreBackup(String backupDir,
String relativePath) |
void |
run() |
static void |
shutdownAll()
Called from Unit tests to cleanup before the next test
|
public static RDBFactory getInstance(String dataDir)
public YRDB getRdb(String relativePath, boolean readonly) throws IOException
relativePath - - relative path to the dataDir- should be a directoryreadonly - - open in readonly mode; if the database is open in readwrite mode, it will be returned like thatIOExceptionpublic YRDB getRdb(boolean readonly) throws IOException
IOExceptionpublic void delete(String file)
public void dispose(YRDB rdb)
public void closeIfOpen(String relativePath)
relativePath - public YRDB getOpenRdb()
public YRDB getOpenRdb(String relativePath)
relativePath - path of the database to be returnedpublic void close(YRDB yrdb)
yrdb - public CompletableFuture<Void> doBackup(String backupDir)
backupDir - public CompletableFuture<Void> doBackup(String relativePath, String backupDir)
relativePath - backupDir - public CompletableFuture<Void> restoreBackup(String backupDir, String relativePath)
public CompletableFuture<Void> restoreBackup(int backupId, String backupDir, String relativePath)
public static void shutdownAll()
Copyright © 2018 Space Applications Services. All rights reserved.