forked from mtusi2026/mtusi2026lab2
61 lines
1.2 KiB
Python
61 lines
1.2 KiB
Python
from collections.abc import AsyncIterator
|
|
from dataclasses import dataclass
|
|
from datetime import timedelta
|
|
from uuid import UUID
|
|
|
|
from messenger.attachments.domain.jobs import Job
|
|
from messenger.shared.application.commands import Command
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class UploadAttachment(Command):
|
|
owner_id: UUID
|
|
chat_id: UUID
|
|
filename: str | None
|
|
content_type: str | None
|
|
body: AsyncIterator[bytes]
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class SweepAbandonedUploads(Command):
|
|
grace: timedelta
|
|
limit: int
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class ProcessJob(Command):
|
|
job: Job
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class PublishOutbox(Command):
|
|
limit: int
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class RecoverExpiredLeases(Command):
|
|
limit: int
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class CleanStaging(Command):
|
|
limit: int
|
|
retention: timedelta
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class ReplayAttachment(Command):
|
|
attachment_id: UUID
|
|
operator: str
|
|
|
|
|
|
@dataclass(frozen=True, slots=True)
|
|
class ReconcileStorage(Command):
|
|
apply: bool
|
|
grace: timedelta
|
|
skew: timedelta
|
|
deep: bool = False
|
|
page_size: int = 1000
|
|
deep_concurrency: int = 8
|
|
samples: int = 20
|