Skip to content

Commit c273586

Browse files
committed
adds a new event to denote a breaking schema change
A breaking schema changes require recomputing the snapshot to rebuild the Materialize index, and in turn once this is ready, the consumer will have to rebuild their own indexes. This event is added to differentiate between "schema changed" and "index ready after schema changed" events.
1 parent 78c93bb commit c273586

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

authzed/api/materialize/v0/watchpermissionsets.proto

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,12 @@ message WatchPermissionSetsResponse {
8181
// the permission set snapshot needs to be rebuilt from scratch. This typically happens when the origin SpiceDB
8282
// cluster has seen its schema changed.
8383
LookupPermissionSetsRequired lookup_permission_sets_required = 3;
84+
85+
// breaking_schema_change is a signal that a breaking schema change has been written to the origin SpiceDB cluster,
86+
// and that the consumer should expect delays in the ingestion of new changes,
87+
// because the permission set snapshot needs to be rebuilt from scratch. Once the snapshot is ready, the consumer
88+
// will receive a LookupPermissionSetsRequired event.
89+
BreakingSchemaChange breaking_schema_change = 4;
8490
}
8591
}
8692

@@ -159,8 +165,16 @@ message MemberReference {
159165

160166
// LookupPermissionSetsRequired is a signal that the consumer should perform a LookupPermissionSets call because
161167
// the permission set snapshot needs to be rebuilt from scratch. This typically happens when the origin SpiceDB
162-
// cluster has seen its schema changed.
168+
// cluster has seen its schema changed, see BreakingSchemaChange event.
163169
message LookupPermissionSetsRequired {
164170
// required_lookup_at is the snapshot revision at which the permission set needs to be rebuilt to.
165171
authzed.api.v1.ZedToken required_lookup_at = 1;
172+
}
173+
174+
// BreakingSchemaChange is used to signal a breaking schema change has happened, and that the consumer should
175+
// expect delays in the ingestion of new changes, because the permission set snapshot needs to be rebuilt from scratch.
176+
// Once the snapshot is ready, the consumer will receive a LookupPermissionSetsRequired event.
177+
message BreakingSchemaChange {
178+
// change_at is the revision at which a breaking schema event has happened.
179+
authzed.api.v1.ZedToken change_at = 1;
166180
}

0 commit comments

Comments
 (0)