18
18
19
19
#pragma once
20
20
#include <CouchbaseLite/CBLBase.h>
21
- #include <CouchbaseLite/FLSlice.h>
22
21
23
22
CBL_CAPI_BEGIN
24
23
@@ -72,6 +71,14 @@ CBLDatabaseConfiguration CBLDatabaseConfiguration_Default(void) CBLAPI;
72
71
@param password The input password, which can be any data.
73
72
@return True on success, false if there was a problem deriving the key. */
74
73
bool CBLEncryptionKey_FromPassword (CBLEncryptionKey * key , FLString password ) CBLAPI ;
74
+
75
+ /** VOLATILE API: Derives an encryption key from a password in a way that is
76
+ compatible with certain variants of Couchbase Lite in which a slightly different
77
+ hashing algorithm is used. The same notes apply as in CBLEncryptionKey_FromPassword
78
+ @param key The derived AES key will be stored here.
79
+ @param password The input password, which can be any data.
80
+ @return True on success, false if there was a problem deriving the key. */
81
+ bool CBLEncryptionKey_FromPasswordOld (CBLEncryptionKey * key , FLString password ) CBLAPI ;
75
82
#endif
76
83
77
84
/** @} */
@@ -96,7 +103,8 @@ bool CBL_DatabaseExists(FLString name, FLString inDirectory) CBLAPI;
96
103
@param fromPath The full filesystem path to the original database (including extension).
97
104
@param toName The new database name (without the ".cblite2" extension.)
98
105
@param config The database configuration (directory and encryption option.)
99
- @param outError On return, will be set to the error that occurred, if applicable.*/
106
+ @param outError On return, will be set to the error that occurred, if applicable.
107
+ @note While a database is open, one or more of its files may be in use. Attempting to copy a file, while it is in use, will fail. We recommend that you close a database before attempting to copy it. */
100
108
bool CBL_CopyDatabase (FLString fromPath ,
101
109
FLString toName ,
102
110
const CBLDatabaseConfiguration * _cbl_nullable config ,
@@ -213,15 +221,15 @@ bool CBLDatabase_PerformMaintenance(CBLDatabase* db,
213
221
/** Returns the database's name. */
214
222
FLString CBLDatabase_Name (const CBLDatabase * ) CBLAPI ;
215
223
216
- /** Returns the database's full filesystem path. */
224
+ /** Returns the database's full filesystem path, or null slice if the database is closed or deleted . */
217
225
_cbl_warn_unused
218
226
FLStringResult CBLDatabase_Path (const CBLDatabase * ) CBLAPI ;
219
227
220
- /** Returns the number of documents in the database. */
228
+ /** Returns the number of documents in the database, or zero if the database is closed or deleted.
229
+ @warning <b>Deprecated :</b> Use CBLCollection_Count on the default collection instead. */
221
230
uint64_t CBLDatabase_Count (const CBLDatabase * ) CBLAPI ;
222
231
223
- /** Returns the database's configuration, as given when it was opened.
224
- @note The encryption key is not filled in, for security reasons. */
232
+ /** Returns the database's configuration, as given when it was opened. */
225
233
const CBLDatabaseConfiguration CBLDatabase_Config (const CBLDatabase * ) CBLAPI ;
226
234
227
235
/** @} */
@@ -232,16 +240,17 @@ const CBLDatabaseConfiguration CBLDatabase_Config(const CBLDatabase*) CBLAPI;
232
240
#endif
233
241
/** \name Database listeners
234
242
@{
235
- A database change listener lets you detect changes made to all documents in a database .
243
+ A database change listener lets you detect changes made to all documents in the default collection .
236
244
(If you only want to observe specific documents, use a \ref CBLDocumentChangeListener instead.)
237
245
@note If there are multiple \ref CBLDatabase instances on the same database file, each one's
238
246
listeners will be notified of changes made by other database instances.
239
247
@warning Changes made to the database file by other processes will _not_ be notified. */
240
248
241
- /** A database change listener callback, invoked after one or more documents are changed on disk.
249
+ /** A default collection change listener callback, invoked after one or more documents in the default collection are changed on disk.
242
250
@warning By default, this listener may be called on arbitrary threads. If your code isn't
243
- prepared for that, you may want to use \ref CBLDatabase_BufferNotifications
244
- so that listeners will be called in a safe context.
251
+ prepared for that, you may want to use \ref CBLDatabase_BufferNotifications
252
+ so that listeners will be called in a safe context.
253
+ @warning <b>Deprecated :</b> CBLCollectionChangeListener instead.
245
254
@param context An arbitrary value given when the callback was registered.
246
255
@param db The database that changed.
247
256
@param numDocs The number of documents that changed (size of the `docIDs` array)
@@ -251,13 +260,13 @@ typedef void (*CBLDatabaseChangeListener)(void* _cbl_nullable context,
251
260
unsigned numDocs ,
252
261
FLString docIDs [_cbl_nonnull ]);
253
262
254
- /** Registers a database change listener callback. It will be called after one or more
263
+ /** Registers a default collection change listener callback. It will be called after one or more
255
264
documents are changed on disk.
265
+ @warning <b>Deprecated :</b> Use CBLCollection_AddChangeListener on the default collection instead.
256
266
@param db The database to observe.
257
267
@param listener The callback to be invoked.
258
268
@param context An opaque value that will be passed to the callback.
259
- @return A token to be passed to \ref CBLListener_Remove when it's time to remove the
260
- listener.*/
269
+ @return A token to be passed to \ref CBLListener_Remove when it's time to remove the listener.*/
261
270
_cbl_warn_unused
262
271
CBLListenerToken * CBLDatabase_AddChangeListener (const CBLDatabase * db ,
263
272
CBLDatabaseChangeListener listener ,
@@ -303,7 +312,7 @@ typedef void (*CBLNotificationsReadyCallback)(void* _cbl_nullable context,
303
312
@param callback The function to be called when a notification is available.
304
313
@param context An arbitrary value that will be passed to the callback. */
305
314
void CBLDatabase_BufferNotifications (CBLDatabase * db ,
306
- CBLNotificationsReadyCallback callback ,
315
+ CBLNotificationsReadyCallback _cbl_nullable callback ,
307
316
void * _cbl_nullable context ) CBLAPI ;
308
317
309
318
/** Immediately issues all pending notifications for this database, by calling their listener
0 commit comments