Optimize database status information #125

Open
opened 2025-11-14 10:32:45 +00:00 by fkobi · 0 comments
Owner

As of right now we store the internal status as 13 char string:

class Repository(db.Model):
"""Repository database class"""
url: str = db.Column(db.String, primary_key=True)
hash: str = db.Column(db.String(40))
status: str = db.Column(db.String(13), default="initialising")

This information should be stored as an int and accessed using enum.
It would simplify the code and allow to store 4 states in just 2 bits.

As of right now we store the internal status as 13 char string: https://git.fsfe.org/reuse/api/src/commit/ababadb07ee12c86d3edbcfb76cbbea39257f2fa/reuse_api/models.py#L18-L23 This information should be stored as an int and accessed using enum. It would simplify the code and allow to store 4 states in just 2 bits.
fkobi added this to the 2.0 -- A thought-out backend redesign milestone 2025-11-14 10:32:45 +00:00
fkobi added the
component
database
prio
low
labels 2025-11-14 10:32:45 +00:00
fkobi self-assigned this 2025-11-14 10:32:45 +00:00
fkobi added the enhancement label 2025-12-17 11:17:00 +00:00
Sign in to join this conversation.