Skip to content

Commit 3419e0e

Browse files
committed
changed 'custom' to 'pluggable'
1 parent 56ac270 commit 3419e0e

File tree

7 files changed

+29
-29
lines changed

7 files changed

+29
-29
lines changed

splitio/client/config.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
'dataSampling': DEFAULT_DATA_SAMPLING,
5959
'storageWrapper': None,
6060
'storagePrefix': None,
61-
'strageType': None
61+
'storageType': None
6262
}
6363

6464

@@ -81,11 +81,11 @@ def _parse_operation_mode(apikey, config):
8181
return 'redis-consumer'
8282

8383
if 'storageType' in config:
84-
if config.get('storageType').lower() == 'custom':
85-
_LOGGER.debug('Using Custom storage operation mode')
86-
return 'custom'
84+
if config.get('storageType').lower() == 'pluggable':
85+
_LOGGER.debug('Using Pluggable storage operation mode')
86+
return 'pluggable'
8787
_LOGGER.warning('You passed an invalid storageType, acceptable value is '
88-
'`custom`. Defaulting storage to In-Memory mode.')
88+
'`pluggable`. Defaulting storage to In-Memory mode.')
8989

9090
_LOGGER.debug('Using In-Memory operation mode')
9191
return 'inmemory-standalone'
@@ -110,9 +110,9 @@ def _sanitize_impressions_mode(operation_mode, mode, refresh_rate=None):
110110
'one of the following values: `debug`, `none` or `optimized`. '
111111
' Defaulting to `optimized` mode.')
112112

113-
if operation_mode == 'custom' and mode != ImpressionsMode.DEBUG:
113+
if operation_mode == 'pluggable' and mode != ImpressionsMode.DEBUG:
114114
mode = ImpressionsMode.DEBUG
115-
_LOGGER.warning('`custom` storageMode only support `debug` impressionMode, adjusting impressionsMode to `debug`. ')
115+
_LOGGER.warning('`pluggable` storageMode only support `debug` impressionMode, adjusting impressionsMode to `debug`. ')
116116

117117
if mode == ImpressionsMode.DEBUG:
118118
refresh_rate = max(1, refresh_rate) if refresh_rate is not None else 60

