Skip to content

Commit f460c4b

Browse files
ecordellmiparnisari
authored andcommitted
Merge pull request #144 from ecordell/downloadapi
add download api definition to materialize v0
2 parents 93ee761 + 458a515 commit f460c4b

File tree

3 files changed

+55
-3
lines changed

3 files changed

+55
-3
lines changed

authzed/api/materialize/v0/watchpermissionsets.proto

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ service WatchPermissionSetsService {
5454
// cursor received. Once completed, the consumer may start streaming permission set changes using WatchPermissionSets
5555
// and the revision token from the last LookupPermissionSets response.
5656
rpc LookupPermissionSets(LookupPermissionSetsRequest) returns (stream LookupPermissionSetsResponse) {}
57+
58+
// DownloadPermissionSets returns URLs to download permission sets data as Avro files.
59+
// This provides an alternative to LookupPermissionSets for customers who need to download
60+
// large datasets efficiently. The returned URLs point to compressed Avro files containing
61+
// the permission sets data in a normalized format.
62+
rpc DownloadPermissionSets(DownloadPermissionSetsRequest) returns (DownloadPermissionSetsResponse) {}
5763
}
5864

5965
message WatchPermissionSetsRequest {
@@ -186,3 +192,21 @@ message BreakingSchemaChange {
186192
// change_at is the revision at which a breaking schema event has happened.
187193
authzed.api.v1.ZedToken change_at = 1;
188194
}
195+
196+
message DownloadPermissionSetsRequest {
197+
// optional_at_revision is a specific revision to download; for now this will
198+
// just validate that it matches the backing store if provided.
199+
authzed.api.v1.ZedToken optional_at_revision = 1;
200+
}
201+
202+
message File {
203+
// name is the filename of the downloadable file
204+
string name = 1;
205+
// url is the download URL for the file (typically a signed S3 URL)
206+
string url = 2;
207+
}
208+
209+
message DownloadPermissionSetsResponse {
210+
// files contains the list of downloadable files with their URLs
211+
repeated File files = 1;
212+
}

authzed/api/v1/watch_service.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ message WatchRequest {
7474
repeated RelationshipFilter optional_relationship_filters = 3;
7575

7676
// optional_update_kinds, if specified, indicates what kinds of mutations to include.
77+
// If your SpiceDB instance is running behind a proxy that aborts idle connections,
78+
// we recommend including Checkpoints to keep the stream alive even when there are no changes.
7779
repeated WatchKind optional_update_kinds = 4;
7880
}
7981

docs/apidocs.swagger.json

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -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",
@@ -3116,7 +3142,7 @@
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
},
31223148
"description": "WatchRequest specifies what mutations to watch for, and an optional start snapshot for when to start\nwatching."

0 commit comments

Comments
 (0)