Добавлено описание проекта PVideoDl, включая функциональность, стек технологий, архитектуру, инструкции по запуску и API. Обновлён README.md для лучшего понимания проекта.
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
"""Доступ к разделяемым компонентам приложения через app.state.
|
||||
|
||||
Компоненты (Storage, DownloadQueue, EventBus, WorkerPool) создаются в lifespan
|
||||
в main.py и кладутся в app.state. Роуты достают их отсюда через Depends.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from fastapi import Request
|
||||
|
||||
from app.core.events import EventBus
|
||||
from app.core.queue import DownloadQueue
|
||||
from app.core.storage import Storage
|
||||
|
||||
|
||||
def get_storage(request: Request) -> Storage:
|
||||
return request.app.state.storage
|
||||
|
||||
|
||||
def get_queue(request: Request) -> DownloadQueue:
|
||||
return request.app.state.queue
|
||||
|
||||
|
||||
def get_events(request: Request) -> EventBus:
|
||||
return request.app.state.events
|
||||
Reference in New Issue
Block a user