@@ -49,6 +49,10 @@ static void httpcb_getBucket(void *ctx, zval *return_value, zval *response)
4949 if (mval && Z_TYPE_P (mval ) == IS_STRING ) {
5050 pcbc_update_property (pcbc_bucket_settings_ce , return_value , ("eviction_policy" ), mval );
5151 }
52+ mval = zend_symtable_str_find (marr , ZEND_STRL ("storageBackend" ));
53+ if (mval && Z_TYPE_P (mval ) == IS_STRING ) {
54+ pcbc_update_property (pcbc_bucket_settings_ce , return_value , ("storage_backend" ), mval );
55+ }
5256 mval = zend_symtable_str_find (marr , ZEND_STRL ("maxTTL" ));
5357 if (mval && Z_TYPE_P (mval ) == IS_LONG ) {
5458 pcbc_update_property (pcbc_bucket_settings_ce , return_value , ("max_ttl" ), mval );
@@ -206,6 +210,10 @@ PHP_METHOD(BucketManager, createBucket)
206210 if (Z_TYPE_P (prop ) == IS_STRING ) {
207211 add_assoc_zval (& payload , "compressionMode" , prop );
208212 }
213+ prop = pcbc_read_property (pcbc_bucket_settings_ce , settings , ("storage_backend" ), 0 , & ret );
214+ if (Z_TYPE_P (prop ) == IS_STRING ) {
215+ add_assoc_zval (& payload , "storageBackend" , prop );
216+ }
209217 prop = pcbc_read_property (pcbc_bucket_settings_ce , settings , ("minimal_durability_level" ), 0 , & ret );
210218 if (Z_TYPE_P (prop ) == IS_LONG ) {
211219 switch (Z_LVAL_P (prop )) {
@@ -457,6 +465,9 @@ zend_function_entry bucket_settings_methods[] = {
457465zend_class_entry * pcbc_eviction_policy_ce ;
458466static const zend_function_entry pcbc_eviction_policy_methods [] = {PHP_FE_END };
459467
468+ zend_class_entry * pcbc_storage_backend_ce ;
469+ static const zend_function_entry pcbc_storage_backend_methods [] = {PHP_FE_END };
470+
460471PHP_MINIT_FUNCTION (BucketManager )
461472{
462473 zend_class_entry ce ;
@@ -476,6 +487,7 @@ PHP_MINIT_FUNCTION(BucketManager)
476487 zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("eviction_policy" ), ZEND_ACC_PRIVATE );
477488 zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("max_ttl" ), ZEND_ACC_PRIVATE );
478489 zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("compression_mode" ), ZEND_ACC_PRIVATE );
490+ zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("storage_backend" ), ZEND_ACC_PRIVATE );
479491 zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("minimal_durability_level" ), ZEND_ACC_PRIVATE );
480492
481493 INIT_NS_CLASS_ENTRY (ce , "Couchbase" , "EvictionPolicy" , pcbc_eviction_policy_methods );
@@ -485,6 +497,11 @@ PHP_MINIT_FUNCTION(BucketManager)
485497 zend_declare_class_constant_stringl (pcbc_eviction_policy_ce , ZEND_STRL ("NO_EVICTION" ), ZEND_STRL ("noEviction" ));
486498 zend_declare_class_constant_stringl (pcbc_eviction_policy_ce , ZEND_STRL ("NOT_RECENTLY_USED" ),
487499 ZEND_STRL ("nruEviction" ));
500+
501+ INIT_NS_CLASS_ENTRY (ce , "Couchbase" , "StorageBackend" , pcbc_storage_backend_methods );
502+ pcbc_storage_backend_ce = zend_register_internal_interface (& ce );
503+ zend_declare_class_constant_stringl (pcbc_storage_backend_ce , ZEND_STRL ("COUCHSTORE" ), ZEND_STRL ("couchstore" ));
504+ zend_declare_class_constant_stringl (pcbc_storage_backend_ce , ZEND_STRL ("MAGMA" ), ZEND_STRL ("magma" ));
488505 return SUCCESS ;
489506}
490507
@@ -642,6 +659,28 @@ PHP_METHOD(BucketSettings, setEvictionPolicy)
642659 RETURN_ZVAL (getThis (), 1 , 0 );
643660}
644661
662+ PHP_METHOD (BucketSettings , storageBackend )
663+ {
664+ if (zend_parse_parameters_none_throw () == FAILURE ) {
665+ RETURN_NULL ();
666+ }
667+
668+ zval * prop , rv ;
669+ prop = pcbc_read_property (pcbc_bucket_settings_ce , getThis (), ("storage_backend" ), 0 , & rv );
670+ ZVAL_COPY (return_value , prop );
671+ }
672+
673+ PHP_METHOD (BucketSettings , setStorageBackend )
674+ {
675+ zend_string * val ;
676+ if (zend_parse_parameters_throw (ZEND_NUM_ARGS (), "S" , & val ) == FAILURE ) {
677+ RETURN_NULL ();
678+ }
679+
680+ pcbc_update_property_str (pcbc_bucket_settings_ce , getThis (), ("storage_backend" ), val );
681+ RETURN_ZVAL (getThis (), 1 , 0 );
682+ }
683+
645684PHP_METHOD (BucketSettings , maxTtl )
646685{
647686 if (zend_parse_parameters_none_throw () == FAILURE ) {
0 commit comments