This repository has been archived by the owner on May 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
model_registry.proto
126 lines (104 loc) · 4.76 KB
/
model_registry.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
// Copyright 2021 AI Redefined Inc. <[email protected]>
//
// 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 cogmentAPI;
// API for model registry, it stores versioned model data and their metadata
service ModelRegistrySP {
// Create or update a model
rpc CreateOrUpdateModel(CreateOrUpdateModelRequest) returns (CreateOrUpdateModelReply) {}
// Delete a model and its versions
rpc DeleteModel(DeleteModelRequest) returns (DeleteModelReply) {}
// Retrieve the the info of all or part of the models
rpc RetrieveModels(RetrieveModelsRequest) returns (RetrieveModelsReply) {}
// Create a model version and returns its information
rpc CreateVersion(stream CreateVersionRequestChunk) returns (CreateVersionReply) {}
// Retrieve the info of all or part of the versions of a model
rpc RetrieveVersionInfos(RetrieveVersionInfosRequest) returns (RetrieveVersionInfosReply) {}
// Retrieve the data of a model given or latest version
rpc RetrieveVersionData(RetrieveVersionDataRequest) returns (stream RetrieveVersionDataReplyChunk) {}
}
// Information about a model
message ModelInfo {
string model_id = 1;
map<string, string> user_data = 2; // Key/Value metadata relative to the model
}
// Information about a version of a model
message ModelVersionInfo {
string model_id = 1;
uint32 version_number = 2;
fixed64 creation_timestamp = 3; // When the model was created as nanosecond unix timestamp
bool archived = 4; // Is this version archived
string data_hash = 5; // SHA 256 hash (encoded in base64) of this version's data, can be used to validate the data and for caching purposes
fixed64 data_size = 6; // Size (in bytes) of this version's data
map<string, string> user_data = 7; // Key/Value metadata relative to the model version
}
message CreateOrUpdateModelRequest {
ModelInfo model_info = 1;
}
message CreateOrUpdateModelReply {}
message RetrieveModelsRequest {
repeated string model_ids = 1; // Optional, list of desired model ids
// Leave emtpy to retrieve all models
uint32 models_count = 3; // Desired number of models in the reply, 0 means no limit
string model_handle = 4; // Leave empty for the initial request, use previous
// use `RetrieveModelsReply.next_model_handle`
// to access the next model
}
message RetrieveModelsReply {
repeated ModelInfo model_infos = 1;
string next_model_handle = 2;
}
message DeleteModelRequest {
string model_id = 1;
}
message DeleteModelReply {}
message CreateVersionRequestChunk {
message Header {
ModelVersionInfo version_info = 1; // Information for the model version to create
// - `version_number` will be ignored
// - `data_hash` and `data_size` will be used to validate the received data
}
message Body {
bytes data_chunk = 1; // A chunk of the version data
// All the chunks in the stream will be concatened
}
oneof msg {
Header header = 1; // Should be defined in the first messages in the stream
Body body = 2; // Should be defined in the rest of the messages in the stream
}
}
message CreateVersionReply {
ModelVersionInfo version_info = 1;
}
message RetrieveVersionInfosRequest {
string model_id = 1;
repeated int32 version_numbers = 2; // Optional, list of desired version number (or -1 to denote the latest version)
// Leave emtpy to retrieve all versions of the given model
uint32 versions_count = 3; // Desired number of version infos in the reply, 0 means no limit
string version_handle = 4; // Leave empty for the initial request, use previous
// use `RetrieveVersionInfosReply.next_version_handle`
// to access the next version
}
message RetrieveVersionInfosReply {
repeated ModelVersionInfo version_infos = 1;
string next_version_handle = 2;
}
message RetrieveVersionDataRequest {
string model_id = 1;
int32 version_number = 2; // Desired version number or -1 to get the latest version
}
message RetrieveVersionDataReplyChunk {
bytes data_chunk = 1; // A chunk of the version data
// All the chunks in the stream needs to be concatened
}