@@ -49,6 +49,10 @@ static void httpcb_getBucket(void *ctx, zval *return_value, zval *response)
49
49
if (mval && Z_TYPE_P (mval ) == IS_STRING ) {
50
50
pcbc_update_property (pcbc_bucket_settings_ce , return_value , ("eviction_policy" ), mval );
51
51
}
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
+ }
52
56
mval = zend_symtable_str_find (marr , ZEND_STRL ("maxTTL" ));
53
57
if (mval && Z_TYPE_P (mval ) == IS_LONG ) {
54
58
pcbc_update_property (pcbc_bucket_settings_ce , return_value , ("max_ttl" ), mval );
@@ -206,6 +210,10 @@ PHP_METHOD(BucketManager, createBucket)
206
210
if (Z_TYPE_P (prop ) == IS_STRING ) {
207
211
add_assoc_zval (& payload , "compressionMode" , prop );
208
212
}
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
+ }
209
217
prop = pcbc_read_property (pcbc_bucket_settings_ce , settings , ("minimal_durability_level" ), 0 , & ret );
210
218
if (Z_TYPE_P (prop ) == IS_LONG ) {
211
219
switch (Z_LVAL_P (prop )) {
@@ -457,6 +465,9 @@ zend_function_entry bucket_settings_methods[] = {
457
465
zend_class_entry * pcbc_eviction_policy_ce ;
458
466
static const zend_function_entry pcbc_eviction_policy_methods [] = {PHP_FE_END };
459
467
468
+ zend_class_entry * pcbc_storage_backend_ce ;
469
+ static const zend_function_entry pcbc_storage_backend_methods [] = {PHP_FE_END };
470
+
460
471
PHP_MINIT_FUNCTION (BucketManager )
461
472
{
462
473
zend_class_entry ce ;
@@ -476,6 +487,7 @@ PHP_MINIT_FUNCTION(BucketManager)
476
487
zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("eviction_policy" ), ZEND_ACC_PRIVATE );
477
488
zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("max_ttl" ), ZEND_ACC_PRIVATE );
478
489
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 );
479
491
zend_declare_property_null (pcbc_bucket_settings_ce , ZEND_STRL ("minimal_durability_level" ), ZEND_ACC_PRIVATE );
480
492
481
493
INIT_NS_CLASS_ENTRY (ce , "Couchbase" , "EvictionPolicy" , pcbc_eviction_policy_methods );
@@ -485,6 +497,11 @@ PHP_MINIT_FUNCTION(BucketManager)
485
497
zend_declare_class_constant_stringl (pcbc_eviction_policy_ce , ZEND_STRL ("NO_EVICTION" ), ZEND_STRL ("noEviction" ));
486
498
zend_declare_class_constant_stringl (pcbc_eviction_policy_ce , ZEND_STRL ("NOT_RECENTLY_USED" ),
487
499
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" ));
488
505
return SUCCESS ;
489
506
}
490
507
@@ -642,6 +659,28 @@ PHP_METHOD(BucketSettings, setEvictionPolicy)
642
659
RETURN_ZVAL (getThis (), 1 , 0 );
643
660
}
644
661
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
+
645
684
PHP_METHOD (BucketSettings , maxTtl )
646
685
{
647
686
if (zend_parse_parameters_none_throw () == FAILURE ) {
0 commit comments