Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/cassandra/schema.py
Show First 20 Lines • Show All 186 Lines • ▼ Show 20 Lines | CREATE TABLE IF NOT EXISTS object_count ( | ||||
partition_key smallint, -- Constant, must always be 0 | partition_key smallint, -- Constant, must always be 0 | ||||
object_type ascii, | object_type ascii, | ||||
count counter, | count counter, | ||||
PRIMARY KEY ((partition_key), object_type) | PRIMARY KEY ((partition_key), object_type) | ||||
); | ); | ||||
'''.split('\n\n') | '''.split('\n\n') | ||||
CONTENT_INDEX_TEMPLATE = ''' | CONTENT_INDEX_TEMPLATE = ''' | ||||
-- Secondary table, used for looking up "content" from a single hash | |||||
CREATE TABLE IF NOT EXISTS content_by_{main_algo} ( | CREATE TABLE IF NOT EXISTS content_by_{main_algo} ( | ||||
sha1 blob, | {main_algo} blob, | ||||
sha1_git blob, | target_token bigint, -- value of token(pk) on the "primary" table | ||||
sha256 blob, | PRIMARY KEY (({main_algo}), target_token) | ||||
blake2s256 blob, | |||||
PRIMARY KEY (({main_algo}), {other_algos}) | |||||
); | ); | ||||
CREATE TABLE IF NOT EXISTS skipped_content_by_{main_algo} ( | CREATE TABLE IF NOT EXISTS skipped_content_by_{main_algo} ( | ||||
sha1 blob, | sha1 blob, | ||||
sha1_git blob, | sha1_git blob, | ||||
sha256 blob, | sha256 blob, | ||||
blake2s256 blob, | blake2s256 blob, | ||||
PRIMARY KEY (({main_algo}), {other_algos}) | PRIMARY KEY (({main_algo}), {other_algos}) | ||||
Show All 18 Lines |