CBLDatabaseConfiguration

@interface CBLDatabaseConfiguration : NSObject

/**
 Path to the directory to store the database in. If the directory doesn't already exist it will
 be created when the database is opened. The default directory will be in Application Support.
 You won't usually need to change this.
 */
@property (nonatomic, copy) NSString* directory;

/** 
 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 synchronous
 is very safe but it is also dramatically slower.
 */
@property (nonatomic) BOOL fullSync;

/**
 Enables or disables memory-mapped I/O. By default, memory-mapped I/O is enabled.
 Disabling it may affect database performance. Typically, there is no need to modify this setting.

 @note: Memory-mapped I/O is always disabled to prevent database corruption on macOS.
 As a result, setting this configuration has no effect on the macOS platform.
 */
@property (nonatomic) BOOL mmapEnabled;

/**
 Initializes the CBLDatabaseConfiguration object.
 */
- (instancetype) init;


/**
 Initializes the CBLDatabaseConfiguration object with the configuration object.

 @param config The configuration object.
 @return The CBLDatabaseConfiguration object.
 */
- (instancetype) initWithConfig: (nullable CBLDatabaseConfiguration*)config;

@end

Undocumented

  • Path to the directory to store the database in. If the directory doesn’t already exist it will be created when the database is opened. The default directory will be in Application Support. You won’t usually need to change this.

    Declaration

    Objective-C

    @property (nonatomic, copy) NSString *_Nonnull directory;
  • 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 synchronous is very safe but it is also dramatically slower.

    Declaration

    Objective-C

    @property (nonatomic) BOOL fullSync;
  • Enables or disables memory-mapped I/O. By default, memory-mapped I/O is enabled. Disabling it may affect database performance. Typically, there is no need to modify this setting.

    @note: Memory-mapped I/O is always disabled to prevent database corruption on macOS. As a result, setting this configuration has no effect on the macOS platform.

    Declaration

    Objective-C

    @property (nonatomic) BOOL mmapEnabled;
  • Initializes the CBLDatabaseConfiguration object.

    Declaration

    Objective-C

    - (nonnull instancetype)init;
  • Initializes the CBLDatabaseConfiguration object with the configuration object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithConfig:
        (nullable CBLDatabaseConfiguration *)config;

    Parameters

    config

    The configuration object.

    Return Value

    The CBLDatabaseConfiguration object.

Encryption

  • ENTERPRISE EDITION ONLY.

    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.

    • The primary form of key is an NSData object 32 bytes in length: this is interpreted as a raw AES-256 key. To create a key, generate random data using a secure cryptographic randomizer like SecRandomCopyBytes or CCRandomGenerateBytes.
    • Alternatively, the value may be an NSString containing a password. This will be run through 64,000 rounds of the PBKDF algorithm to securely convert it into an AES-256 key.
    • A default nil value, of course, means the database is unencrypted.

    Declaration

    Objective-C

    @property (nonatomic, nullable) CBLEncryptionKey *encryptionKey;