Package com.couchbase.lite
Class DatabaseConfiguration
java.lang.Object
com.couchbase.lite.DatabaseConfiguration
Configuration for opening a database.
-
Constructor Summary
ConstructorDescriptionCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected DatabaseConfiguration
Returns the path to the directory that contains the database.ENTERPRISE EDITION APIboolean
setDirectory
(String directory) Set the canonical path of the directory in which to store the database.setEncryptionKey
(EncryptionKey encryptionKey) ENTERPRISE EDITION APIsetFullSync
(boolean isfullSync) As Couchbase Lite normally configures its databases, there is a very small (though non-zero) chance that a power failure at just the wrong time could cause the most recently committed transaction's changes to be lost.
-
Constructor Details
-
DatabaseConfiguration
public DatabaseConfiguration() -
DatabaseConfiguration
Copy constructor- Parameters:
config
- the configuration to duplicate.
-
-
Method Details
-
setEncryptionKey
ENTERPRISE EDITION API
Set a key to encrypt the database with. If the database does not exist and is being created, it will use this key, and the same key must be given every time it's opened
- Parameters:
encryptionKey
- the key- Returns:
- this.
-
getEncryptionKey
ENTERPRISE EDITION API
Returns a key to encrypt the database with.
- Returns:
- the key
-
getDatabaseConfiguration
-
setDirectory
Set the canonical path of the directory in which to store the database. If the directory doesn't already exist it will be created. If it cannot be created an CouchbaseLiteError will be thrown. Note: The directory set by this method is the canonical path to the directory whose path is passed. It is *NOT* necessarily the case that directory.equals(config.setDirectory(directory).getDirectory())- Parameters:
directory
- the directory- Returns:
- this.
- Throws:
CouchbaseLiteError
- if the directory does not exist and cannot be created
-
getDirectory
Returns the path to the directory that contains the database. If this path has not been set explicitly (see:setDirectory
below), then it is the system default. Note: The directory returned by this method is the canonical path to the directory whose path was set. It is *NOT* necessarily the case that directory.equals(config.setDirectory(directory).getDirectory())- Returns:
- the database directory
-
setFullSync
As Couchbase Lite normally configures its databases, there is a very small (though non-zero) chance that a power failure at just the wrong time could cause the most recently committed transaction's changes to be lost. This would cause the database to appear as it did immediately before that transaction. Setting this mode true ensures that an operating system crash or power failure will not cause the loss of any data. Full sync mode is very safe but it is also dramatically slower. -
isFullSync
public boolean isFullSync()
-