mirror of
https://github.com/azaion/satellite-provider.git
synced 2026-06-21 16:21:15 +00:00
909f69cb3a
Production code:
- POST /api/satellite/tiles/inventory (XOR body, 5000-cap,
most-recent-per-location_hash select, present/absent shaping).
- Kestrel HttpProtocols.Http1AndHttp2 on every listener (AC-5).
- Migration 015 creates tiles_leaflet_path covering index over
(location_hash, captured_at DESC, updated_at DESC, id DESC)
INCLUDE (file_path, source); drops superseded idx_tiles_location_hash.
- TileRepository.GetByTileCoordinatesAsync rewired to filter by
location_hash (Index Only Scan via tiles_leaflet_path).
- TileRepository.GetTilesByLocationHashesAsync added with Npgsql-
direct ANY($1::uuid[]) binding (Dapper IEnumerable expansion is
incompatible with the array form).
- Uuidv5.LocationHashForTile centralises the UUIDv5(TileNamespace,
"{z}/{x}/{y}") formula — single source of truth for the cross-repo
invariant (gps-denied-onboard parity).
Contracts:
- New: contracts/api/tile-inventory.md v1.0.0.
- Bumped: contracts/data-access/tile-storage.md to v2.0.0 (joint
ownership by AZ-503-foundation + AZ-505: schema + covering index +
GetByTileCoordinatesAsync rewrite).
Tests:
- TileInventoryTests covers AC-1, AC-2 (DB-level), AC-4, AC-6.
- Http2MultiplexingTests covers AC-5 (20 concurrent multiplexed GETs
over h2c via SocketsHttpHandler + AppContext Http2Unencrypted switch).
- LeafletPathIndexOnlyTests covers AC-3 (EXPLAIN (ANALYZE, BUFFERS)
asserts Index Only Scan over tiles_leaflet_path with heap_blocks=0).
Docs:
- architecture.md, system-flows.md, data_model.md, module-layout.md,
glossary.md, modules/api_program.md, modules/dataaccess_tile_repository.md,
components/02_data_access/description.md all updated to reference the
v2.0.0 tile-storage contract + new tile-inventory contract + AC-7.
Reports:
- batch_01_cycle6_report.md, batch_01_cycle6_review.md,
implementation_completeness_cycle6_report.md (PASS),
implementation_report_tile_inventory_cycle6.md.
Task spec moved todo/ -> done/.
Co-authored-by: Cursor <cursoragent@cursor.com>
67 lines
2.7 KiB
C#
67 lines
2.7 KiB
C#
namespace SatelliteProvider.Common.DTO;
|
|
|
|
// AZ-505: bulk-list / inventory request envelope. Either `Tiles` OR
|
|
// `LocationHashes` is populated — never both, never neither. The handler
|
|
// converts every `(z, x, y)` coord into a `location_hash` via UUIDv5 and
|
|
// queries `tiles_leaflet_path` once. Response order matches request order.
|
|
//
|
|
// Max entries per request: see TileInventoryLimits.MaxEntriesPerRequest.
|
|
public sealed class TileInventoryRequest
|
|
{
|
|
public IReadOnlyList<TileCoord>? Tiles { get; set; }
|
|
public IReadOnlyList<Guid>? LocationHashes { get; set; }
|
|
}
|
|
|
|
// AZ-505: Slippy-map tile coordinate triple. Field naming matches the on-wire
|
|
// snake_case used by the existing `GET /tiles/{z}/{x}/{y}` and the AZ-484/AZ-503
|
|
// `tiles` table columns (`tile_zoom`, `tile_x`, `tile_y`).
|
|
public sealed class TileCoord
|
|
{
|
|
public int TileZoom { get; set; }
|
|
public int TileX { get; set; }
|
|
public int TileY { get; set; }
|
|
}
|
|
|
|
// AZ-505: Inventory response. Entries are returned in the SAME ORDER as the
|
|
// matching request input (per AC-1). When Request.Tiles was populated, each
|
|
// entry's `TileZoom`/`TileX`/`TileY` echoes the request entry; when
|
|
// Request.LocationHashes was populated, the coord triple fields are 0 (the
|
|
// caller already knows the hash and can map it back themselves).
|
|
public sealed class TileInventoryResponse
|
|
{
|
|
public IReadOnlyList<TileInventoryEntry> Results { get; set; } = Array.Empty<TileInventoryEntry>();
|
|
}
|
|
|
|
// AZ-505: One entry per request input. `Present` indicates whether a row
|
|
// exists in the `tiles` table for the resolved `LocationHash`. When
|
|
// `Present == false` only `LocationHash` (and the echoed coord triple, if the
|
|
// request used coords) is populated — the rest are null.
|
|
//
|
|
// `EstimatedBytes` is intentionally absent in v1.0.0 — adding the per-row
|
|
// `stat()` cost is deferred until production profiling justifies it (see
|
|
// AZ-505 Outcome bullet 1 + Excluded list).
|
|
public sealed class TileInventoryEntry
|
|
{
|
|
public int TileZoom { get; set; }
|
|
public int TileX { get; set; }
|
|
public int TileY { get; set; }
|
|
public Guid LocationHash { get; set; }
|
|
public bool Present { get; set; }
|
|
|
|
public Guid? Id { get; set; }
|
|
public DateTime? CapturedAt { get; set; }
|
|
public string? Source { get; set; }
|
|
public Guid? FlightId { get; set; }
|
|
public double? ResolutionMPerPx { get; set; }
|
|
}
|
|
|
|
// AZ-505: per-task constants exposed for the request validator + tests.
|
|
// Living under DTO so both the API handler and test assertions can reference
|
|
// the same value without re-deriving it.
|
|
public static class TileInventoryLimits
|
|
{
|
|
// 2x headroom over the AC-4 perf gate of 2500 tiles. Anything larger is
|
|
// rejected with HTTP 400 by the API handler.
|
|
public const int MaxEntriesPerRequest = 5000;
|
|
}
|