forked from taskcluster/taskcluster
-
Notifications
You must be signed in to change notification settings - Fork 0
/
0024.yml
134 lines (134 loc) · 5.36 KB
/
0024.yml
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
version: 24
description: queue artifacts phase 2 step 2
methods:
delete_queue_artifact:
description: |-
Delete a queue artifact.
mode: write
serviceName: queue
args: task_id_in text, run_id_in integer, name_in text
returns: void
body: |-
begin
delete from queue_artifacts
where
queue_artifacts.task_id = task_id_in and
queue_artifacts.run_id = run_id_in and
queue_artifacts.name = name_in;
end
create_queue_artifact:
description: |-
Create a new artifact. Raises UNIQUE_VIOLATION if the artifact already exists.
Returns the newly created artifact.
mode: write
serviceName: queue
args: task_id_in text, run_id_in integer, name_in text, storage_type_in text, content_type_in text, details_in jsonb, present_in boolean, expires_in timestamptz
returns: table(task_id text, run_id integer, name text, storage_type text, content_type text, details jsonb, present boolean, expires timestamptz)
body: |-
begin
return query insert
into queue_artifacts (task_id, run_id, name, storage_type, content_type, details, present, expires)
values (task_id_in, run_id_in, name_in, storage_type_in, content_type_in, details_in, present_in, expires_in)
returning queue_artifacts.task_id, queue_artifacts.run_id, queue_artifacts.name, queue_artifacts.storage_type, queue_artifacts.content_type, queue_artifacts.details, queue_artifacts.present, queue_artifacts.expires;
end
update_queue_artifact:
serviceName: queue
description: |-
Update a queue artifact.
Returns the up-to-date artifact row that have the same task id, run id, and name.
mode: write
args: task_id_in text, run_id_in integer, name_in text, details_in jsonb, expires_in timestamptz
returns: table(task_id text, run_id integer, name text, storage_type text, content_type text, details jsonb, present boolean, expires timestamptz)
body: |-
declare
updated_row queue_artifacts%ROWTYPE;
begin
update queue_artifacts
set (details, expires) = (
coalesce(details_in, queue_artifacts.details),
coalesce(expires_in, queue_artifacts.expires)
)
where
queue_artifacts.task_id = task_id_in and
queue_artifacts.run_id = run_id_in and
queue_artifacts.name = name_in
returning
queue_artifacts.task_id,
queue_artifacts.run_id,
queue_artifacts.name,
queue_artifacts.storage_type,
queue_artifacts.content_type,
queue_artifacts.details,
queue_artifacts.present,
queue_artifacts.expires
into updated_row;
if found then
return query select
updated_row.task_id,
updated_row.run_id,
updated_row.name,
updated_row.storage_type,
updated_row.content_type,
updated_row.details,
updated_row.present,
updated_row.expires
return;
else
raise exception 'no such row' using errcode = 'P0002';
end if;
end
get_queue_artifact:
description: |-
Get a queue artifact. The returned table will have one or zero row.
mode: read
serviceName: queue
args: task_id_in text, run_id_in integer, name_in text
returns: table(task_id text, run_id integer, name text, storage_type text, content_type text, details jsonb, present boolean, expires timestamptz)
body: |-
begin
return query select
queue_artifacts.task_id,
queue_artifacts.run_id,
queue_artifacts.name,
queue_artifacts.storage_type,
queue_artifacts.content_type,
queue_artifacts.details,
queue_artifacts.present,
queue_artifacts.expires
from queue_artifacts
where
queue_artifacts.task_id = task_id_in and
queue_artifacts.run_id = run_id_in and
queue_artifacts.name = name_in;
end
get_queue_artifacts:
description: |-
Get existing queue artifacts filtered by the optional arguments,
ordered by the `task_id`, `run_id`, and `name`.
If the pagination arguments are both NULL, all rows are returned.
Otherwise, page_size rows are returned at offset page_offset.
mode: read
serviceName: queue
args: task_id_in text, run_id_in integer, expires_in timestamptz, page_size_in integer, page_offset_in integer
returns: table(task_id text, run_id integer, name text, storage_type text, content_type text, details jsonb, present boolean, expires timestamptz)
body: |-
begin
return query
select
queue_artifacts.task_id,
queue_artifacts.run_id,
queue_artifacts.name,
queue_artifacts.storage_type,
queue_artifacts.content_type,
queue_artifacts.details,
queue_artifacts.present,
queue_artifacts.expires
from queue_artifacts
where
(queue_artifacts.task_id = task_id_in or task_id_in is null) and
(queue_artifacts.run_id = run_id_in or run_id_in is null) and
(queue_artifacts.expires < expires_in or expires_in is null)
order by queue_artifacts.task_id, queue_artifacts.run_id, queue_artifacts.name
limit get_page_limit(page_size_in)
offset get_page_offset(page_offset_in);
end