splitio/client/factory.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -675,7 +675,7 @@ def get_factory(api_key, **kwargs):
675675
split_factory = _build_localhost_factory(config)
676676
elif config['operationMode'] == 'redis-consumer':
677677
split_factory = _build_redis_factory(api_key, config)
678-
elif config['operationMode'] == 'custom':
678+
elif config['operationMode'] == 'pluggable':
679679
split_factory = _build_pluggable_factory(api_key, config)
680680
else:
681681
split_factory = _build_in_memory_factory(

splitio/client/input_validator.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -529,21 +529,21 @@ def validate_pluggable_adapter(config):
529529
:return: True if no issue found otherwise False
530530
:rtype: bool
531531
"""
532-
if config.get('storageType') != 'CUSTOM':
532+
if config.get('storageType') != 'pluggable':
533533
return True
534534

535535
if config.get('storageWrapper') is None:
536-
_LOGGER.error("Expecting custom storage `wrapper` in options, but no valid wrapper instance was provided.")
536+
_LOGGER.error("Expecting pluggable storage `wrapper` in options, but no valid wrapper instance was provided.")
537537
return False
538538

539539
if config.get('storagePrefix') is not None:
540540
if not isinstance(config.get('storagePrefix'), str):
541-
_LOGGER.error("Custom storage prefix should be string type only")
541+
_LOGGER.error("Pluggable storage prefix should be string type only")
542542
return False
543543

544544
pluggable_adapter = config.get('storageWrapper')
545545
if not isinstance(pluggable_adapter, object):
546-
_LOGGER.error("Custom storage instance is not inherted from object class")
546+
_LOGGER.error("Pluggable storage instance is not inherted from object class")
547547
return False
548548

549549
expected_methods = {'get': 1, 'get_items': 1, 'get_many': 1, 'set': 2, 'push_items': 2,

splitio/models/telemetry.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,13 @@ class StorageType(Enum):
124124
MEMORY = 'memory'
125125
REDIS = 'redis'
126126
LOCALHOST = 'localhost'
127-
CUSTOM = 'custom'
127+
PLUGGABLE = 'pluggable'
128128

129129
class OperationMode(Enum):
130130
"""Storage modes constants"""
131131
MEMORY = 'inmemory'
132132
REDIS = 'redis-consumer'
133-
CUSTOM = 'custom'
133+
PLUGGABLE = 'pluggable'
134134

135135
def get_latency_bucket_index(micros):
136136
"""
@@ -876,7 +876,7 @@ def _get_storage_type(self, op_mode):
876876
elif StorageType.REDIS.value in op_mode:
877877
return StorageType.REDIS.value
878878
else:
879-
return StorageType.CUSTOM.value
879+
return StorageType.PLUGGABLE.value
880880

881881
def _get_refresh_rates(self, config):
882882
"""

tests/client/test_config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def test_parse_operation_mode(self):
1313
assert config._parse_operation_mode('some', {}) == 'inmemory-standalone'
1414
assert config._parse_operation_mode('localhost', {}) == 'localhost-standalone'
1515
assert config._parse_operation_mode('some', {'redisHost': 'x'}) == 'redis-consumer'
16-
assert config._parse_operation_mode('some', {'storageType': 'custom'}) == 'custom'
16+
assert config._parse_operation_mode('some', {'storageType': 'pluggable'}) == 'pluggable'
1717
assert config._parse_operation_mode('some', {'storageType': 'custom2'}) == 'inmemory-standalone'
1818

1919
def test_sanitize_imp_mode(self):
@@ -34,15 +34,15 @@ def test_sanitize_imp_mode(self):
3434
assert mode == ImpressionsMode.OPTIMIZED
3535
assert rate == 200
3636

37-
mode, rate = config._sanitize_impressions_mode('custom', 'ANYTHING', 200)
37+
mode, rate = config._sanitize_impressions_mode('pluggable', 'ANYTHING', 200)
3838
assert mode == ImpressionsMode.DEBUG
3939
assert rate == 200
4040

41-
mode, rate = config._sanitize_impressions_mode('custom', 'NONE', 200)
41+
mode, rate = config._sanitize_impressions_mode('pluggable', 'NONE', 200)
4242
assert mode == ImpressionsMode.DEBUG
4343
assert rate == 200
4444

45-
mode, rate = config._sanitize_impressions_mode('custom', 'OPTIMIZED', 200)
45+
mode, rate = config._sanitize_impressions_mode('pluggable', 'OPTIMIZED', 200)
4646
assert mode == ImpressionsMode.DEBUG
4747
assert rate == 200
4848

tests/client/test_factory.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ def test_pluggable_client_creation(self, mocker):
548548
config = {
549549
'labelsEnabled': False,
550550
'impressionListener': 123,
551-
'storageType': 'custom',
551+
'storageType': 'pluggable',
552552
'storageWrapper': StorageMockAdapter()
553553
}
554554
factory = get_factory('some_api_key', config=config)
@@ -578,7 +578,7 @@ def test_destroy_with_event_pluggable(self, mocker):
578578
config = {
579579
'labelsEnabled': False,
580580
'impressionListener': 123,
581-
'storageType': 'custom',
581+
'storageType': 'pluggable',
582582
'storageWrapper': StorageMockAdapter()
583583
}
584584

tests/client/test_input_validator.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,28 +1240,28 @@ def expire(self, key, value, till):
12401240

12411241
def test_validate_pluggable_adapter(self):
12421242
# missing storageWrapper config parameter
1243-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM'}))
1243+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable'}))
12441244

12451245
# ignore if storage type is not pluggable
12461246
assert(input_validator.validate_pluggable_adapter({'storageType': 'memory'}))
12471247

12481248
# mock adapter is not derived from object class
1249-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'pe': self.mock_adapter0()}))
1249+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'pe': self.mock_adapter0()}))
12501250

12511251
# mock adapter missing many functions
1252-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storageWrapper': self.mock_adapter1()}))
1252+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storageWrapper': self.mock_adapter1()}))
12531253

12541254
# mock adapter missing expire function
1255-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storageWrapper': self.mock_adapter2()}))
1255+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storageWrapper': self.mock_adapter2()}))
12561256

12571257
# mock adapter expire function has incrrect args count
1258-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storageWrapper': self.mock_adapter3()}))
1258+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storageWrapper': self.mock_adapter3()}))
12591259

12601260
# expected mock adapter should pass
1261-
assert(input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storageWrapper': self.mock_adapter4()}))
1261+
assert(input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storageWrapper': self.mock_adapter4()}))
12621262

12631263
# using string type prefix should pass
1264-
assert(input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storagePrefix': 'myprefix', 'storageWrapper': self.mock_adapter4()}))
1264+
assert(input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storagePrefix': 'myprefix', 'storageWrapper': self.mock_adapter4()}))
12651265

12661266
# using non-string type prefix should not pass
1267-
assert(not input_validator.validate_pluggable_adapter({'storageType': 'CUSTOM', 'storagePrefix': 'myprefix', 123: self.mock_adapter4()}))
1267+
assert(not input_validator.validate_pluggable_adapter({'storageType': 'pluggable', 'storagePrefix': 'myprefix', 123: self.mock_adapter4()}))

0 commit comments

Comments
 (0)