Skip to content
Snippets Groups Projects
Commit 36d7956b authored by Florian Spreckelsen's avatar Florian Spreckelsen
Browse files

Merge branch 'f-insert' into 'dev'

ENH: Allow insertion and deletion of single entities

See merge request !1
parents bff5455a 65f76cd6
No related branches found
No related tags found
1 merge request!1ENH: Allow insertion and deletion of single entities
Pipeline #11288 passed
ALL:
@echo "THIS IS ONLY FOR DEVELOPMENT. DON'T USE IT"
formatting:
clang-format -i $$(find proto/ -type f -iname "*.proto")
......@@ -22,9 +22,11 @@
syntax = "proto3";
option java_multiple_files = true;
option java_package = "org.caosdb.api.entity.v1alpha1";
option cc_enable_arenas = true;
package caosdb.entity.v1alpha1;
// Entity messages codes.
// Messages codes. Entities and transactions contain errors, warnings and info
// messages which use these codes.
enum MessageCode {
// Unspecific code. Use this for anything where a client is not expected to
// handle this message in a specific way.
......@@ -35,6 +37,251 @@ enum MessageCode {
MESSAGE_CODE_UNKNOWN = 1;
// The requested entity (retrieve, delete, or update) does not exist.
MESSAGE_CODE_ENTITY_DOES_NOT_EXIST = 2;
// The entity has no properties.
MESSAGE_CODE_ENTITY_HAS_NO_PROPERTIES = 3;
// TODO(tf) This entity has been deleted successfully.
MESSAGE_CODE_ENTITY_HAS_BEEN_DELETED_SUCCESSFULLY = 5;
// TODO(tf) Entity has unqualified properties.
MESSAGE_CODE_ENTITY_HAS_UNQUALIFIED_PROPERTIES = 6;
// TODO(tf) Entity has unqualified parents.
MESSAGE_CODE_ENTITY_HAS_UNQUALIFIED_PARENTS = 7;
// TODO(tf) DESCRIPTION!!!
MESSAGE_CODE_PARSING_FAILED = 8;
// TODO(tf) Unknown datatype.
MESSAGE_CODE_UNKNOWN_DATATYPE = 9;
// TODO(tf) Unknown importance.
MESSAGE_CODE_UNKNOWN_IMPORTANCE = 10;
// TODO(tf) Entity has no ID.
MESSAGE_CODE_ENTITY_HAS_NO_ID = 11;
// TODO(tf) Entity is required by other entities which are not to be deleted.
MESSAGE_CODE_REQUIRED_BY_PERSISTENT_ENTITY = 12;
// TODO(tf) Property has no datatype.
MESSAGE_CODE_NO_DATATYPE = 13;
// TODO(tf) Entity has no description.
MESSAGE_CODE_ENTITY_HAS_NO_DESCRIPTION = 14;
// TODO(tf) Entity has no name.
MESSAGE_CODE_ENTITY_HAS_NO_NAME = 15;
// TODO(tf) An obligatory property is missing.
MESSAGE_CODE_OBLIGATORY_PROPERTY_MISSING = 16;
// TODO(tf) Entity has no parents.
MESSAGE_CODE_ENTITY_HAS_NO_PARENTS = 17;
// TODO(tf) Entity can not be identified due to name duplicates.
MESSAGE_CODE_NAME_DUPLICATES = 18;
// TODO(tf) Entity has no name and no ID.
MESSAGE_CODE_ENTITY_HAS_NO_NAME_AND_NO_ID = 19;
// TODO(tf) Reference property has no refid.
MESSAGE_CODE_REFERENCE_HAS_NO_REFID = 20;
// TODO(tf) No target path specified.
MESSAGE_CODE_NO_TARGET_PATH = 21;
// TODO(tf) This target path is not allowed.
MESSAGE_CODE_TARGET_PATH_NOT_ALLOWED = 22;
// TODO(tf) This target path does already exist.
MESSAGE_CODE_TARGET_PATH_EXISTS = 23;
// TODO(tf) Entity has no unit.
MESSAGE_CODE_ENTITY_HAS_NO_UNIT = 24;
// TODO(tf) Cannot parse value.
MESSAGE_CODE_CANNOT_PARSE_VALUE = 25;
// TODO(tf) Checksum test failed. File is corrupted.
MESSAGE_CODE_CHECKSUM_TEST_FAILED = 26;
// TODO(tf) Size test failed. File is corrupted.
MESSAGE_CODE_SIZE_TEST_FAILED = 27;
// TODO(tf) Could not create parent folder in the file system.
MESSAGE_CODE_CANNOT_CREATE_PARENT_FOLDER = 28;
// TODO(tf) File has not been uploaded.
MESSAGE_CODE_FILE_HAS_NOT_BEEN_UPLOAED = 29;
// TODO(tf) Thumbnail has not been uploaded.
MESSAGE_CODE_THUMBNAIL_HAS_NOT_BEEN_UPLOAED = 30;
// TODO(tf) Could not move file to it's target folder.
MESSAGE_CODE_CANNOT_MOVE_FILE_TO_TARGET_PATH = 31;
// TODO(tf) Cannot parse value to datetime format
// (yyyy-mm-dd'T'hh:mm:ss[.fffffffff][TimeZone]).
MESSAGE_CODE_CANNOT_PARSE_DATETIME_VALUE = 32;
// TODO(tf) Cannot parse value to double.
MESSAGE_CODE_CANNOT_PARSE_DOUBLE_VALUE = 33;
// TODO(tf) Cannot parse value to integer.
MESSAGE_CODE_CANNOT_PARSE_INT_VALUE = 34;
// TODO(tf) Cannot parse value to boolean (either 'true' or 'false', ignoring
// case).
MESSAGE_CODE_CANNOT_PARSE_BOOL_VALUE = 35;
// TODO(tf) Could not connect to MySQL server.
MESSAGE_CODE_CANNOT_CONNECT_TO_DATABASE = 36;
// TODO(tf) Please check if your MySQL has all required procedures installed.
MESSAGE_CODE_MYSQL_PROCEDURE_EXCEPTION = 37;
// TODO(tf) This error occurred while parsing the xml. Probably it has a wrong
// encoding.
MESSAGE_CODE_REQUEST_HAS_WRONG_ENCODING = 38;
// TODO(tf) Request body didn't contain the expected Elements.
MESSAGE_CODE_REQUEST_DOESNT_CONTAIN_EXPECTED_ELEMENTS = 39;
// TODO(tf) File is not in drop-off box.
MESSAGE_CODE_FILE_NOT_IN_DROPOFFBOX = 40;
// TODO(tf) File could not be found.
MESSAGE_CODE_FILE_NOT_FOUND = 41;
// TODO(tf) Could not move file to tmp folder.
MESSAGE_CODE_CANNOT_MOVE_FILE_TO_TMP = 42;
// TODO(tf) Insufficient read permission for this file. Please make it
// readable.
MESSAGE_CODE_CANNOT_READ_FILE = 43;
// TODO(tf) Insufficient read permission for this file's thumbnail. Please
// make it readable.
MESSAGE_CODE_CANNOT_READ_THUMBNAIL = 44;
// TODO(tf) No file representation submitted.
MESSAGE_CODE_NO_FILE_REPRESENTATION_SUBMITTED = 45;
// TODO(tf) DESCRIPTION?
MESSAGE_CODE_FILE_IS_EMPTY = 46;
// TODO(tf) A warning occured while processing an entity with the strict flag.
MESSAGE_CODE_WARNING_OCCURED = 47;
// TODO(tf) DESCRIPTION?
MESSAGE_CODE_UNKNOWN_JOB = 48;
// TODO(tf) Name is already in use. Choose a different name or reuse an
// existing entity.
MESSAGE_CODE_NAME_IS_NOT_UNIQUE = 49;
// TODO(tf) This entity cannot be identified uniquely due to name dublicates
MESSAGE_CODE_CANNOT_IDENTIFY_ENTITY_UNIQUELY = 50;
// TODO(tf) This query finished with errors.
MESSAGE_CODE_QUERY_EXCEPTION = 51;
// TODO(tf) This entity is empty.
MESSAGE_CODE_ENTITY_IS_EMPTY = 52;
// TODO(tf) An unknown error occured during the transaction and it was rolled
// back.
MESSAGE_CODE_TRANSACTION_ROLL_BACK = 53;
// TODO(tf) The file upload failed for an unknown reason.
MESSAGE_CODE_FILE_UPLOAD_FAILED = 54;
// TODO(tf) Unknown unit. Values with this unit cannot be converted to other
// units when used in search queries.
MESSAGE_CODE_UNKNOWN_UNIT = 55;
// TODO(tf) You are not allowed to do this.
MESSAGE_CODE_AUTHORIZATION_ERROR = 56;
// TODO(tf) Reference not qualified. The value of this Reference Property is
// to be a child of its data type.
MESSAGE_CODE_REFERENCE_IS_NOT_ALLOWED_BY_DATATYPE = 57;
// TODO(tf) Cannot parse EntityACL.
MESSAGE_CODE_CANNOT_PARSE_ENTITY_ACL = 58;
// TODO(tf) This entity cannot be identified due to name duplicates.
MESSAGE_CODE_ENTITY_NAME_DUPLICATES = 59;
// TODO(tf) This data type cannot be identified due to name duplicates.
MESSAGE_CODE_DATA_TYPE_NAME_DUPLICATES = 60;
// TODO(tf) This entity cannot be identified as it didn't come with a name or
// id.
MESSAGE_CODE_ENTITY_HAS_NO_NAME_OR_ID = 61;
// TODO(tf) Affiliation is not defined for this child-parent constellation.
MESSAGE_CODE_AFFILIATION_ERROR = 62;
// TODO(tf) An error occured during the parsing of this query. Maybe you use a
// wrong syntax?
MESSAGE_CODE_QUERY_PARSING_ERROR = 63;
// TODO(tf) A property which has 'name' as its parent must have a TEXT data
// type.
MESSAGE_CODE_NAME_PROPERTIES_MUST_BE_TEXT = 64;
// TODO(tf) This entity had parent duplicates. That is meaningless and only
// one parent had been inserted.
MESSAGE_CODE_PARENT_DUPLICATES_WARNING = 65;
// TODO(tf) This entity had parent duplicates. Parent duplicates are
// meaningless and would be ignored (and inserted only once). But these
// parents had diverging inheritance instructions which cannot be processed.
MESSAGE_CODE_PARENT_DUPLICATES_ERROR = 66;
// TODO(tf) One or more entities are not qualified. None of them have been
// inserted/updated/deleted.
MESSAGE_CODE_ATOMICITY_ERROR = 67;
// TODO(tf) There is no such role '" + role + "'.
MESSAGE_CODE_NO_SUCH_ENTITY_ROLE = 68;
// TODO(tf) This entity cannot be deleted due to dependency problems
MESSAGE_CODE_REQUIRED_BY_UNQUALIFIED = 69;
// TODO(tf) This entity has an invalid reference.
MESSAGE_CODE_ENTITY_HAS_INVALID_REFERENCE = 70;
// TODO(tf) Referenced entity does not exist.
MESSAGE_CODE_REFERENCED_ENTITY_DOES_NOT_EXIST = 71;
// TODO(tf) This reference cannot be identified due to name duplicates.
MESSAGE_CODE_REFERENCE_NAME_DUPLICATES = 72;
// TODO(tf) The datatype which is to be inherited could not be detected due to
// divergent datatypes of at least two parents.
MESSAGE_CODE_DATATYPE_INHERITANCE_AMBIGUOUS = 73;
// TODO(tf) This datatype does not accept collections of values (e.g. Lists).
MESSAGE_CODE_DATA_TYPE_DOES_NOT_ACCEPT_COLLECTION_VALUES = 74;
// TODO(tf) This unit cannot be parsed.
MESSAGE_CODE_CANNOT_PARSE_UNIT = 75;
// TODO(tf) This property is an additional property which has no corresponding
// property among the properties of the parents.
MESSAGE_CODE_ADDITIONAL_PROPERTY = 76;
// TODO(tf) This property overrides the datatype.
MESSAGE_CODE_PROPERTY_WITH_DATATYPE_OVERRIDE = 77;
// TODO(tf) This property overrides the description.
MESSAGE_CODE_PROPERTY_WITH_DESC_OVERRIDE = 78;
// TODO(tf) This property overrides the name.
MESSAGE_CODE_PROPERTY_WITH_NAME_OVERRIDE = 79;
}
// Messages are used by server's or client's to transport *transient*
......@@ -115,6 +362,12 @@ message Property {
string unit = 6;
// Property datatype
string datatype = 7;
// Errors of this property
repeated Message errors = 8;
// Warnings of this property
repeated Message warnings = 9;
// Info messages of this property
repeated Message infos = 10;
}
// Parent of an entity.
......@@ -125,40 +378,127 @@ message Parent {
string name = 2;
// Description of the parent entity.
string description = 3;
}
// Request a transaction of an entity by its ID. This can be used to implement
// a retrieval or deletion.
message ByIdRequest {
// ID of requested entity
string id = 1;
// Errors of this parent
repeated Message errors = 4;
// Warnings of this parent
repeated Message warnings = 5;
// Info messages of this parent
repeated Message infos = 6;
}
// Response to a retrieve request
message RetrieveResponse {
// Payload of the retrieval
Entity entity = 1;
oneof query_response {
// Result of a FIND query or a request by id.
Entity entity = 1;
// Result of a SELECT query
SelectQueryResult select_result = 3;
// Result of a COUNT query
int64 count_result = 4;
}
}
// CaosDB Query
message Query {
// The string representation of the query, e.g. "FIND Person WITH name =
// Aisha"
string query = 1;
}
// A single result row of a SELECT query
message SelectQueryRows {
// The cells of the table row.
repeated string cells = 1;
}
// A table which is a result of a SELECT query
message SelectQueryResult {
// A single row which contains the SELECT'ed fields
SelectQueryRows header = 1;
// The actual results
repeated SelectQueryRows data_rows = 2;
}
// Request which specifies one or multiple entities by query or by id.
message QueryOrIdRequest {
// We wrap these two together because this makes it easier to add further
// requests (like "name", or "path") in the future.
oneof wrapped_request {
// A single id
string id = 1;
// A query
Query query = 2;
}
}
// Single response containing either an id, a COUNT query result, a SELECT-table
// or complete entities.
message TransactionResponse {
// We wrap these together in order to make this a repeatable field in the
// MultiTransactionResponse.
oneof wrapped_response {
// Single response to a delete transaction.
IdResponse delete_response = 1;
// Single response to an update transaction.
IdResponse update_response = 2;
// Single response to a retrieve transaction.
RetrieveResponse retrieve_response = 3;
// Single response to an insert transaction.
IdResponse insert_response = 4;
}
}
// Single request containing either a query, an id or a complete entity.
message TransactionRequest {
// We wrap these together in order to make this a repeatable field in the
// MultiTransactionRequest.
oneof wrapped_requests {
// Single request for a retrieve transaction.
QueryOrIdRequest retrieve_request = 1;
// Single request for an update transaction.
Entity update_request = 2;
// Single request for an insert transaction.
Entity insert_request = 3;
// Single request for a delete transaction.
QueryOrIdRequest delete_request = 4;
}
}
// Wraps the reponses to multiple sub-transactions of mixed types.
message MultiTransactionResponse {
// The actual payload.
repeated TransactionResponse responses = 1;
// Transaction errors.
repeated Message errors = 2;
repeated Message transaction_errors = 2;
// Transaction warnings.
repeated Message warnings = 3;
repeated Message transaction_warnings = 3;
// Transaction info messages.
repeated Message infos = 4;
repeated Message transaction_infos = 4;
}
// Wrapper for different kinds of retrievals (currently, only by ID). We need
// this in order to make a repeated field of these different kinds of
// retrievals.
message RetrieveRequest {
// Wrapped special kind of request.
oneof wrapped_request {
// A single retrieve
ByIdRequest by_id = 1;
}
// Wraps multiple sub-transaction requests of mixed types.
message MultiTransactionRequest {
// The actual payload.
repeated TransactionRequest requests = 1;
}
// A response containing only the id (of a deleted, inserted, or updated
// entity) and the usual trias of entity messages.
message IdResponse {
// The entity id.
string id = 1;
// Entity errors.
repeated Message entity_errors = 2;
// Entity warnings.
repeated Message entity_warnings = 3;
// Entity info messages.
repeated Message entity_infos = 4;
}
// Entity Transaction Service
service EntityTransactionService {
// Issue a single retrieve request
rpc Retrieve(RetrieveRequest) returns (RetrieveResponse);
// Issue multiple mixed requests
rpc MultiTransaction(MultiTransactionRequest)
returns (MultiTransactionResponse);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment