Skip to content

Commit 7f678cf

Browse files
committed
amend watch api docs
1 parent 3fd6bfb commit 7f678cf

File tree

4 files changed

+50
-21
lines changed

4 files changed

+50
-21
lines changed

authzed/api/v1/core.proto

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,8 +115,9 @@ message ObjectReference {
115115
];
116116
}
117117

118-
// ZedToken is used to provide causality metadata between Write and Check
119-
// requests.
118+
// ZedToken represents a point in time, or a "revision" in SpiceDB.
119+
// It is used to provide causality metadata between Write and read requests (Check, Read, LR, LS)
120+
// and can also be used to start watching for changes from a specific point in time.
120121
//
121122
// See the authzed.api.v1.Consistency message for more information.
122123
message ZedToken {

authzed/api/v1/permission_service.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,7 @@ message WriteRelationshipsRequest {
399399
}
400400

401401
message WriteRelationshipsResponse {
402+
// written_at is the revision at which the relationships were deleted.
402403
ZedToken written_at = 1;
403404
}
404405

authzed/api/v1/watch_service.proto

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ enum WatchKind {
3434
WATCH_KIND_INCLUDE_CHECKPOINTS = 3;
3535
}
3636

37-
// WatchRequest specifies what mutations to watch for, and an optional start snapshot for when to start
37+
// WatchRequest specifies what mutations to watch for, and an optional start point for when to start
3838
// watching.
3939
message WatchRequest {
4040
// optional_object_types is a filter of resource object types to watch for relationship changes.
@@ -59,9 +59,7 @@ message WatchRequest {
5959

6060
// optional_start_cursor is the ZedToken holding the point-in-time at
6161
// which to start watching for changes.
62-
// If not specified, the watch will begin at the current head revision
63-
// of the datastore, returning any updates that occur after the caller
64-
// makes the request.
62+
// If not specified, the watch will start from the current SpiceDB revision time of the request ("head revision").
6563
// Note that if this cursor references a point-in-time containing data
6664
// that has been garbage collected, an error will be returned.
6765
ZedToken optional_start_cursor = 2;
@@ -74,16 +72,18 @@ message WatchRequest {
7472
repeated RelationshipFilter optional_relationship_filters = 3;
7573

7674
// optional_update_kinds, if specified, indicates what kinds of mutations to include.
75+
// If your SpiceDB instance is running behind a proxy that aborts idle connections,
76+
// we recommend including Checkpoints to keep the stream alive even when there are no changes.
7777
repeated WatchKind optional_update_kinds = 4;
7878
}
7979

80-
// WatchResponse contains all mutation events in ascending timestamp order,
81-
// from the requested start snapshot to a snapshot
82-
// encoded in the watch response. The client can use the snapshot to resume
83-
// watching where the previous watch response left off.
80+
// WatchResponse contains all mutation events in ascending timestamp order.
81+
// This excludes relationships that were deleted because they expired.
82+
// The response includes a field that can be used to resume
83+
// watching from that point.
8484
message WatchResponse {
8585
// updates are the RelationshipUpdate events that have occurred since the
86-
// last watch response.
86+
// call was made, or since the point in time specified by changes_through.
8787
repeated RelationshipUpdate updates = 1;
8888

8989
// changes_through is the ZedToken that represents the point in time

docs/apidocs.swagger.json

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -974,7 +974,7 @@
974974
"parameters": [
975975
{
976976
"name": "body",
977-
"description": "WatchRequest specifies what mutations to watch for, and an optional start snapshot for when to start\nwatching.",
977+
"description": "WatchRequest specifies what mutations to watch for, and an optional start point for when to start\nwatching.",
978978
"in": "body",
979979
"required": true,
980980
"schema": {
@@ -1618,6 +1618,19 @@
16181618
},
16191619
"description": "DirectSubjectSet is a subject set which is simply a collection of subjects."
16201620
},
1621+
"DownloadPermissionSetsResponse": {
1622+
"type": "object",
1623+
"properties": {
1624+
"files": {
1625+
"type": "array",
1626+
"items": {
1627+
"type": "object",
1628+
"$ref": "#/definitions/File"
1629+
},
1630+
"title": "files contains the list of downloadable files with their URLs"
1631+
}
1632+
}
1633+
},
16211634
"ExpCaveat": {
16221635
"type": "object",
16231636
"properties": {
@@ -2119,6 +2132,19 @@
21192132
},
21202133
"description": "ExportBulkRelationshipsResponse is one page in a stream of relationship\ngroups that meet the criteria specified by the originating request. The\nserver will continue to stream back relationship groups as quickly as it can\nuntil all relationships have been transmitted back."
21212134
},
2135+
"File": {
2136+
"type": "object",
2137+
"properties": {
2138+
"name": {
2139+
"type": "string",
2140+
"title": "name is the filename of the downloadable file"
2141+
},
2142+
"url": {
2143+
"type": "string",
2144+
"title": "url is the download URL for the file (typically a signed S3 URL)"
2145+
}
2146+
}
2147+
},
21222148
"ImportBulkRelationshipsRequest": {
21232149
"type": "object",
21242150
"properties": {
@@ -2264,11 +2290,11 @@
22642290
"optionalConcreteLimit": {
22652291
"type": "integer",
22662292
"format": "int64",
2267-
"description": "optional_concrete_limit, if non-zero, specifies the limit on the number of\n*concrete* (non-wildcard) subjects to return before the stream is closed on the\nserver side. With the default value of zero, the stream will continue resolving\nconcrete subjects until exhausted or the stream is closed due to the client or\na network issue.\n\nNOTE: Wildcard subjects (\"*\") have special treatment when cursors and limits are used. Because\nwildcards can apply to *any* concrete subjects, if a wildcard subject is found within the dataset,\na wildcard subject can be returned for *all* LookupSubjects calls, regardless of the cursor or\nlimit.\n\nFor example, if wildcards are requested, a wildcard subject exists, there is a specified limit\nof 10 concrete subjects, and at least 10 concrete subjects exist, the API will return 11 subjects\nin total: the 10 concrete + the wildcard\n\nFurthermore, if a wildcard has a set of exclusions generated by the dataset,\nthe exclusions *will respect the cursor* and only a *partial* set of exclusions will be returned\nfor each invocation of the API.\n\n***IT IS UP TO THE CALLER IN THIS CASE TO COMBINE THE EXCLUSIONS IF DESIRED***"
2293+
"description": "optional_concrete_limit is currently unimplemented for LookupSubjects\nand will return an error as of SpiceDB version 1.40.1. This will\nbe implemented in a future version of SpiceDB."
22682294
},
22692295
"optionalCursor": {
22702296
"$ref": "#/definitions/v1.Cursor",
2271-
"description": "optional_cursor, if specified, indicates the cursor after which results should resume being returned.\nThe cursor can be found on the LookupSubjectsResponse object.\n\nNOTE: See above for notes about how cursors interact with wildcard subjects."
2297+
"description": "optional_cursor is currently unimplemented for LookupSubjects\nand will be ignored as of SpiceDB version 1.40.1. This will\nbe implemented in a future version of SpiceDB."
22722298
},
22732299
"wildcardOption": {
22742300
"$ref": "#/definitions/WildcardOption",
@@ -3101,7 +3127,7 @@
31013127
},
31023128
"optionalStartCursor": {
31033129
"$ref": "#/definitions/ZedToken",
3104-
"description": "optional_start_cursor is the ZedToken holding the point-in-time at\nwhich to start watching for changes.\nIf not specified, the watch will begin at the current head revision\nof the datastore, returning any updates that occur after the caller\nmakes the request.\nNote that if this cursor references a point-in-time containing data\nthat has been garbage collected, an error will be returned."
3130+
"description": "optional_start_cursor is the ZedToken holding the point-in-time at\nwhich to start watching for changes.\nIf not specified, the watch will start from the current SpiceDB revision time of the request (\"head revision\").\nNote that if this cursor references a point-in-time containing data\nthat has been garbage collected, an error will be returned."
31053131
},
31063132
"optionalRelationshipFilters": {
31073133
"type": "array",
@@ -3116,10 +3142,10 @@
31163142
"items": {
31173143
"$ref": "#/definitions/WatchKind"
31183144
},
3119-
"description": "optional_update_kinds, if specified, indicates what kinds of mutations to include."
3145+
"description": "optional_update_kinds, if specified, indicates what kinds of mutations to include.\nIf your SpiceDB instance is running behind a proxy that aborts idle connections,\nwe recommend including Checkpoints to keep the stream alive even when there are no changes."
31203146
}
31213147
},
3122-
"description": "WatchRequest specifies what mutations to watch for, and an optional start snapshot for when to start\nwatching."
3148+
"description": "WatchRequest specifies what mutations to watch for, and an optional start point for when to start\nwatching."
31233149
},
31243150
"WatchResponse": {
31253151
"type": "object",
@@ -3130,7 +3156,7 @@
31303156
"type": "object",
31313157
"$ref": "#/definitions/RelationshipUpdate"
31323158
},
3133-
"description": "updates are the RelationshipUpdate events that have occurred since the\nlast watch response."
3159+
"description": "updates are the RelationshipUpdate events that have occurred since the\ncall was made, or since the point in time specified by changes_through."
31343160
},
31353161
"changesThrough": {
31363162
"$ref": "#/definitions/ZedToken",
@@ -3149,7 +3175,7 @@
31493175
"description": "is_checkpoint, if true, indicates that a checkpoint was reached.\nA checkpoint indicates that the server guarantees that the client\nwill not observe any changes at a revision below or equal to the revision in this response."
31503176
}
31513177
},
3152-
"description": "WatchResponse contains all mutation events in ascending timestamp order,\nfrom the requested start snapshot to a snapshot\nencoded in the watch response. The client can use the snapshot to resume\nwatching where the previous watch response left off."
3178+
"description": "WatchResponse contains all mutation events in ascending timestamp order.\nThis excludes relationships that were deleted because they expired.\nThe response includes a field that can be used to resume\nwatching from that point."
31533179
},
31543180
"WatchedPermission": {
31553181
"type": "object",
@@ -3210,7 +3236,8 @@
32103236
"type": "object",
32113237
"properties": {
32123238
"writtenAt": {
3213-
"$ref": "#/definitions/ZedToken"
3239+
"$ref": "#/definitions/ZedToken",
3240+
"description": "written_at is the revision at which the relationships were deleted."
32143241
}
32153242
}
32163243
},
@@ -3241,7 +3268,7 @@
32413268
"type": "string"
32423269
}
32433270
},
3244-
"description": "ZedToken is used to provide causality metadata between Write and Check\nrequests.\n\nSee the authzed.api.v1.Consistency message for more information."
3271+
"description": "ZedToken represents a point in time, or a \"revision\" in SpiceDB.\nIt is used to provide causality metadata between Write and read requests (Check, Read, LR, LS)\nand can also be used to start watching for changes from a specific point in time.\n\nSee the authzed.api.v1.Consistency message for more information."
32453272
},
32463273
"v0.Cursor": {
32473274
"type": "object",

0 commit comments

Comments
 (0)