Changeset View
Changeset View
Standalone View
Standalone View
swh/storage/db.py
Show First 20 Lines • Show All 229 Lines • ▼ Show 20 Lines | def mktemp_dir_entry(self, entry_type, cur=None): | ||||
(('directory_entry_%s' % entry_type),)) | (('directory_entry_%s' % entry_type),)) | ||||
@stored_procedure('swh_mktemp_revision') | @stored_procedure('swh_mktemp_revision') | ||||
def mktemp_revision(self, cur=None): pass | def mktemp_revision(self, cur=None): pass | ||||
@stored_procedure('swh_mktemp_release') | @stored_procedure('swh_mktemp_release') | ||||
def mktemp_release(self, cur=None): pass | def mktemp_release(self, cur=None): pass | ||||
@stored_procedure('swh_mktemp_occurrence_history') | |||||
def mktemp_occurrence_history(self, cur=None): pass | |||||
@stored_procedure('swh_mktemp_snapshot_branch') | @stored_procedure('swh_mktemp_snapshot_branch') | ||||
def mktemp_snapshot_branch(self, cur=None): pass | def mktemp_snapshot_branch(self, cur=None): pass | ||||
def register_listener(self, notify_queue, cur=None): | def register_listener(self, notify_queue, cur=None): | ||||
"""Register a listener for NOTIFY queue `notify_queue`""" | """Register a listener for NOTIFY queue `notify_queue`""" | ||||
self._cursor(cur).execute("LISTEN %s" % notify_queue) | self._cursor(cur).execute("LISTEN %s" % notify_queue) | ||||
def listen_notifies(self, timeout): | def listen_notifies(self, timeout): | ||||
Show All 15 Lines | class Db(BaseDb): | ||||
def skipped_content_add_from_temp(self, cur=None): pass | def skipped_content_add_from_temp(self, cur=None): pass | ||||
@stored_procedure('swh_revision_add') | @stored_procedure('swh_revision_add') | ||||
def revision_add_from_temp(self, cur=None): pass | def revision_add_from_temp(self, cur=None): pass | ||||
@stored_procedure('swh_release_add') | @stored_procedure('swh_release_add') | ||||
def release_add_from_temp(self, cur=None): pass | def release_add_from_temp(self, cur=None): pass | ||||
@stored_procedure('swh_occurrence_history_add') | |||||
def occurrence_history_add_from_temp(self, cur=None): pass | |||||
def content_update_from_temp(self, keys_to_update, cur=None): | def content_update_from_temp(self, keys_to_update, cur=None): | ||||
cur = self._cursor(cur) | cur = self._cursor(cur) | ||||
cur.execute("""select swh_content_update(ARRAY[%s] :: text[])""" % | cur.execute("""select swh_content_update(ARRAY[%s] :: text[])""" % | ||||
keys_to_update) | keys_to_update) | ||||
content_get_metadata_keys = [ | content_get_metadata_keys = [ | ||||
'sha1', 'sha1_git', 'sha256', 'blake2s256', 'length', 'status'] | 'sha1', 'sha1_git', 'sha256', 'blake2s256', 'length', 'status'] | ||||
▲ Show 20 Lines • Show All 323 Lines • ▼ Show 20 Lines | def origin_visit_get_latest_snapshot(self, origin_id, | ||||
""" % (', '.join(self.origin_visit_get_cols[:-1]), extra_clause) | """ % (', '.join(self.origin_visit_get_cols[:-1]), extra_clause) | ||||
cur.execute(query, (origin_id,)) | cur.execute(query, (origin_id,)) | ||||
r = cur.fetchone() | r = cur.fetchone() | ||||
if not r: | if not r: | ||||
return None | return None | ||||
return line_to_bytes(r) | return line_to_bytes(r) | ||||
occurrence_cols = ['origin', 'branch', 'target', 'target_type'] | |||||
@staticmethod | @staticmethod | ||||
def mangle_query_key(key, main_table): | def mangle_query_key(key, main_table): | ||||
if key == 'id': | if key == 'id': | ||||
return 't.id' | return 't.id' | ||||
if key == 'parents': | if key == 'parents': | ||||
return ''' | return ''' | ||||
ARRAY( | ARRAY( | ||||
SELECT rh.parent_id::bytea | SELECT rh.parent_id::bytea | ||||
▲ Show 20 Lines • Show All 422 Lines • Show Last 20 Lines |