refactor storage minio for k8s

This commit is contained in:
2026-03-26 09:20:23 -03:00
parent e27cb5bcc3
commit c9ba9e4f5f
22 changed files with 961 additions and 18 deletions

View File

@@ -35,10 +35,12 @@ from .presets import BUILTIN_PRESETS, TranscodePreset
from .detect import DETECT_VIEWS # noqa: F401 — discovered by modelgen generic loader
from .ui_state import UI_STATE_VIEWS # noqa: F401 — UI store state types
from .views import ChunkEvent, ChunkOutputFile, PipelineStats, WorkerEvent
from .sources import ChunkInfo, SourceJob, SourceType
# Core domain models - generates Django, Pydantic, TypeScript
DATACLASSES = [MediaAsset, TranscodePreset, TranscodeJob, ChunkJob,
DetectJob, StageCheckpoint, KnownBrand, SourceBrandSighting]
DetectJob, StageCheckpoint, KnownBrand, SourceBrandSighting,
SourceJob, ChunkInfo]
# API request/response models - generates TypeScript only (no Django)
# WorkerStatus from grpc.py is reused here
@@ -52,7 +54,7 @@ API_MODELS = [
]
# Status enums - included in generated code
ENUMS = [AssetStatus, JobStatus, ChunkJobStatus, DetectJobStatus, RunType, BrandSource]
ENUMS = [AssetStatus, JobStatus, ChunkJobStatus, DetectJobStatus, RunType, BrandSource, SourceType]
# View/event models - generates TypeScript for UI consumption
VIEWS = [ChunkEvent, WorkerEvent, PipelineStats, ChunkOutputFile]
@@ -105,6 +107,10 @@ __all__ = [
"WorkerEvent",
"PipelineStats",
"ChunkOutputFile",
# Sources
"SourceType",
"SourceJob",
"ChunkInfo",
# For generator
"DATACLASSES",
"API_MODELS",

View File

@@ -0,0 +1,39 @@
"""
Media source models.
Describes what types of sources the detection pipeline can process.
Only chunk_job (blobs in MinIO) is implemented now — the rest are
extension points with defined shapes.
"""
from dataclasses import dataclass, field
from enum import Enum
class SourceType(str, Enum):
CHUNK_JOB = "chunk_job" # pre-chunked video segments in blob storage
UPLOAD = "upload" # future: user-uploaded file → MinIO → pipeline
DEVICE = "device" # future: local camera/capture card via ffmpeg (no MinIO)
STREAM = "stream" # future: RTMP/HLS URL via ffmpeg (no MinIO)
@dataclass
class ChunkInfo:
"""A single chunk (video segment) stored in blob storage."""
filename: str
key: str # storage key (MinIO object key)
size_bytes: int
@dataclass
class SourceJob:
"""
A group of chunks that belong together (same source video/session).
Listed by the source selector so the user can pick a job,
then drill into its chunks.
"""
job_id: str
source_type: str # SourceType value
chunk_count: int
total_bytes: int = 0