@@ -24,28 +24,36 @@ use std::{
2424 time:: Duration ,
2525} ;
2626use 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 } ,
3030 c_api:: {
3131 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 ,
3535 CBLReplicator_AddChangeListener , CBLReplicator_AddDocumentReplicationListener ,
3636 CBLReplicator_Create , CBLReplicator_IsDocumentPending , CBLReplicator_PendingDocumentIDs ,
3737 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,
4039 kCBLDocumentFlagsDeleted, kCBLProxyHTTP, kCBLProxyHTTPS, kCBLReplicatorBusy,
4140 kCBLReplicatorConnecting, kCBLReplicatorIdle, kCBLReplicatorOffline, kCBLReplicatorStopped,
4241 kCBLReplicatorTypePull, kCBLReplicatorTypePush, kCBLReplicatorTypePushAndPull,
4342 CBLReplicator_IsDocumentPending2 , CBLReplicator_PendingDocumentIDs2 ,
4443 CBLReplicationCollection ,
4544 } ,
46- MutableArray , Listener , error ,
45+ MutableArray , Listener ,
4746 collection:: Collection ,
4847} ;
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+ } ;
4957
5058// WARNING: THIS API IS UNIMPLEMENTED SO FAR
5159
@@ -79,6 +87,7 @@ impl Endpoint {
7987 }
8088 }
8189
90+ #[ cfg( feature = "enterprise" ) ]
8291 pub fn new_with_local_db ( db : & Database ) -> Self {
8392 unsafe {
8493 Self {
@@ -326,6 +335,7 @@ pub enum EncryptionError {
326335 replicate with the kCBLErrorCrypto error. For security reason, the encryption
327336 cannot be skipped. */
328337#[ deprecated( note = "please use `CollectionPropertyEncryptor` on default collection instead" ) ]
338+ #[ cfg( feature = "enterprise" ) ]
329339pub type DefaultCollectionPropertyEncryptor = fn (
330340 document_id : Option < String > ,
331341 properties : Dict ,
@@ -336,6 +346,7 @@ pub type DefaultCollectionPropertyEncryptor = fn(
336346 error : & Error ,
337347) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
338348#[ no_mangle]
349+ #[ cfg( feature = "enterprise" ) ]
339350pub extern "C" fn c_default_collection_property_encryptor (
340351 context : * mut :: std:: os:: raw:: c_void ,
341352 document_id : FLString ,
@@ -401,6 +412,7 @@ pub extern "C" fn c_default_collection_property_encryptor(
401412\note If a null result or an error is returned, the document will be failed to
402413 replicate with the kCBLErrorCrypto error. For security reason, the encryption
403414 cannot be skipped. */
415+ #[ cfg( feature = "enterprise" ) ]
404416pub type CollectionPropertyEncryptor = fn (
405417 scope : Option < String > ,
406418 collection : Option < String > ,
@@ -413,6 +425,7 @@ pub type CollectionPropertyEncryptor = fn(
413425 error : & Error ,
414426) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
415427#[ no_mangle]
428+ #[ cfg( feature = "enterprise" ) ]
416429pub extern "C" fn c_collection_property_encryptor (
417430 context : * mut :: std:: os:: raw:: c_void ,
418431 scope : FLString ,
@@ -483,6 +496,7 @@ pub extern "C" fn c_collection_property_encryptor(
483496 without an error is returned. If an error is returned, the document will be failed to replicate
484497 with the kCBLErrorCrypto error. */
485498#[ deprecated( note = "please use `CollectionPropertyDecryptor` on default collection instead" ) ]
499+ #[ cfg( feature = "enterprise" ) ]
486500pub type DefaultCollectionPropertyDecryptor = fn (
487501 document_id : Option < String > ,
488502 properties : Dict ,
@@ -493,6 +507,7 @@ pub type DefaultCollectionPropertyDecryptor = fn(
493507 error : & Error ,
494508) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
495509#[ no_mangle]
510+ #[ cfg( feature = "enterprise" ) ]
496511pub extern "C" fn c_default_collection_property_decryptor (
497512 context : * mut :: std:: os:: raw:: c_void ,
498513 document_id : FLString ,
@@ -558,6 +573,7 @@ pub extern "C" fn c_default_collection_property_decryptor(
558573\note The decryption will be skipped (the encrypted data will be kept) when a null result
559574 without an error is returned. If an error is returned, the document will be failed to replicate
560575 with the kCBLErrorCrypto error. */
576+ #[ cfg( feature = "enterprise" ) ]
561577pub type CollectionPropertyDecryptor = fn (
562578 scope : Option < String > ,
563579 collection : Option < String > ,
@@ -570,6 +586,7 @@ pub type CollectionPropertyDecryptor = fn(
570586 error : & Error ,
571587) -> std:: result:: Result < Vec < u8 > , EncryptionError > ;
572588#[ no_mangle]
589+ #[ cfg( feature = "enterprise" ) ]
573590pub extern "C" fn c_collection_property_decryptor (
574591 context : * mut :: std:: os:: raw:: c_void ,
575592 scope : FLString ,
@@ -640,9 +657,13 @@ pub struct ReplicationConfigurationContext {
640657 pub push_filter : Option < ReplicationFilter > , // TODO: deprecated
641658 pub pull_filter : Option < ReplicationFilter > , // TODO: deprecated
642659 pub conflict_resolver : Option < ConflictResolver > , // TODO: deprecated
660+ #[ cfg( feature = "enterprise" ) ]
643661 pub default_collection_property_encryptor : Option < DefaultCollectionPropertyEncryptor > , // TODO: deprecated
662+ #[ cfg( feature = "enterprise" ) ]
644663 pub default_collection_property_decryptor : Option < DefaultCollectionPropertyDecryptor > , // TODO: deprecated
664+ #[ cfg( feature = "enterprise" ) ]
645665 pub collection_property_encryptor : Option < CollectionPropertyEncryptor > ,
666+ #[ cfg( feature = "enterprise" ) ]
646667 pub collection_property_decryptor : Option < CollectionPropertyDecryptor > ,
647668}
648669
@@ -805,18 +826,22 @@ impl Replicator {
805826 . conflict_resolver
806827 . as_ref ( )
807828 . and ( Some ( c_replication_conflict_resolver) ) ,
829+ #[ cfg( feature = "enterprise" ) ]
808830 propertyEncryptor : context
809831 . default_collection_property_encryptor
810832 . as_ref ( )
811833 . and ( Some ( c_default_collection_property_encryptor) ) ,
834+ #[ cfg( feature = "enterprise" ) ]
812835 propertyDecryptor : context
813836 . default_collection_property_decryptor
814837 . as_ref ( )
815838 . and ( Some ( c_default_collection_property_decryptor) ) ,
839+ #[ cfg( feature = "enterprise" ) ]
816840 documentPropertyEncryptor : context
817841 . collection_property_encryptor
818842 . as_ref ( )
819843 . and ( Some ( c_collection_property_encryptor) ) ,
844+ #[ cfg( feature = "enterprise" ) ]
820845 documentPropertyDecryptor : context
821846 . collection_property_decryptor
822847 . as_ref ( )
0 commit comments