syntax = "proto3"; package cuddlyproto; import "auth.proto"; import "common.proto"; import "datanode.proto"; import "directory.proto"; message FileMetadata { int64 size = 1; string owner = 2; string group = 3; int32 permissions = 4; int64 creation_time = 5; int64 modification_time = 6; int64 access_time = 7; map extended_attributes = 8; } // Request to open a file message OpenFileRequest { cuddlyproto.AuthToken auth_token = 1; string file_path = 2; // implement mode // enum Mode { // READ = 0; // WRITE = 1; // READ_WRITE = 2; // } // Mode mode = 3; } // Response after opening a file message OpenFileResponse { repeated BlockWithLocations blocks_with_locations = 1; cuddlyproto.StatusCode status = 2; } message CreateFileRequest { string file_path = 1; // cuddlyproto.AuthToken auth_token = 1; // FileMetadata metadata = 3; } message CreateFileResponse { BlockWithTargets block_with_targets = 1; // cuddlyproto.StatusCode status = 1; } message AddBlockRequest { string path = 1; } message AddBlockResponse { BlockWithTargets block_with_targets = 1; } message AbortBlockWriteRequest { Block block = 1; string path = 2; } // File service with file-related operations service FileService { rpc ReportDatanodes(ReportDatanodesRequest) returns (ReportDatanodesResponse); rpc ListDirectory (ListDirectoryRequest) returns (ListDirectoryResponse); rpc CreateDirectory (CreateDirectoryRequest) returns (CreateDirectoryResponse); rpc open_file(OpenFileRequest) returns (OpenFileResponse); rpc start_file_create(CreateFileRequest) returns (CreateFileResponse); rpc finish_file_create(CreateFileRequest) returns (StatusCode); rpc abort_file_create(CreateFileRequest) returns (StatusCode); rpc add_block(AddBlockRequest) returns (AddBlockResponse); rpc abort_block_write(AbortBlockWriteRequest) returns (StatusCode); }