Constructor. :param dict[str, any] config: configuration following the following format: { 'basename': b'test', 'type': 'cassandra', 'cassandra': { 'seeds': ['127.0.0.1'],
(self, config, name=None, buffer_size=None)
| 710 | DEFAULT_BUFFER_SIZE = 5000 |
| 711 | |
| 712 | def __init__(self, config, name=None, buffer_size=None): |
| 713 | """ |
| 714 | Constructor. |
| 715 | |
| 716 | :param dict[str, any] config: configuration following the following format: |
| 717 | { |
| 718 | 'basename': b'test', |
| 719 | 'type': 'cassandra', |
| 720 | 'cassandra': { |
| 721 | 'seeds': ['127.0.0.1'], |
| 722 | 'keyspace': 'lsh_test', |
| 723 | 'replication': { |
| 724 | 'class': 'SimpleStrategy', |
| 725 | 'replication_factor': '1' |
| 726 | }, |
| 727 | 'drop_keyspace': True, |
| 728 | 'drop_tables': True, |
| 729 | 'shared_buffer': False, |
| 730 | } |
| 731 | } |
| 732 | :param bytes name: the name |
| 733 | :param int buffer_size: the buffer size |
| 734 | """ |
| 735 | self._config = config |
| 736 | if buffer_size is None: |
| 737 | buffer_size = CassandraStorage.DEFAULT_BUFFER_SIZE |
| 738 | cassandra_param = self._parse_config(self._config['cassandra']) |
| 739 | self._name = name if name else _random_name(11).decode('utf-8') |
| 740 | self._buffer_size = buffer_size |
| 741 | self._client = CassandraClient(cassandra_param, name, self._buffer_size) |
| 742 | |
| 743 | @staticmethod |
| 744 | def _parse_config(config): |
no test coverage detected