Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, address, gw_namespace=None, compression="snappy"):
"""
Create a Redis Datastore.
Args:
address (str) : address of Redis DB
gw_namespace (str) : gw namespace
compression (str) : compression type to use. Must be one of 'snappy', 'lz4', or 'none'.
"""
if compression not in RedisDs.__compression_opts:
raise RuntimeError("`compression` must be one of {}".format(RedisDs.__compression_opts))
if gw_namespace:
j_redis_opts = config.MODULE__redis_config.RedisOptions(gw_namespace)
else:
j_redis_opts = config.MODULE__redis_config.RedisOptions()
j_redis_opts.setAddress(address)
j_compression = RedisDs.__compression_to_j_enum[compression]()
j_redis_opts.setCompression(j_compression)
j_ds = config.MODULE__core_store.DataStoreFactory.createDataStore(j_redis_opts)
super().__init__(config.GATEWAY, j_ds)
def __init__(self, address, gw_namespace=None, compression="snappy"):
"""
Create a Redis Datastore.
Args:
address (str) : address of Redis DB
gw_namespace (str) : gw namespace
compression (str) : compression type to use. Must be one of 'snappy', 'lz4', or 'none'.
"""
if compression not in RedisDs.__compression_opts:
raise RuntimeError("`compression` must be one of {}".format(RedisDs.__compression_opts))
if gw_namespace:
j_redis_opts = config.MODULE__redis_config.RedisOptions(gw_namespace)
else:
j_redis_opts = config.MODULE__redis_config.RedisOptions()
j_redis_opts.setAddress(address)
j_compression = RedisDs.__compression_to_j_enum[compression]()
j_redis_opts.setCompression(j_compression)
j_ds = config.MODULE__core_store.DataStoreFactory.createDataStore(j_redis_opts)
super().__init__(config.GATEWAY, j_ds)