-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Summary
The current BulkDataStore uses a flat vector<string> for categories and a single global max_upload_bytes limit. The original plan for #210 included a BulkDataCategoryConfig struct with richer per-category configuration (access modes, per-category size limits, source/upload path templates, human-readable names). This was intentionally deferred to keep the initial PR scoped, but should be implemented as a follow-up.
Proposed solution
1. Per-Category Config Struct
Replace vector<string> categories with a BulkDataCategoryConfig struct:
struct BulkDataCategoryConfig {
std::string id; // Short ID (used in URLs): "calibration", "firmware"
std::string name; // Human-readable display name: "Calibration Data"
std::string access; // "read-only", "write-only", "read-write" (default: "read-write")
size_t max_file_size{0}; // Per-category max upload size (0 = use global limit)
std::string source_path; // Template for pre-existing files: "/data/{entity_id}/cal/"
std::string upload_path; // Template for uploads: "/uploads/{entity_id}/{category}/"
};2. Behavior Changes
- Access mode enforcement:
handle_uploadrejects uploads toread-onlycategories (400).handle_deleterejects deletes onread-onlycategories.write-onlycategories reject list/download. - Per-category size limits:
max_file_sizeper category overrides the globalmax_upload_byteswhen set. - Source path mapping: Categories with
source_pathexpose pre-existing files on disk (not uploaded via API). Useful for calibration data managed by external tooling. - Upload path templates: Categories with
upload_pathstore uploads in a custom location instead of the default{storage_dir}/{entity_id}/{category}/layout. - Human-readable names: Expose
namefield in theGET /bulk-datacategories list response.
3. Configuration (gateway_params.yaml)
bulk_data:
storage_dir: "/tmp/ros2_medkit_bulkdata"
max_upload_size: "50MB"
categories:
- id: calibration
name: "Calibration Data"
access: read-write
max_file_size: "10MB"
- id: firmware
name: "Firmware Images"
access: read-write
max_file_size: "100MB"
- id: logs
name: "System Logs"
access: read-only
source_path: "/var/log/ros2/{entity_id}/"4. API Response Change
GET /api/v1/{entity-path}/bulk-data returns objects instead of strings:
{
"items": [
{"id": "rosbags", "name": "Rosbag Recordings", "access": "read-only"},
{"id": "calibration", "name": "Calibration Data", "access": "read-write"},
{"id": "firmware", "name": "Firmware Images", "access": "read-write"}
]
}Additional context
Related: #210 (Bulk Data Upload & Delete)
Files to Modify
include/ros2_medkit_gateway/bulk_data_store.hpp— AddBulkDataCategoryConfigstruct, update constructorsrc/bulk_data_store.cpp— Per-category validation, path resolutionsrc/http/handlers/bulkdata_handlers.cpp— Access mode checks in upload/delete/downloadsrc/gateway_node.cpp— Parse new YAML config formatconfig/gateway_params.yaml— Add example configdocs/api/rest.rst— Update categories response schemadocs/configuration.rst— Document new config options- Unit tests for access mode enforcement and per-category limits
Acceptance Criteria
-
BulkDataCategoryConfigstruct with all fields - Access mode enforced on upload, delete, and download
- Per-category
max_file_sizeoverrides global limit -
source_pathmapping for pre-existing files - Unit tests for each access mode
- Integration test for config-driven category setup
- Docs updated
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request