feat: POST /api/push/dav-bulk — push masivo por disco + 1 commit (segundos vs minutos)

Vía rápida DB→Xandikos para operaciones masivas: genera todos los vCards de agenda desde
DuckDB a un tmpdir, rsync de golpe al working tree de la colección en magnus (excluyendo
.git/.xandikos), UN solo git commit, y 1 PROPFIND para capturar todos los etags en batch.
~0.5s vs ~6min del push HTTP (que hace N PUTs + N PROPFINDs + N commits). El push HTTP
push_all_dav se mantiene como fallback (y para CalDAV). Config DAV_BULK_SSH_HOST/REMOTE_DIR.
22 tests verdes.
This commit is contained in:
2026-06-13 11:11:32 +02:00
parent 27e9be1ab7
commit 058180ea1a
5 changed files with 535 additions and 1 deletions
+16
View File
@@ -25,6 +25,19 @@ DAV_CONTACTS_COLLECTION = "/enmanuel/contacts/addressbook/"
DAV_CALENDAR_HOME = "/enmanuel/calendars/"
PASS_SECRET = "dav/xandikos-enmanuel"
# Vía rápida de push masivo por disco (POST /api/push/dav-bulk): Xandikos sirve
# cada colección desde el working tree de un repo git en el host que la aloja, y
# calcula el ctag desde el HEAD. Escribiendo los .vcf directos al working tree y
# haciendo UN solo commit, Xandikos ve el cambio en el siguiente request (nuevo
# ctag -> DAVx5 lo detecta), evitando los N PUT + N PROPFIND + N commit del push
# HTTP. Solo aplica a la colección CardDAV por defecto (la del addressbook).
#
# - DAV_BULK_SSH_HOST: alias SSH (~/.ssh/config) del host de Xandikos (magnus).
# - DAV_BULK_REMOTE_DIR: working tree de la colección CardDAV por defecto en el
# host. Debe terminar en '/'. Es un repo git que Xandikos sirve.
DAV_BULK_SSH_HOST = "magnus"
DAV_BULK_REMOTE_DIR = "/srv/xandikos/data/enmanuel/contacts/addressbook/"
# Carpetas del vault que mapean a tablas maestras de entidades.
# (carpeta del vault, tipo de frontmatter, tabla destino)
ENTITY_FOLDERS = (
@@ -53,3 +66,6 @@ class Config:
dav_calendar_home: str = DAV_CALENDAR_HOME
pass_secret: str = PASS_SECRET
entity_folders: tuple = field(default=ENTITY_FOLDERS)
# Push masivo por disco (POST /api/push/dav-bulk).
dav_bulk_ssh_host: str = DAV_BULK_SSH_HOST
dav_bulk_remote_dir: str = DAV_BULK_REMOTE_DIR