Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CBL-5490 : Update default constants #543

Merged
merged 1 commit into from
Jun 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions include/cbl/CBLDefaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// CBLDefaults.h
// CouchbaseLite
//
// Copyright (c) 2023-present Couchbase, Inc All rights reserved.
// Copyright (c) 2024-present Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -24,6 +24,7 @@
#pragma once
#include "CBL_Compat.h"
#include "CBLReplicator.h"
#include "CBLIndexTypes.h"

CBL_CAPI_BEGIN

Expand All @@ -38,6 +39,10 @@ CBL_CAPI_BEGIN
*/

/** [false] Plaintext is not used, and instead binary encoding is used in log files */
CBL_PUBLIC extern const bool kCBLDefaultLogFileUsePlaintext;

/** [false] Plaintext is not used, and instead binary encoding is used in log files
@warning <b>Deprecated :</b> Use kCBLDefaultLogFileUsePlaintext instead. */
CBL_PUBLIC extern const bool kCBLDefaultLogFileUsePlainText;

/** [524288] 512 KiB for the size of a log file */
Expand All @@ -46,7 +51,6 @@ CBL_PUBLIC extern const size_t kCBLDefaultLogFileMaxSize;
/** [1] 1 rotated file present (2 total, including the currently active log file) */
CBL_PUBLIC extern const uint32_t kCBLDefaultLogFileMaxRotateCount;


/** @} */

/** \name CBLFullTextIndexConfiguration
Expand All @@ -56,7 +60,6 @@ CBL_PUBLIC extern const uint32_t kCBLDefaultLogFileMaxRotateCount;
/** [false] Accents and ligatures are not ignored when indexing via full text search */
CBL_PUBLIC extern const bool kCBLDefaultFullTextIndexIgnoreAccents;


/** @} */

/** \name CBLReplicatorConfiguration
Expand All @@ -79,6 +82,10 @@ CBL_PUBLIC extern const unsigned kCBLDefaultReplicatorMaxAttemptsSingleShot;
CBL_PUBLIC extern const unsigned kCBLDefaultReplicatorMaxAttemptsContinuous;

/** [300] Max wait time between retry attempts in seconds */
CBL_PUBLIC extern const unsigned kCBLDefaultReplicatorMaxAttemptsWaitTime;

/** [300] Max wait time between retry attempts in seconds
@warning <b>Deprecated :</b> Use kCBLDefaultReplicatorMaxAttemptsWaitTime instead. */
CBL_PUBLIC extern const unsigned kCBLDefaultReplicatorMaxAttemptWaitTime;

/** [false] Purge documents when a user loses access */
Expand All @@ -89,6 +96,22 @@ CBL_PUBLIC extern const bool kCBLDefaultReplicatorAcceptParentCookies;

/** @} */

#ifdef COUCHBASE_ENTERPRISE

/** \name CBLVectorIndexConfiguration
@{
*/

/** [false] Vectors are not lazily indexed, by default */
CBL_PUBLIC extern const bool kCBLDefaultVectorIndexLazy;

/** [kCBLDistanceMetricEuclidean] By default, vectors are compared using Euclidean metrics */
CBL_PUBLIC extern const CBLDistanceMetric kCBLDefaultVectorIndexDistanceMetric;

/** @} */

#endif

/** @} */

CBL_CAPI_END
2 changes: 1 addition & 1 deletion include/cbl/CBLLog.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ typedef struct {
size_t maxSize;

/** Whether or not to log in plaintext (as opposed to binary.) Plaintext logging is slower and bigger.
The default is \ref kCBLDefaultLogFileUsePlainText. */
The default is \ref kCBLDefaultLogFileUsePlaintext. */
bool usePlaintext;
} CBLLogFileConfiguration;

Expand Down
2 changes: 1 addition & 1 deletion include/cbl/CBLReplicator.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ typedef struct {
unsigned maxAttempts;

/** Max wait time between retry attempts in seconds.
The default value \ref kCBLDefaultReplicatorMaxAttemptWaitTime. */
The default value \ref kCBLDefaultReplicatorMaxAttemptsWaitTime. */
unsigned maxAttemptWaitTime;

//-- WebSocket:
Expand Down
13 changes: 12 additions & 1 deletion src/CBLDefaults_CAPI.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// CBLDefaults_CAPI.cc
// CouchbaseLite
//
// Copyright (c) 2023-present Couchbase, Inc All rights reserved.
// Copyright (c) 2024-present Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -26,6 +26,7 @@

#pragma mark - CBLLogFileConfiguration

CBL_PUBLIC const bool kCBLDefaultLogFileUsePlaintext = false;
CBL_PUBLIC const bool kCBLDefaultLogFileUsePlainText = false;
CBL_PUBLIC const size_t kCBLDefaultLogFileMaxSize = 524288;
CBL_PUBLIC const uint32_t kCBLDefaultLogFileMaxRotateCount = 1;
Expand All @@ -41,6 +42,16 @@ CBL_PUBLIC const bool kCBLDefaultReplicatorContinuous = false;
CBL_PUBLIC const unsigned kCBLDefaultReplicatorHeartbeat = 300;
CBL_PUBLIC const unsigned kCBLDefaultReplicatorMaxAttemptsSingleShot = 10;
CBL_PUBLIC const unsigned kCBLDefaultReplicatorMaxAttemptsContinuous = UINT_MAX;
CBL_PUBLIC const unsigned kCBLDefaultReplicatorMaxAttemptsWaitTime = 300;
CBL_PUBLIC const unsigned kCBLDefaultReplicatorMaxAttemptWaitTime = 300;
CBL_PUBLIC const bool kCBLDefaultReplicatorDisableAutoPurge = false;
CBL_PUBLIC const bool kCBLDefaultReplicatorAcceptParentCookies = false;

#ifdef COUCHBASE_ENTERPRISE

#pragma mark - CBLVectorIndexConfiguration

CBL_PUBLIC const bool kCBLDefaultVectorIndexLazy = false;
CBL_PUBLIC const CBLDistanceMetric kCBLDefaultVectorIndexDistanceMetric = kCBLDistanceMetricEuclidean;

#endif
2 changes: 1 addition & 1 deletion src/CBLReplicatorConfig.hh
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ namespace cbl_internal
if (maxAttemptWaitTime > 0) {
enc.writeUInt(maxAttemptWaitTime);
} else {
enc.writeUInt(kCBLDefaultReplicatorMaxAttemptWaitTime);
enc.writeUInt(kCBLDefaultReplicatorMaxAttemptsWaitTime);
}

enc.writeKey(slice(kC4ReplicatorHeartbeatInterval));
Expand Down
26 changes: 26 additions & 0 deletions src/exports/CBLDefaults_EE_Exports.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//
// CBLDefaults_EE_Exports.txt
// CouchbaseLite
//
// Copyright (c) 2023-present Couchbase, Inc All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

// THIS IS AN AUTOGENERATED FILE, MANUAL CHANGES SHOULD BE EXPECTED TO
// BE OVERWRITTEN

### CBLVectorIndexConfiguration

kCBLDefaultVectorIndexLazy
kCBLDefaultVectorIndexDistanceMetric
2 changes: 2 additions & 0 deletions src/exports/CBLDefaults_Exports.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

### CBLLogFileConfiguration

kCBLDefaultLogFileUsePlaintext
kCBLDefaultLogFileUsePlainText
kCBLDefaultLogFileMaxSize
kCBLDefaultLogFileMaxRotateCount
Expand All @@ -38,5 +39,6 @@ kCBLDefaultReplicatorHeartbeat
kCBLDefaultReplicatorMaxAttemptsSingleShot
kCBLDefaultReplicatorMaxAttemptsContinuous
kCBLDefaultReplicatorMaxAttemptWaitTime
kCBLDefaultReplicatorMaxAttemptsWaitTime
kCBLDefaultReplicatorDisableAutoPurge
kCBLDefaultReplicatorAcceptParentCookies
2 changes: 1 addition & 1 deletion src/exports/generate_exports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ SCRIPT_DIR=`dirname $0`
cd "$SCRIPT_DIR/generated"

cat ../CBL_Exports.txt ../CBLDefaults_Exports.txt ../Fleece_Exports.txt >exports.txt
cat ../CBL_EE_Exports.txt exports.txt >exports_ee.txt
cat ../CBL_EE_Exports.txt ../CBLDefaults_EE_Exports.txt exports.txt >exports_ee.txt

cat ../Fleece_Apple_Exports.txt exports.txt >apple_exports.txt
cat ../Fleece_Apple_Exports.txt exports_ee.txt >apple_exports_ee.txt
Expand Down
2 changes: 2 additions & 0 deletions src/exports/generated/CBL.def
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ CBLError_SetCaptureBacktraces
CBLQuery_SetListenerCallbackDelay
CBLLog_BeginExpectingExceptions
CBLLog_EndExpectingExceptions
kCBLDefaultLogFileUsePlaintext
kCBLDefaultLogFileUsePlainText
kCBLDefaultLogFileMaxSize
kCBLDefaultLogFileMaxRotateCount
Expand All @@ -189,6 +190,7 @@ kCBLDefaultReplicatorHeartbeat
kCBLDefaultReplicatorMaxAttemptsSingleShot
kCBLDefaultReplicatorMaxAttemptsContinuous
kCBLDefaultReplicatorMaxAttemptWaitTime
kCBLDefaultReplicatorMaxAttemptsWaitTime
kCBLDefaultReplicatorDisableAutoPurge
kCBLDefaultReplicatorAcceptParentCookies
kFLNullValue
Expand Down
2 changes: 2 additions & 0 deletions src/exports/generated/CBL.exp
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ _CBLError_SetCaptureBacktraces
_CBLQuery_SetListenerCallbackDelay
_CBLLog_BeginExpectingExceptions
_CBLLog_EndExpectingExceptions
_kCBLDefaultLogFileUsePlaintext
_kCBLDefaultLogFileUsePlainText
_kCBLDefaultLogFileMaxSize
_kCBLDefaultLogFileMaxRotateCount
Expand All @@ -197,6 +198,7 @@ _kCBLDefaultReplicatorHeartbeat
_kCBLDefaultReplicatorMaxAttemptsSingleShot
_kCBLDefaultReplicatorMaxAttemptsContinuous
_kCBLDefaultReplicatorMaxAttemptWaitTime
_kCBLDefaultReplicatorMaxAttemptsWaitTime
_kCBLDefaultReplicatorDisableAutoPurge
_kCBLDefaultReplicatorAcceptParentCookies
_kFLNullValue
Expand Down
2 changes: 2 additions & 0 deletions src/exports/generated/CBL.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ CBL_C {
CBLQuery_SetListenerCallbackDelay;
CBLLog_BeginExpectingExceptions;
CBLLog_EndExpectingExceptions;
kCBLDefaultLogFileUsePlaintext;
kCBLDefaultLogFileUsePlainText;
kCBLDefaultLogFileMaxSize;
kCBLDefaultLogFileMaxRotateCount;
Expand All @@ -187,6 +188,7 @@ CBL_C {
kCBLDefaultReplicatorMaxAttemptsSingleShot;
kCBLDefaultReplicatorMaxAttemptsContinuous;
kCBLDefaultReplicatorMaxAttemptWaitTime;
kCBLDefaultReplicatorMaxAttemptsWaitTime;
kCBLDefaultReplicatorDisableAutoPurge;
kCBLDefaultReplicatorAcceptParentCookies;
kFLNullValue;
Expand Down
2 changes: 2 additions & 0 deletions src/exports/generated/CBL_Android.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ CBL_C {
CBLQuery_SetListenerCallbackDelay;
CBLLog_BeginExpectingExceptions;
CBLLog_EndExpectingExceptions;
kCBLDefaultLogFileUsePlaintext;
kCBLDefaultLogFileUsePlainText;
kCBLDefaultLogFileMaxSize;
kCBLDefaultLogFileMaxRotateCount;
Expand All @@ -188,6 +189,7 @@ CBL_C {
kCBLDefaultReplicatorMaxAttemptsSingleShot;
kCBLDefaultReplicatorMaxAttemptsContinuous;
kCBLDefaultReplicatorMaxAttemptWaitTime;
kCBLDefaultReplicatorMaxAttemptsWaitTime;
kCBLDefaultReplicatorDisableAutoPurge;
kCBLDefaultReplicatorAcceptParentCookies;
kFLNullValue;
Expand Down
4 changes: 4 additions & 0 deletions src/exports/generated/CBL_EE.def
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ CBLIndexUpdater_SetVector
CBLIndexUpdater_SkipVector
CBLIndexUpdater_Finish
CBLIndexUpdater_Value
kCBLDefaultVectorIndexLazy
kCBLDefaultVectorIndexDistanceMetric
CBL_Retain
CBL_Release
CBL_InstanceCount
Expand Down Expand Up @@ -214,6 +216,7 @@ CBLError_SetCaptureBacktraces
CBLQuery_SetListenerCallbackDelay
CBLLog_BeginExpectingExceptions
CBLLog_EndExpectingExceptions
kCBLDefaultLogFileUsePlaintext
kCBLDefaultLogFileUsePlainText
kCBLDefaultLogFileMaxSize
kCBLDefaultLogFileMaxRotateCount
Expand All @@ -224,6 +227,7 @@ kCBLDefaultReplicatorHeartbeat
kCBLDefaultReplicatorMaxAttemptsSingleShot
kCBLDefaultReplicatorMaxAttemptsContinuous
kCBLDefaultReplicatorMaxAttemptWaitTime
kCBLDefaultReplicatorMaxAttemptsWaitTime
kCBLDefaultReplicatorDisableAutoPurge
kCBLDefaultReplicatorAcceptParentCookies
kFLNullValue
Expand Down
4 changes: 4 additions & 0 deletions src/exports/generated/CBL_EE.exp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ _CBLIndexUpdater_SetVector
_CBLIndexUpdater_SkipVector
_CBLIndexUpdater_Finish
_CBLIndexUpdater_Value
_kCBLDefaultVectorIndexLazy
_kCBLDefaultVectorIndexDistanceMetric
_CBL_Retain
_CBL_Release
_CBL_InstanceCount
Expand Down Expand Up @@ -222,6 +224,7 @@ _CBLError_SetCaptureBacktraces
_CBLQuery_SetListenerCallbackDelay
_CBLLog_BeginExpectingExceptions
_CBLLog_EndExpectingExceptions
_kCBLDefaultLogFileUsePlaintext
_kCBLDefaultLogFileUsePlainText
_kCBLDefaultLogFileMaxSize
_kCBLDefaultLogFileMaxRotateCount
Expand All @@ -232,6 +235,7 @@ _kCBLDefaultReplicatorHeartbeat
_kCBLDefaultReplicatorMaxAttemptsSingleShot
_kCBLDefaultReplicatorMaxAttemptsContinuous
_kCBLDefaultReplicatorMaxAttemptWaitTime
_kCBLDefaultReplicatorMaxAttemptsWaitTime
_kCBLDefaultReplicatorDisableAutoPurge
_kCBLDefaultReplicatorAcceptParentCookies
_kFLNullValue
Expand Down
4 changes: 4 additions & 0 deletions src/exports/generated/CBL_EE.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ CBL_C {
CBLIndexUpdater_SkipVector;
CBLIndexUpdater_Finish;
CBLIndexUpdater_Value;
kCBLDefaultVectorIndexLazy;
kCBLDefaultVectorIndexDistanceMetric;
CBL_Retain;
CBL_Release;
CBL_InstanceCount;
Expand Down Expand Up @@ -212,6 +214,7 @@ CBL_C {
CBLQuery_SetListenerCallbackDelay;
CBLLog_BeginExpectingExceptions;
CBLLog_EndExpectingExceptions;
kCBLDefaultLogFileUsePlaintext;
kCBLDefaultLogFileUsePlainText;
kCBLDefaultLogFileMaxSize;
kCBLDefaultLogFileMaxRotateCount;
Expand All @@ -222,6 +225,7 @@ CBL_C {
kCBLDefaultReplicatorMaxAttemptsSingleShot;
kCBLDefaultReplicatorMaxAttemptsContinuous;
kCBLDefaultReplicatorMaxAttemptWaitTime;
kCBLDefaultReplicatorMaxAttemptsWaitTime;
kCBLDefaultReplicatorDisableAutoPurge;
kCBLDefaultReplicatorAcceptParentCookies;
kFLNullValue;
Expand Down
4 changes: 4 additions & 0 deletions src/exports/generated/CBL_EE_Android.gnu
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ CBL_C {
CBLIndexUpdater_SkipVector;
CBLIndexUpdater_Finish;
CBLIndexUpdater_Value;
kCBLDefaultVectorIndexLazy;
kCBLDefaultVectorIndexDistanceMetric;
CBL_Retain;
CBL_Release;
CBL_InstanceCount;
Expand Down Expand Up @@ -213,6 +215,7 @@ CBL_C {
CBLQuery_SetListenerCallbackDelay;
CBLLog_BeginExpectingExceptions;
CBLLog_EndExpectingExceptions;
kCBLDefaultLogFileUsePlaintext;
kCBLDefaultLogFileUsePlainText;
kCBLDefaultLogFileMaxSize;
kCBLDefaultLogFileMaxRotateCount;
Expand All @@ -223,6 +226,7 @@ CBL_C {
kCBLDefaultReplicatorMaxAttemptsSingleShot;
kCBLDefaultReplicatorMaxAttemptsContinuous;
kCBLDefaultReplicatorMaxAttemptWaitTime;
kCBLDefaultReplicatorMaxAttemptsWaitTime;
kCBLDefaultReplicatorDisableAutoPurge;
kCBLDefaultReplicatorAcceptParentCookies;
kFLNullValue;
Expand Down
Loading