feat(work): add task-scoped attachment intake and durable file delivery

This commit is contained in:
ex_tianzy
2026-11-10 14:19:50 +08:00
parent ce64167627
commit 79c15ee7ce
16 changed files with 680 additions and 12 deletions
+11
View File
@@ -40,6 +40,12 @@ class Settings(BaseSettings):
max_devices: int = 1000
max_connections: int = 1000
max_result: int = 16000
work_files_enabled: bool = False
work_file_max_bytes: int = 10*1024*1024
work_file_batch_limit: int = 20
work_file_retention: int = 86400
work_file_owner_quota_bytes: int = 512*1024*1024
work_file_global_quota_bytes: int = 2*1024*1024*1024
allow_insecure_local: bool = False
enrollment_signer_url: str = ""
credential_mode: str = "legacy"
@@ -50,6 +56,11 @@ class Settings(BaseSettings):
@model_validator(mode="after")
def validate_runtime(self):
if not 1024<=self.work_file_max_bytes<=100*1024*1024 or not 1<=self.work_file_batch_limit<=50 or not 300<=self.work_file_retention<=7*86400:
raise ValueError('invalid work file deployment limits')
if self.work_files_enabled and self.credential_mode!='broker':raise ValueError('work files require broker mode')
if not self.work_file_max_bytes<=self.work_file_owner_quota_bytes<=self.work_file_global_quota_bytes:
raise ValueError('invalid work file storage quotas')
if not 30 <= self.task_tracking_timeout <= 3600:
raise ValueError("task tracking timeout must be 30-3600 seconds")
if self.credential_mode not in {"legacy", "broker"}: