add filestore content addressible store draft
Some checks failed
CodeQL / Analyze (python) (push) Has been cancelled
Build Debian package / build (push) Has been cancelled
Build Docker image / buildx (push) Has been cancelled
Deploy static content to Pages / deploy (push) Has been cancelled
Build Homebrew package / build (push) Has been cancelled
Build GitHub Pages website / build (push) Has been cancelled
Run linters / lint (push) Has been cancelled
Build Pip package / build (push) Has been cancelled
Run tests / python_tests (ubuntu-22.04, 3.11) (push) Has been cancelled
Run tests / docker_tests (push) Has been cancelled
Build GitHub Pages website / deploy (push) Has been cancelled

This commit is contained in:
Nick Sweeting 2024-12-04 02:14:44 -08:00
parent dc0f1b0efc
commit d192eb5c48
No known key found for this signature in database
6 changed files with 556 additions and 349 deletions

View file

@ -213,6 +213,10 @@ DATABASES = {
"NAME": CONSTANTS.QUEUE_DATABASE_FILE,
**SQLITE_CONNECTION_OPTIONS,
},
# "filestore": {
# "NAME": CONSTANTS.FILESTORE_DATABASE_FILE,
# **SQLITE_CONNECTION_OPTIONS,
# },
# 'cache': {
# 'NAME': CACHE_DB_PATH,
# **SQLITE_CONNECTION_OPTIONS,
@ -266,15 +270,16 @@ class HueyDBRouter:
"""
route_app_labels = {"huey_monitor", "django_huey", "djhuey"}
db_name = "queue"
def db_for_read(self, model, **hints):
if model._meta.app_label in self.route_app_labels:
return "queue"
return self.db_name
return 'default'
def db_for_write(self, model, **hints):
if model._meta.app_label in self.route_app_labels:
return "queue"
return self.db_name
return 'default'
def allow_relation(self, obj1, obj2, **hints):
@ -284,9 +289,39 @@ class HueyDBRouter:
def allow_migrate(self, db, app_label, model_name=None, **hints):
if app_label in self.route_app_labels:
return db == "queue"
return db == self.db_name
return db == "default"
# class FilestoreDBRouter:
# """
# A router to store all the File models in the filestore.sqlite3 database.
# This data just mirrors what is in the file system, so we want to keep it in a separate database
# from the main index database to avoid contention.
# """
# route_app_labels = {"filestore"}
# db_name = "filestore"
# def db_for_read(self, model, **hints):
# if model._meta.app_label in self.route_app_labels:
# return self.db_name
# return 'default'
# def db_for_write(self, model, **hints):
# if model._meta.app_label in self.route_app_labels:
# return self.db_name
# return 'default'
# def allow_relation(self, obj1, obj2, **hints):
# if obj1._meta.app_label in self.route_app_labels or obj2._meta.app_label in self.route_app_labels:
# return obj1._meta.app_label == obj2._meta.app_label
# return None
# def allow_migrate(self, db, app_label, model_name=None, **hints):
# if app_label in self.route_app_labels:
# return db == self.db_name
# return db == "default"
DATABASE_ROUTERS = ['core.settings.HueyDBRouter']
CACHES = {
@ -313,6 +348,13 @@ STORAGES = {
"location": ARCHIVE_DIR,
},
},
# "snapshots": {
# "BACKEND": "django.core.files.storage.FileSystemStorage",
# "OPTIONS": {
# "base_url": "/snapshots/",
# "location": CONSTANTS.SNAPSHOTS_DIR,
# },
# },
# "personas": {
# "BACKEND": "django.core.files.storage.FileSystemStorage",
# "OPTIONS": {