Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/storage.py
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | |||||
class CassandraStorage: | class CassandraStorage: | ||||
def __init__(self, hosts, keyspace, objstorage, port=9042, journal_writer=None): | def __init__(self, hosts, keyspace, objstorage, port=9042, journal_writer=None): | ||||
self._cql_runner = CqlRunner(hosts, keyspace, port) | self._cql_runner = CqlRunner(hosts, keyspace, port) | ||||
self.journal_writer = JournalWriter(journal_writer) | self.journal_writer = JournalWriter(journal_writer) | ||||
self.objstorage = ObjStorage(objstorage) | self.objstorage = ObjStorage(objstorage) | ||||
def check_config(self, *, check_write): | def check_config(self, *, check_write: bool) -> bool: | ||||
self._cql_runner.check_read() | self._cql_runner.check_read() | ||||
return True | return True | ||||
def _content_get_from_hash(self, algo, hash_) -> Iterable: | def _content_get_from_hash(self, algo, hash_) -> Iterable: | ||||
"""From the name of a hash algorithm and a value of that hash, | """From the name of a hash algorithm and a value of that hash, | ||||
looks up the "hash -> token" secondary table (content_by_{algo}) | looks up the "hash -> token" secondary table (content_by_{algo}) | ||||
to get tokens. | to get tokens. | ||||
▲ Show 20 Lines • Show All 1,156 Lines • Show Last 20 Lines |