Claude: File chunking system
This commit is contained in:
committed by
Rune Harlyk
parent
725d62747d
commit
f440fa3973
+113
-13
@@ -11,28 +11,112 @@ message KnownNetworkItem { string ssid = 1; string password = 2; bool static_ip
|
||||
|
||||
// ----- FILESYSTEM -----
|
||||
|
||||
message File { string name = 10; } // Add permissions?
|
||||
message File {
|
||||
string name = 10;
|
||||
uint32 size = 20;
|
||||
}
|
||||
|
||||
message Directory {
|
||||
string name = 10;
|
||||
repeated File files = 20;
|
||||
repeated Directory directories = 30;
|
||||
}
|
||||
enum FileRequestOptions {
|
||||
DELETE = 0;
|
||||
EDIT = 1;
|
||||
MKDIR = 2;
|
||||
GET = 3;
|
||||
POST = 4;
|
||||
|
||||
START_UPLOAD = 10;
|
||||
// Delete a file or directory
|
||||
message FSDeleteRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message FSDelete { string path = 1; }
|
||||
message FSDeleteResponse {
|
||||
bool success = 1;
|
||||
string error = 2;
|
||||
}
|
||||
|
||||
message FilesystemRequest {
|
||||
oneof type {
|
||||
|
||||
}
|
||||
// Create directory
|
||||
message FSMkdirRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message FSMkdirResponse {
|
||||
bool success = 1;
|
||||
string error = 2;
|
||||
}
|
||||
|
||||
// List files/directories
|
||||
message FSListRequest {
|
||||
string path = 1;
|
||||
}
|
||||
|
||||
message FSListResponse {
|
||||
bool success = 1;
|
||||
string error = 2;
|
||||
repeated File files = 3;
|
||||
repeated Directory directories = 4;
|
||||
}
|
||||
|
||||
// Download from ESP (ESP -> Client)
|
||||
message FSDownloadStartRequest {
|
||||
string path = 1; // File path on ESP to download
|
||||
}
|
||||
|
||||
message FSDownloadStartResponse {
|
||||
bool success = 1;
|
||||
string error = 2;
|
||||
uint32 file_size = 3; // Total file size in bytes
|
||||
uint32 chunk_size = 4; // Size of each chunk (max 1024)
|
||||
uint32 total_chunks = 5; // Total number of chunks
|
||||
string transfer_id = 6; // Unique ID for this transfer
|
||||
}
|
||||
|
||||
message FSDownloadChunkRequest {
|
||||
string transfer_id = 1;
|
||||
uint32 chunk_index = 2; // Which chunk to request (0-based)
|
||||
}
|
||||
|
||||
message FSDownloadChunkResponse {
|
||||
string transfer_id = 1;
|
||||
uint32 chunk_index = 2;
|
||||
bytes data = 3; // Chunk data (max 1024 bytes)
|
||||
bool is_last = 4; // True if this is the last chunk
|
||||
string error = 5;
|
||||
}
|
||||
|
||||
// Upload to ESP (Client -> ESP)
|
||||
message FSUploadStartRequest {
|
||||
string path = 1; // Destination path on ESP
|
||||
uint32 file_size = 2; // Total file size in bytes
|
||||
uint32 chunk_size = 3; // Size of each chunk (max 1024)
|
||||
}
|
||||
|
||||
message FSUploadStartResponse {
|
||||
bool success = 1;
|
||||
string error = 2;
|
||||
string transfer_id = 3; // Unique ID for this transfer
|
||||
uint32 max_chunk_size = 4; // Server's max chunk size (1024)
|
||||
}
|
||||
|
||||
message FSUploadChunkRequest {
|
||||
string transfer_id = 1;
|
||||
uint32 chunk_index = 2; // Which chunk this is (0-based)
|
||||
bytes data = 3; // Chunk data (max 1024 bytes)
|
||||
bool is_last = 4; // True if this is the last chunk
|
||||
}
|
||||
|
||||
message FSUploadChunkResponse {
|
||||
string transfer_id = 1;
|
||||
uint32 chunk_index = 2;
|
||||
bool success = 3;
|
||||
string error = 4;
|
||||
bool transfer_complete = 5; // True when all chunks received
|
||||
}
|
||||
|
||||
// Cancel transfer
|
||||
message FSCancelTransferRequest {
|
||||
string transfer_id = 1;
|
||||
}
|
||||
|
||||
message FSCancelTransferResponse {
|
||||
bool success = 1;
|
||||
}
|
||||
|
||||
// ----- FILESYSTEM -----
|
||||
@@ -83,6 +167,14 @@ message CorrelationRequest {
|
||||
I2CScanDataRequest i2c_scan_data_request = 20;
|
||||
IMUCalibrateExecute imu_calibrate_execute = 30;
|
||||
SystemInformationRequest system_information_request = 40;
|
||||
FSDeleteRequest fs_delete_request = 50;
|
||||
FSMkdirRequest fs_mkdir_request = 60;
|
||||
FSListRequest fs_list_request = 70;
|
||||
FSDownloadStartRequest fs_download_start_request = 80;
|
||||
FSDownloadChunkRequest fs_download_chunk_request = 90;
|
||||
FSUploadStartRequest fs_upload_start_request = 100;
|
||||
FSUploadChunkRequest fs_upload_chunk_request = 110;
|
||||
FSCancelTransferRequest fs_cancel_transfer_request = 120;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +186,14 @@ message CorrelationResponse {
|
||||
I2CScanData i2c_scan_data = 20;
|
||||
IMUCalibrateData imu_calibrate_data = 30;
|
||||
SystemInformationResponse system_information_response = 40;
|
||||
FSDeleteResponse fs_delete_response = 50;
|
||||
FSMkdirResponse fs_mkdir_response = 60;
|
||||
FSListResponse fs_list_response = 70;
|
||||
FSDownloadStartResponse fs_download_start_response = 80;
|
||||
FSDownloadChunkResponse fs_download_chunk_response = 90;
|
||||
FSUploadStartResponse fs_upload_start_response = 100;
|
||||
FSUploadChunkResponse fs_upload_chunk_response = 110;
|
||||
FSCancelTransferResponse fs_cancel_transfer_response = 120;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user