Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 42 additions & 3 deletions nexus/v1/common_email.fbs
Original file line number Diff line number Diff line change
@@ -1,13 +1,52 @@
include "common_file.fbs";

namespace IPC;

// --- 이메일 첨부 파일 전송 (EmailMessage.attachment) ---

// 전송 시작 시 1회 보내는 메타
table EmailFileMeta {
session: string; // 전송 세션 ID (UUID 권장)
name: string; // 파일명 (예: export.ndjson.gz)
size: ulong; // 전체 바이트
mime: string; // 예: "application/gzip"
chunk_size: uint; // 송신자가 사용하는 청크 크기(바이트)
total_chunks: uint; // (size + chunk_size - 1) / chunk_size
sha256: [ubyte]; // 전체 파일 sha256(32바이트)
}

// 실제 데이터 조각
table EmailFileChunk {
session: string; // 세션 ID
index: uint; // 0..total_chunks-1
offset: ulong; // 파일 내 시작 오프셋
data: [ubyte]; // 이 청크의 데이터
}

// 선택: 수신자가 특정 청크 재요청 or ACK
table EmailFileAck {
session: string;
index: uint; // 특정 청크 인덱스
ok: bool; // true=정상 수신, false=재전송 요청
}

// 필요 시 수신자가 특정 청크를 요청
table EmailFileRequest {
session: string;
want_index: uint;
}

union EmailFilePayload { EmailFileMeta, EmailFileChunk, EmailFileAck, EmailFileRequest }

// 메시지 컨테이너
table EmailFileMessage {
payload: EmailFilePayload;
}

table EmailMessage {
from_email: string;
to_email: string;
subject: string;
body: string;
attachment: [FileMessage];
attachment: [EmailFileMessage];
}

root_type EmailMessage;
54 changes: 17 additions & 37 deletions nexus/v1/common_file.fbs
Original file line number Diff line number Diff line change
@@ -1,42 +1,22 @@
namespace IPC;

// 전송 시작 시 1회 보내는 메타
table FileMeta {
session: string; // 전송 세션 ID (UUID 권장)
name: string; // 파일명 (예: export.ndjson.gz)
size: ulong; // 전체 바이트
mime: string; // 예: "application/gzip"
chunk_size: uint; // 송신자가 사용하는 청크 크기(바이트)
total_chunks: uint; // (size + chunk_size - 1) / chunk_size
sha256: [ubyte]; // 전체 파일 sha256(32바이트)
// "{robot_model}/call_save_file" — RBBaseSDK.save_file
// 파일을 1MiB 청크로 나눠 offset 순서대로 하나씩 보낸다 (청크마다 query 1회, 응답 받고 다음 청크).
// CoreSW 는 offset 위치에 data 를 쓰고 청크마다 Response_Save_File 로 답한다.
// offset == 0 : 파일 새로 만들기(기존 내용 덮어씀)
// is_last == true: 마지막 청크 → 파일 닫기/완료 (빈 파일은 data 없이 offset 0, is_last true 한 번)
// ok == false 를 받으면 SDK 는 남은 청크를 보내지 않는다. 전체 크기는 SDK 가 1GB 로 제한.
table Request_Save_File {
path: string;
offset: ulong; // 이 청크의 파일 내 시작 위치 (바이트)
total_size: ulong; // 전체 파일 크기 (바이트)
data: [ubyte]; // 청크 데이터
is_last: bool; // 마지막 청크 여부
}

// 실제 데이터 조각
table FileChunk {
session: string; // 세션 ID
index: uint; // 0..total_chunks-1
offset: ulong; // 파일 내 시작 오프셋
data: [ubyte]; // 이 청크의 데이터
table Response_Save_File {
ok: bool;
// true : 성공, false : 실패
message: string;
// 실패 이유 (성공 시 비워도 됨)
}

// 선택: 수신자가 특정 청크 재요청 or ACK
table FileAck {
session: string;
index: uint; // 특정 청크 인덱스
ok: bool; // true=정상 수신, false=재전송 요청
}

// 필요 시 수신자가 특정 청크를 요청
table FileRequest {
session: string;
want_index: uint;
}

union FilePayload { FileMeta, FileChunk, FileAck, FileRequest }

// 메시지 컨테이너
table FileMessage {
payload: FilePayload;
}

root_type FileMessage;
Loading