fix(api): synchronize hydraulic playback binary contract
This commit is contained in:
@@ -13,6 +13,8 @@ from app.domain.time import parse_utc_time
|
||||
from .dependencies import get_timescale_connection
|
||||
|
||||
router = APIRouter(prefix="/timeseries/realtime/playback")
|
||||
BINARY_RESPONSE = {200: {"description": "Versioned little-endian Float32 packet",
|
||||
"content": {"application/octet-stream": {"schema": {"type": "string", "format": "binary"}}}}}
|
||||
# Bounded per-process cache, private to the authorized project and database route.
|
||||
_cache: OrderedDict[tuple, tuple[float, PlaybackGeometry]] = OrderedDict()
|
||||
_load_lock = asyncio.Lock()
|
||||
@@ -36,7 +38,8 @@ async def geometry_for_project(ctx: ProjectContext, conn: AsyncConnection) -> Pl
|
||||
return geometry
|
||||
|
||||
|
||||
@router.get("/geometry", summary="读取带版本的水力专题层静态几何")
|
||||
@router.get("/geometry", summary="读取带版本的水力专题层静态几何",
|
||||
response_class=Response, responses=BINARY_RESPONSE)
|
||||
async def playback_geometry(ctx: ProjectContext = Depends(get_project_context),
|
||||
conn: AsyncConnection = Depends(get_project_pg_connection)):
|
||||
try:
|
||||
@@ -47,7 +50,8 @@ async def playback_geometry(ctx: ProjectContext = Depends(get_project_context),
|
||||
headers={"Cache-Control": "private, no-store", "ETag": f'"{geometry.version}"'})
|
||||
|
||||
|
||||
@router.get("/frames", summary="读取索引一致的 Float32 水力时间块")
|
||||
@router.get("/frames", summary="读取索引一致的 Float32 水力时间块",
|
||||
response_class=Response, responses=BINARY_RESPONSE)
|
||||
async def playback_frames(
|
||||
start_time: str,
|
||||
model_version: str = Query(min_length=24, max_length=24),
|
||||
|
||||
Reference in New Issue
Block a user