// // db3_mutation_v2.proto // Copyright (C) 2023 db3.network Author imotai // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // syntax = "proto3"; package db3_mutation_v2_proto; import "db3_base.proto"; import "db3_database_v2.proto"; message DocumentDatabaseMutation { string db_desc = 1; } message CollectionMutation { repeated db3_database_v2_proto.Index index_fields = 1; string collection_name = 2; } message MintCollectionMutation { string signature = 1; string tx = 2; string db_addr = 3; string name = 4; string sender = 5; } message MintDocumentDatabaseMutation { string signature = 1; string tx = 2; string db_addr = 3; string desc = 5; string sender = 6; } message DeleteEventDatabaseMutation {} message AddIndexMutation { string collection_name = 1; repeated db3_database_v2_proto.Index index_fields = 2; } message DocumentMutation { string collection_name = 1; repeated bytes documents = 2; repeated int64 ids = 3; // The fields to update. // None of the field paths in the mask may contain a reserved name. // // If the document exists on the server and has fields not referenced in the // mask, they are left unchanged. // Fields referenced in the mask, but not present in the input document, are // deleted from the document on the server. repeated DocumentMask masks = 4; } message EventDatabaseMutation { string contract_address = 1; uint64 ttl = 2; string desc = 3; repeated CollectionMutation tables = 4; string events_json_abi = 5; string evm_node_url = 6; uint64 start_block = 7; } message DocumentMask { repeated string fields = 1; } message MutationHeader { uint64 block_id = 1; uint32 order_id = 2; bytes sender = 3; uint64 time = 4; string id = 5; uint32 size = 6; uint64 nonce = 7; uint64 network = 8; MutationAction action = 9; string doc_ids_map = 10; } message MutationBody { bytes payload = 1; string signature = 2; } enum MutationAction { CreateDocumentDB = 0; AddCollection = 1; AddDocument = 2; DeleteDocument = 3; UpdateDocument = 4; CreateEventDB = 5; MintDocumentDB = 6; MintCollection = 7; AddIndex = 8; DeleteEventDB = 9; } enum MutationRollupStatus { Pending = 0; Doing = 1; Done = 2; } message Mutation { MutationAction action = 1; message BodyWrapper { bytes db_address = 1; oneof body { CollectionMutation collection_mutation = 2; DocumentMutation document_mutation = 3; EventDatabaseMutation event_database_mutation = 4; DocumentDatabaseMutation doc_database_mutation = 5; MintDocumentDatabaseMutation mint_doc_database_mutation = 6; MintCollectionMutation mint_collection_mutation = 7; AddIndexMutation add_index_mutation = 8; DeleteEventDatabaseMutation delete_event_database_mutation = 9; } } repeated BodyWrapper bodies = 3; }