@@ -24,28 +24,36 @@ use std::{
24
24
time:: Duration ,
25
25
} ;
26
26
use crate :: {
27
- CblRef , CouchbaseLiteError , Database , Dict , Document , Error , ErrorCode , ListenerToken ,
28
- MutableDict , Result , check_error , release, retain,
29
- slice:: { from_str, from_bytes , self } ,
27
+ CblRef , Database , Dict , Document , Error , ListenerToken , MutableDict , Result , check_error ,
28
+ release, retain,
29
+ slice:: { from_str, self } ,
30
30
c_api:: {
31
31
CBLListener_Remove , CBLAuth_CreatePassword , CBLAuth_CreateSession , CBLAuthenticator ,
32
- CBLDocument , CBLDocumentFlags , CBLEndpoint , CBLEndpoint_CreateWithLocalDB ,
33
- CBLEndpoint_CreateWithURL , CBLError , CBLProxySettings , CBLProxyType , CBLReplicatedDocument ,
34
- CBLReplicator , CBLReplicatorConfiguration , CBLReplicatorStatus , CBLReplicatorType ,
32
+ CBLDocument , CBLDocumentFlags , CBLEndpoint , CBLEndpoint_CreateWithURL , CBLError ,
33
+ CBLProxySettings , CBLProxyType , CBLReplicatedDocument , CBLReplicator ,
34
+ CBLReplicatorConfiguration , CBLReplicatorStatus , CBLReplicatorType ,
35
35
CBLReplicator_AddChangeListener , CBLReplicator_AddDocumentReplicationListener ,
36
36
CBLReplicator_Create , CBLReplicator_IsDocumentPending , CBLReplicator_PendingDocumentIDs ,
37
37
CBLReplicator_SetHostReachable , CBLReplicator_SetSuspended , CBLReplicator_Start ,
38
- CBLReplicator_Status , CBLReplicator_Stop , FLDict , FLSlice , FLSliceResult ,
39
- FLSliceResult_New , FLSlice_Copy , FLString , FLStringResult , kCBLDocumentFlagsAccessRemoved,
38
+ CBLReplicator_Status , CBLReplicator_Stop , FLDict , FLString , kCBLDocumentFlagsAccessRemoved,
40
39
kCBLDocumentFlagsDeleted, kCBLProxyHTTP, kCBLProxyHTTPS, kCBLReplicatorBusy,
41
40
kCBLReplicatorConnecting, kCBLReplicatorIdle, kCBLReplicatorOffline, kCBLReplicatorStopped,
42
41
kCBLReplicatorTypePull, kCBLReplicatorTypePush, kCBLReplicatorTypePushAndPull,
43
42
CBLReplicator_IsDocumentPending2 , CBLReplicator_PendingDocumentIDs2 ,
44
43
CBLReplicationCollection ,
45
44
} ,
46
- MutableArray , Listener , error ,
45
+ MutableArray , Listener ,
47
46
collection:: Collection ,
48
47
} ;
48
+ #[ cfg( feature = "enterprise" ) ]
49
+ use crate :: {
50
+ CouchbaseLiteError , ErrorCode , error,
51
+ c_api:: {
52
+ CBLEndpoint_CreateWithLocalDB , FLSlice , FLSliceResult , FLSliceResult_New , FLSlice_Copy ,
53
+ FLStringResult ,
54
+ } ,
55
+ slice:: from_bytes,
56
+ } ;
49
57
50
58
// WARNING: THIS API IS UNIMPLEMENTED SO FAR
51
59
@@ -79,6 +87,7 @@ impl Endpoint {
79
87
}
80
88
}
81
89
90
+ #[ cfg( feature = "enterprise" ) ]
82
91
pub fn new_with_local_db ( db : & Database ) -> Self {
83
92
unsafe {
84
93
Self {
@@ -326,6 +335,7 @@ pub enum EncryptionError {
326
335
replicate with the kCBLErrorCrypto error. For security reason, the encryption
327
336
cannot be skipped. */
328
337
#[ deprecated( note = "please use `CollectionPropertyEncryptor` on default collection instead" ) ]
338
+ #[ cfg( feature = "enterprise" ) ]
329
339
pub type DefaultCollectionPropertyEncryptor = fn (
330
340
document_id : Option < String > ,
331
341
properties : Dict ,
@@ -336,6 +346,7 @@ pub type DefaultCollectionPropertyEncryptor = fn(
336
346
error : & Error ,
337
347
) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
338
348
#[ no_mangle]
349
+ #[ cfg( feature = "enterprise" ) ]
339
350
pub extern "C" fn c_default_collection_property_encryptor (
340
351
context : * mut :: std:: os:: raw:: c_void ,
341
352
document_id : FLString ,
@@ -401,6 +412,7 @@ pub extern "C" fn c_default_collection_property_encryptor(
401
412
\note If a null result or an error is returned, the document will be failed to
402
413
replicate with the kCBLErrorCrypto error. For security reason, the encryption
403
414
cannot be skipped. */
415
+ #[ cfg( feature = "enterprise" ) ]
404
416
pub type CollectionPropertyEncryptor = fn (
405
417
scope : Option < String > ,
406
418
collection : Option < String > ,
@@ -413,6 +425,7 @@ pub type CollectionPropertyEncryptor = fn(
413
425
error : & Error ,
414
426
) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
415
427
#[ no_mangle]
428
+ #[ cfg( feature = "enterprise" ) ]
416
429
pub extern "C" fn c_collection_property_encryptor (
417
430
context : * mut :: std:: os:: raw:: c_void ,
418
431
scope : FLString ,
@@ -483,6 +496,7 @@ pub extern "C" fn c_collection_property_encryptor(
483
496
without an error is returned. If an error is returned, the document will be failed to replicate
484
497
with the kCBLErrorCrypto error. */
485
498
#[ deprecated( note = "please use `CollectionPropertyDecryptor` on default collection instead" ) ]
499
+ #[ cfg( feature = "enterprise" ) ]
486
500
pub type DefaultCollectionPropertyDecryptor = fn (
487
501
document_id : Option < String > ,
488
502
properties : Dict ,
@@ -493,6 +507,7 @@ pub type DefaultCollectionPropertyDecryptor = fn(
493
507
error : & Error ,
494
508
) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
495
509
#[ no_mangle]
510
+ #[ cfg( feature = "enterprise" ) ]
496
511
pub extern "C" fn c_default_collection_property_decryptor (
497
512
context : * mut :: std:: os:: raw:: c_void ,
498
513
document_id : FLString ,
@@ -558,6 +573,7 @@ pub extern "C" fn c_default_collection_property_decryptor(
558
573
\note The decryption will be skipped (the encrypted data will be kept) when a null result
559
574
without an error is returned. If an error is returned, the document will be failed to replicate
560
575
with the kCBLErrorCrypto error. */
576
+ #[ cfg( feature = "enterprise" ) ]
561
577
pub type CollectionPropertyDecryptor = fn (
562
578
scope : Option < String > ,
563
579
collection : Option < String > ,
@@ -570,6 +586,7 @@ pub type CollectionPropertyDecryptor = fn(
570
586
error : & Error ,
571
587
) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
572
588
#[ no_mangle]
589
+ #[ cfg( feature = "enterprise" ) ]
573
590
pub extern "C" fn c_collection_property_decryptor (
574
591
context : * mut :: std:: os:: raw:: c_void ,
575
592
scope : FLString ,
@@ -640,9 +657,13 @@ pub struct ReplicationConfigurationContext {
640
657
pub push_filter : Option < ReplicationFilter > , // TODO: deprecated
641
658
pub pull_filter : Option < ReplicationFilter > , // TODO: deprecated
642
659
pub conflict_resolver : Option < ConflictResolver > , // TODO: deprecated
660
+ #[ cfg( feature = "enterprise" ) ]
643
661
pub default_collection_property_encryptor : Option < DefaultCollectionPropertyEncryptor > , // TODO: deprecated
662
+ #[ cfg( feature = "enterprise" ) ]
644
663
pub default_collection_property_decryptor : Option < DefaultCollectionPropertyDecryptor > , // TODO: deprecated
664
+ #[ cfg( feature = "enterprise" ) ]
645
665
pub collection_property_encryptor : Option < CollectionPropertyEncryptor > ,
666
+ #[ cfg( feature = "enterprise" ) ]
646
667
pub collection_property_decryptor : Option < CollectionPropertyDecryptor > ,
647
668
}
648
669
@@ -805,18 +826,22 @@ impl Replicator {
805
826
. conflict_resolver
806
827
. as_ref ( )
807
828
. and ( Some ( c_replication_conflict_resolver) ) ,
829
+ #[ cfg( feature = "enterprise" ) ]
808
830
propertyEncryptor : context
809
831
. default_collection_property_encryptor
810
832
. as_ref ( )
811
833
. and ( Some ( c_default_collection_property_encryptor) ) ,
834
+ #[ cfg( feature = "enterprise" ) ]
812
835
propertyDecryptor : context
813
836
. default_collection_property_decryptor
814
837
. as_ref ( )
815
838
. and ( Some ( c_default_collection_property_decryptor) ) ,
839
+ #[ cfg( feature = "enterprise" ) ]
816
840
documentPropertyEncryptor : context
817
841
. collection_property_encryptor
818
842
. as_ref ( )
819
843
. and ( Some ( c_collection_property_encryptor) ) ,
844
+ #[ cfg( feature = "enterprise" ) ]
820
845
documentPropertyDecryptor : context
821
846
. collection_property_decryptor
822
847
. as_ref ( )
0 commit comments