From 0c3b1de66eecd11ad60112f45ecc56c7085d9530 Mon Sep 17 00:00:00 2001
From: Joscha Schmiedt <joscha@schmiedt.dev>
Date: Wed, 5 Mar 2025 22:19:31 +0100
Subject: [PATCH] Make new API alpha status and fix package problems

---
 .../{v2/main.proto => v2alpha1/entity.proto}  | 28 ++++++++--------
 .../file_transmission.proto}                  | 32 +++++++++----------
 2 files changed, 29 insertions(+), 31 deletions(-)
 rename proto/caosdb/entity/{v2/main.proto => v2alpha1/entity.proto} (97%)
 rename proto/caosdb/file_transmission/{v1/main.proto => v1alpha1/file_transmission.proto} (90%)

diff --git a/proto/caosdb/entity/v2/main.proto b/proto/caosdb/entity/v2alpha1/entity.proto
similarity index 97%
rename from proto/caosdb/entity/v2/main.proto
rename to proto/caosdb/entity/v2alpha1/entity.proto
index 2353401..dedf01a 100644
--- a/proto/caosdb/entity/v2/main.proto
+++ b/proto/caosdb/entity/v2alpha1/entity.proto
@@ -19,12 +19,14 @@
 //
 
 // This is the main file of the caosdb.entity.v1 package.
-syntax                      = "proto3";
-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
+syntax = "proto3";
+package caosdb.entity.v2alpha1;
+
+import "caosdb/file_transmission/v1alpha1/file_transmission.proto"; // for FileTransmissionId
+
+option cc_enable_arenas = true;
+option java_multiple_files = true;
+option java_package = "org.caosdb.api.entity.v2alpha1";
 
 // Data type for references to other entities.
 message ReferenceDataType {
@@ -469,7 +471,7 @@ message EntityRequest {
   Entity entity = 1;
   // The transmission id (if any). Note: upload_ids are only meaningful for
   // File entities.
-  FileTransmissionId upload_id = 2;
+  caosdb.file_transmission.v1alpha1.FileTransmissionId upload_id = 2;
 }
 
 // Wraps an entity and associates it with a transimission id for a file
@@ -479,7 +481,7 @@ message EntityResponse {
   Entity entity = 1;
   // The transmission id (if any). Note: download_ids are only meaningful for
   // File entities.
-  FileTransmissionId download_id = 2;
+  caosdb.file_transmission.v1alpha1.FileTransmissionId download_id = 2;
   // Errors for this entity which occurred during the current transaction. The
   // presence of errors indicates that a transaction was not successful and the
   // errors describe why this is the case.
@@ -836,13 +838,9 @@ enum EntityPermission {
 // Entity Transaction Service
 service EntityTransactionService {
   // Issue multiple mixed requests
-  rpc MultiTransaction(MultiTransactionRequest)
-      returns (MultiTransactionResponse);
+  rpc MultiTransaction(MultiTransactionRequest) returns (MultiTransactionResponse);
   // Request the Entity ACLs
-  rpc MultiRetrieveEntityACL(MultiRetrieveEntityACLRequest)
-      returns (MultiRetrieveEntityACLResponse);
+  rpc MultiRetrieveEntityACL(MultiRetrieveEntityACLRequest) returns (MultiRetrieveEntityACLResponse);
   // Set the Entity ACLs,
-  rpc MultiUpdateEntityACL(MultiUpdateEntityACLRequest)
-      returns (MultiUpdateEntityACLResponse);
+  rpc MultiUpdateEntityACL(MultiUpdateEntityACLRequest) returns (MultiUpdateEntityACLResponse);
 }
-
diff --git a/proto/caosdb/file_transmission/v1/main.proto b/proto/caosdb/file_transmission/v1alpha1/file_transmission.proto
similarity index 90%
rename from proto/caosdb/file_transmission/v1/main.proto
rename to proto/caosdb/file_transmission/v1alpha1/file_transmission.proto
index 4ed21a8..e82dfbc 100644
--- a/proto/caosdb/file_transmission/v1/main.proto
+++ b/proto/caosdb/file_transmission/v1alpha1/file_transmission.proto
@@ -20,11 +20,12 @@
 //
 
 // This is the main file of the caosdb.entity.v1 package.
-syntax                      = "proto3";
-option  java_multiple_files = true;
-option  java_package        = "org.caosdb.api.file_transmission.v1";
-option  cc_enable_arenas    = true;
-package caosdb.file_transmission.v1;
+syntax = "proto3";
+package caosdb.file_transmission.v1alpha1;
+
+option cc_enable_arenas = true;
+option java_multiple_files = true;
+option java_package = "org.caosdb.api.file_transmission.v1";
 
 ///////////////////////////////////////////////////////////////////////////
 // File transmission
@@ -82,24 +83,24 @@ enum TransmissionStatus {
   TRANSMISSION_STATUS_GO_ON = 3;
 }
 
-// TODO: This is very similar to the Hash message in the entity API. We should discuss 
+// 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;
+  CHECKSUM_ALGORITHM_MD5 = 1;
+  CHECKSUM_ALGORITHM_SHA1 = 2;
+  CHECKSUM_ALGORITHM_SHA256 = 3;
+  CHECKSUM_ALGORITHM_SHA512 = 4;
 }
 
 message Checksum {
-  string            checksum           = 1;
+  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. 
+//       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.
@@ -141,8 +142,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;
+  UploadProtocolVersion version = 5;
+  repeated UploadLocation locations = 6;
 }
 
 // Request for a file upload which has been registered previously. Chunks may be
@@ -176,8 +177,7 @@ message FileDownloadResponse {
 service FileTransmissionService {
   // Register a file upload. This needs to be done prior to the actual upload
   // and prior to the transaction request which uses the uploaded files.
-  rpc RegisterFileUpload(RegisterFileUploadRequest)
-      returns (RegisterFileUploadResponse);
+  rpc RegisterFileUpload(RegisterFileUploadRequest) returns (RegisterFileUploadResponse);
   // The actual file upload. The upload has to be registered prior to this rpc.
   rpc FileUpload(stream FileUploadRequest) returns (FileUploadResponse);
   // A file download. The download has to be registered prior this rpc in the
-- 
GitLab