61 lines
1.5 KiB
Protocol Buffer
61 lines
1.5 KiB
Protocol Buffer
edition = "2023";
|
|
|
|
package tstor.server;
|
|
|
|
import "google/protobuf/go_features.proto";
|
|
option features.(pb.go).api_level = API_OPAQUE;
|
|
|
|
option go_package = "git.kmsign.ru/royalcat/tstor/server/src/delivery/grpc/proto";
|
|
|
|
// import "google/api/annotations.proto";
|
|
// import "buf/validate/validate.proto";
|
|
|
|
// Main TStor service
|
|
service TStorService {
|
|
// File system operations
|
|
rpc ListFiles(ListFilesRequest) returns (ListFilesResponse) {}
|
|
|
|
rpc GetFileInfo(GetFileInfoRequest) returns (GetFileInfoResponse) {}
|
|
|
|
// File upload operation
|
|
rpc UploadFile(stream UploadFileRequest) returns (UploadFileResponse) {}
|
|
|
|
// Add more core service methods as needed
|
|
}
|
|
|
|
// Request to list files in a directory
|
|
message ListFilesRequest { string path = 1; }
|
|
|
|
// Response containing files in a directory
|
|
message ListFilesResponse { repeated FileInfo files = 1; }
|
|
|
|
// Request to get information about a specific file
|
|
message GetFileInfoRequest { string path = 1; }
|
|
|
|
message GetFileInfoResponse { FileInfo file = 1; }
|
|
|
|
// File upload request with streaming support
|
|
message UploadFileRequest {
|
|
// Metadata is sent in the first chunk
|
|
message Metadata { string path = 1; }
|
|
|
|
oneof data {
|
|
Metadata metadata = 1;
|
|
bytes chunk = 2;
|
|
}
|
|
}
|
|
|
|
// Response for file upload operation
|
|
message UploadFileResponse {
|
|
bool success = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
// File information structure
|
|
message FileInfo {
|
|
string name = 1;
|
|
string path = 2;
|
|
int64 size = 3;
|
|
bool is_directory = 4;
|
|
int64 modified_time = 5;
|
|
}
|