diff --git a/proto/caosdb/entity/v2/main.proto b/proto/caosdb/entity/v2/main.proto index 3bdaeeea07fefc8536a4a113376373c0de7b7fea..23534012947ef00a5ab677c669c31888c3bde4ac 100644 --- a/proto/caosdb/entity/v2/main.proto +++ b/proto/caosdb/entity/v2/main.proto @@ -24,6 +24,7 @@ option java_multiple_files = true; option java_package = "org.caosdb.api.entity.v2"; option cc_enable_arenas = true; package caosdb.entity.v2; +import "caosdb/file_transmission/v1/main.proto"; // for FileTransmissionId // Data type for references to other entities. message ReferenceDataType { diff --git a/proto/caosdb/file_transmission/v1/main.proto b/proto/caosdb/file_transmission/v1/main.proto index 130d9996425e180ba789792b8aa0b012f805be20..c46b685ebe398e8cad557cd004af155ea6b7d712 100644 --- a/proto/caosdb/file_transmission/v1/main.proto +++ b/proto/caosdb/file_transmission/v1/main.proto @@ -82,8 +82,55 @@ enum TransmissionStatus { TRANSMISSION_STATUS_GO_ON = 3; } -// Register a file upload. -message RegisterFileUploadRequest {} +// TODO: This is very similar to the Hash message in the entity API. We should discuss +// if and how they can be merged. +enum ChecksumAlgorithm { + CHECKSUM_ALGORITHM_UNSPECIFIED = 0; + CHECKSUM_ALGORITHM_MD5 = 1; + CHECKSUM_ALGORITHM_SHA1 = 2; + CHECKSUM_ALGORITHM_SHA256 = 3; + CHECKSUM_ALGORITHM_SHA512 = 4; +} + +message Checksum { + string checksum = 1; + ChecksumAlgorithm checksum_algorithm = 2; +} + +// Information about a file which is to be uploaded. +// TODO: This is very similar to the FileDescriptor message in the entity API with the +// difference that it has no relation to an entity and is purely filesystem-oriented. +// Maybe we should re-use FileInformation s part of the entity API? +message FileInformation { + // The local filename is the filename, which is used on the client. + string local_filename = 1; + // The target filename is the filename which will be used on the server. + string target_filename = 2; + // Size of the file in bytes. + int size_bytes = 3; + // Checksum of the file according to the checksum algorithm. + Checksum checksum = 4; +} + +// Register a file upload for a list of files. The server will respond with a +// registration id and URLs to which the files can be uploaded. +message RegisterFileUploadRequest { + repeated FileInformation = 1; +} + +// The URL to which a file should be uploaded using the given LinkAhead +// UploadProtocolVersion. +message UploadLocation { + string url = 1; +} + +// The version of the LinkAhead upload protocol. This is currently identical to +// the TUS protocol version. +message UploadProtocolVersion { + int major = 1; + int minor = 2; + int patch = 3; +} // Response of the file server upon an upload registration request. message RegisterFileUploadResponse { @@ -94,6 +141,8 @@ message RegisterFileUploadResponse { string registration_id = 2; // The server's transmission settings for the upload. FileTransmissionSettings upload_settings = 4; + UploadProtocolVersion version = 5; + repeated UploadLocation locations = 6; } // Request for a file upload which has been registered previously. Chunks may be