-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathapi.proto
More file actions
151 lines (125 loc) · 3.71 KB
/
api.proto
File metadata and controls
151 lines (125 loc) · 3.71 KB
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
139
140
141
142
143
144
145
146
147
148
149
150
151
// Copyright (C) 2018 Egor Pugin <[email protected]>
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
syntax = "proto3";
option cc_enable_arenas = true;
package sw.api;
import "google/protobuf/empty.proto";
message PackageId {
string path = 1;
string version = 2;
}
message UnresolvedPackage {
string path = 1;
string range = 2;
}
message ResolvedPackage {
message Dependency {
int64 id = 1;
// if package is deployed on a private server
// string path?
// flags?
}
// base fields
int64 id = 1;
PackageId package = 2;
int64 flags = 3;
string hash = 4;
repeated Dependency dependencies = 5;
// other
int64 group_number = 16;
int32 prefix = 17;
// int32 archive_type;
// optional string download_url;
}
message ResolvedPackage2 {
PackageId package = 1;
int64 flags = 2;
string hash = 3;
repeated UnresolvedPackage dependencies = 4;
// other
int64 group_number = 16;
int32 prefix = 17;
// int32 archive_type;
// optional string download_url;
}
message UnresolvedPackages {
repeated UnresolvedPackage packages = 1;
}
message ResolvedPackages {
repeated ResolvedPackage packages = 1;
}
message ResolvedPackages2 {
message ResolvedPackagePair {
UnresolvedPackage unresolved_package = 1;
ResolvedPackage2 resolved_package = 2;
}
repeated ResolvedPackagePair resolved_packages = 1;
repeated UnresolvedPackage unresolved_packages = 2;
}
message PackageIds {
repeated int64 ids = 1;
}
message NotificationsRequest {
int32 n = 1;
}
message Notifications {
message Notification {
enum Type {
NONE = 0;
MESSAGE = 1;
SUCCESS = 2;
WARNING = 3;
ERROR = 4;
}
Type type = 1;
string text = 2;
int64 timestamp = 3;
}
repeated Notification notifications = 1;
}
message NewPackage {
message RawScript {
string script = 1;
string prefix_path = 2;
}
message NewVersion {
PackageId package = 1;
string old_version = 2;
}
message PackageData {
string data = 1; // json string
RawScript script = 2;
}
//
oneof package {
RawScript script = 1;
NewVersion version = 2; // add new ver for existing package
PackageData package_data = 3;
}
}
// unauthorized
service ApiService {
rpc ResolvePackages (UnresolvedPackages) returns (ResolvedPackages);
// std::unordered_map<UnresolvedPackage, Package>
// resolve(const UnresolvedPackages &pkgs, UnresolvedPackages &unresolved_pkgs)
rpc ResolvePackages2 (UnresolvedPackages) returns (ResolvedPackages2);
//
// following are subtle calls, probably to be removed
// tbr, check downloads on s3
rpc AddDownloads (PackageIds) returns (google.protobuf.Empty);
rpc AddDownloads2 (PackageId) returns (google.protobuf.Empty); // second version, simple
// also deprecate later
rpc AddClientCall (google.protobuf.Empty) returns (google.protobuf.Empty);
}
// id: 1
service UserService {
rpc AddPackage (NewPackage) returns (google.protobuf.Empty); // id: 1
// update version (e.g. branch versions)
rpc UpdatePackage (PackageId) returns (google.protobuf.Empty); // id: 2
rpc RemovePackage (PackageId) returns (google.protobuf.Empty); // id: 3
rpc GetNotifications (NotificationsRequest) returns (Notifications); // id: 4
rpc ClearNotification (google.protobuf.Empty) returns (google.protobuf.Empty); // id: 5
}