-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueueber.capnp
More file actions
76 lines (60 loc) · 1.41 KB
/
Copy pathqueueber.capnp
File metadata and controls
76 lines (60 loc) · 1.41 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
@0xbab6e22de0402699;
using Rust = import "rust.capnp";
$Rust.parentModule("protocol");
struct AddRequest {
items @0 :List(Item);
}
struct AddResponse {
ids @0 :List(Data);
}
struct RemoveRequest {
id @0 :Data;
lease @1 :Data;
}
struct RemoveResponse {
removed @0 :Bool;
}
struct PollRequest {
leaseValiditySecs @0 :UInt64;
# maximum number of items to return. default 1 if unset/zero
numItems @1 :UInt32;
# how long to wait for items before returning (seconds). server may return sooner
timeoutSecs @2 :UInt64;
}
struct Item {
contents @0 :Data;
# unset/ignored when adding
visibilityTimeoutSecs @1 :UInt64;
}
struct PollResponse {
items @0 :List(PolledItem);
lease @1 :Data;
}
struct PolledItem {
contents @0 :Data;
id @1 :Data;
}
interface Queue {
add @00 (req :AddRequest) -> (resp :AddResponse);
remove @01 (req :RemoveRequest) -> (resp :RemoveResponse);
poll @02 (req :PollRequest) -> (resp :PollResponse);
extend @03 (req :ExtendRequest) -> (resp :ExtendResponse);
}
struct ExtendRequest {
lease @0 :Data;
leaseValiditySecs @1 :UInt64;
}
struct ExtendResponse {
extended @0 :Bool;
}
# internal stuff (TODO: move to own file)
struct StoredItem {
contents @0 :Data;
visibilityTsIndexKey @1 :Data;
id @2 :Data;
}
struct LeaseEntry {
ids @0 :List(Data);
expiryTsSecs @1 :UInt64;
expiryTsIndexKey @2 :Data;
}