-
Notifications
You must be signed in to change notification settings - Fork 44
/
db3_mutation_v2.proto
138 lines (121 loc) · 3.33 KB
/
db3_mutation_v2.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
//
// db3_mutation_v2.proto
// Copyright (C) 2023 db3.network Author imotai <codego.me@gmail.com>
//
// 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;
}