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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
// Generated by tools/service-contracts/rust.py. Do not edit.
#![doc = "Transport-independent service interface for local and remote calls."]
use async_trait::async_trait;
use spiral_contract::auth::AuthHeader;
use spiral_contract::call::CallError;
use crate::api::catalog::objects::*;
/// Service implementations authenticate Authorization headers and enforce resource permissions.
#[async_trait]
pub trait CatalogApi: Send + Sync + 'static {
/// Compare a base and a head commit. The response contains the exact number of commits that
/// each side has and the other does not, and a bounded part of the graph that only the head
/// has. When the comparison is larger than the traversal limits, the response is
/// `CommitTraversalLimitExceeded`. You must have permission to read the project.
async fn compare_commits(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: CompareCommitsRequest,
) -> Result<CompareCommitsResponse, CallError<CatalogError>>;
/// Create a branch at the commit that the target selector identifies. The selector is resolved
/// one time. To retry, send the same request with the same idempotency key. You must have
/// permission to create branches.
async fn create_branch(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: CreateBranchRequest,
) -> Result<Branch, CallError<CatalogError>>;
/// Create an immutable tag at the commit that the target selector identifies. You cannot move
/// or delete a tag. You must have permission to create tags.
async fn create_tag(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: CreateTagRequest,
) -> Result<Tag, CallError<CatalogError>>;
/// Mark a branch as deleted and return the deleted branch. The commits and the event history of
/// the branch stay available. The service validates if you can delete the main branch. You must
/// have permission to delete branches.
async fn delete_branch(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
branch_id: BranchId,
request: DeleteBranchRequest,
) -> Result<Branch, CallError<CatalogError>>;
/// Return all net changes to resources and namespace bindings between two commits. The response
/// is complete. It is not paged or truncated. When the result is too large, the response is
/// `CatalogLimitExceeded`. You must have permission to read the project.
async fn diff_state(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: DiffStateRequest,
) -> Result<DiffStateResponse, CallError<CatalogError>>;
/// Prepare the Catalog of a project and return its main branch. You can send this request more
/// than once. When the Catalog exists, the response contains the current main branch. You must
/// have permission to initialize the project.
async fn initialize(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
) -> Result<Branch, CallError<CatalogError>>;
/// List the live branches of the project. To include deleted branches, set `includeDeleted`.
/// Branches are in order of name and identity. When branches change during a listing, a branch
/// can be skipped or repeated. Each page token keeps `includeDeleted` and the scope of the
/// first request. You must have permission to list branches.
async fn list_branches(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ListBranchesRequest,
) -> Result<ListBranchesResponse, CallError<CatalogError>>;
/// List the bindings in a namespace scope at one immutable commit. Each page token keeps the
/// scope and the commit of the first request. To read a newer commit, start a new listing. You
/// must have permission to read the project state.
async fn list_namespace(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
request: ListNamespaceRequest,
) -> Result<NamespacePage, CallError<CatalogError>>;
/// List the live tags of the project in order of name. When a tag is created during a listing
/// at a name before the current page, the listing does not include it. You must have permission
/// to list tags.
async fn list_tags(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ListTagsRequest,
) -> Result<ListTagsResponse, CallError<CatalogError>>;
/// Do a three-way merge, or examine a merge before you do it. When `dryRun` is true, the merge
/// is not published. Conflicts are part of the response. You must have permission to merge in
/// the project and to change each resource that the merge changes.
async fn merge(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: MergeRequest,
) -> Result<MergeResponse, CallError<CatalogError>>;
/// Return all best common ancestors of two commits. When the history has more than one best
/// common ancestor, the response contains all of them. An empty list means that the histories
/// are not related. You must have permission to read the project.
async fn merge_bases(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: MergeBasesRequest,
) -> Result<MergeBasesResponse, CallError<CatalogError>>;
/// Publish a set of resource and namespace changes as one atomic commit. When an expected
/// version or binding does not agree with the current state, nothing is published and the
/// response contains the conflicts. A request that contains only assertions records a commit
/// but does not change the project state. You must have permission to publish to the project
/// and to change each resource.
async fn publish(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: PublishRequest,
) -> Result<PublishResponse, CallError<CatalogError>>;
/// Publish changes and save an operation receipt in one atomic step. When a receipt already
/// exists for the same project operation and input, the response contains that receipt. The
/// saved receipt applies to all later requests, from all callers. Each request is authenticated
/// and authorized again. You must have permission to publish to the project and to change each
/// resource.
async fn publish_operation(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: PublishOperationRequest,
) -> Result<PublishOperationResponse, CallError<CatalogError>>;
/// Read a live branch by its name. The response contains the current head commit of the branch.
/// Use this commit identity with the operations that read one commit. You must have permission
/// to read the project.
async fn read_branch(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ReadBranchRequest,
) -> Result<Branch, CallError<CatalogError>>;
/// Read one immutable branch event. You must have permission to read the branch history of the
/// project.
async fn read_branch_event(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
event_id: BranchEventId,
) -> Result<BranchEvent, CallError<CatalogError>>;
/// List the events of one branch, newest first. This operation also works for a deleted branch.
/// The first page sets the newest event of the listing. You must have permission to read the
/// branch history of the project.
async fn read_branch_events(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
branch_id: BranchId,
request: ReadRefEventsRequest,
) -> Result<BranchEventPage, CallError<CatalogError>>;
/// Read one immutable commit. You must have permission to read the commits of the project.
async fn read_commit(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
) -> Result<Commit, CallError<CatalogError>>;
/// Read a part of the commit graph, starting from the commits in `starts`. You must supply
/// `starts`. To start from branch heads, list the branches first. To read more of the graph,
/// send `continuationCommitIds` from the response as `starts` in a new request, with the same
/// exclusions. The next response can contain commits that you already have; ignore them. A
/// response contains at most 1000 commits. You must have permission to read the commit log of
/// the project.
async fn read_commit_log(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ReadCommitLogRequest,
) -> Result<CommitLog, CallError<CatalogError>>;
/// Read a saved operation receipt. A receipt can contain sensitive project data. An operation
/// identity does not give access to the receipt. You must have permission to publish to the
/// project.
async fn read_operation(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
operation_id: OperationId,
) -> Result<ReadOperationResponse, CallError<CatalogError>>;
/// List the branch events of all branches in the project, in descending order of
/// `branchEventId`. Event timestamps do not set the order, and identity order is not commit
/// order. This is a live listing: new events with an identity below the current page can appear
/// in later pages. Events above the current page do not appear again. You must have permission
/// to read the branch history of the project.
async fn read_ref_events(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ReadRefEventsRequest,
) -> Result<RefEventPage, CallError<CatalogError>>;
/// Read the identity and version of a resource at one immutable commit. When the commit does
/// not exist, the response is `CommitNotFound`. When the resource is not live at the commit,
/// the response is `ResourceNotFound`. You must have permission to read the project state.
async fn read_resource(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
resource_id: ResourceId,
) -> Result<ResourceState, CallError<CatalogError>>;
/// Read the resources and namespace bindings of the project at one immutable commit, one page
/// at a time. You must have permission to read the project state.
async fn read_state(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
request: ReadStateRequest,
) -> Result<StatePage, CallError<CatalogError>>;
/// Read one immutable tag by its name. Send the name as a query parameter. A name can contain
/// slashes. You must have permission to read the project.
async fn read_tag(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ReadTagRequest,
) -> Result<Tag, CallError<CatalogError>>;
/// Find the result of a publication when you do not know if it completed. Send the transaction
/// identity of the publication. The search uses the project and the authenticated caller. When
/// the response has no publication, the publication can still complete later. Thus, when you
/// retry, use the same transaction identity and idempotency key. You must have permission to
/// recover publications in the project.
async fn recover_publication(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: RecoverPublicationRequest,
) -> Result<RecoverPublicationResponse, CallError<CatalogError>>;
/// Change the name of a live branch. The branch keeps its identity and its head commit. The
/// rename adds an event to the branch history. You must have permission to rename branches.
async fn rename_branch(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
branch_id: BranchId,
request: RenameBranchRequest,
) -> Result<Branch, CallError<CatalogError>>;
/// Resolve a commit, branch, or tag selector to one commit. The selector is resolved one time.
/// Relative expressions such as `main~3` are not supported. You must have permission to read
/// the project.
async fn resolve_commit(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: ResolveCommitRequest,
) -> Result<ResolveCommitResponse, CallError<CatalogError>>;
/// Find the resource that a namespace path refers to at one immutable commit. When no resource
/// has the path, the response has no resource. You must have permission to read the project
/// state.
async fn resolve_path(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
request: ResolvePathRequest,
) -> Result<ResolvePathResponse, CallError<CatalogError>>;
/// Resolve a batch of namespace paths at one immutable commit. The response has one result for
/// each path in the request. A request can have at most 1000 paths. You must have permission to
/// read the project state.
async fn resolve_paths(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
commit_id: CommitId,
request: ResolvePathsRequest,
) -> Result<ResolvePathsResponse, CallError<CatalogError>>;
/// Publish a commit that reverses the changes of a commit, or examine the revert before you do
/// it. To revert a merge commit, you must supply `mainlineParent`. The value 1 selects the
/// first parent. When `dryRun` is true, the revert is not published. Conflicts are part of the
/// response. You must have permission to revert in the project and to change each resource that
/// the revert changes.
async fn revert(
&self,
auth_header: AuthHeader,
project_id: ProjectId,
request: RevertRequest,
) -> Result<RevertResponse, CallError<CatalogError>>;
}