// Vendored from github.com/authzed/api@b550d757d703fd39ea28799b30daa4de78cd1987, annotations stripped by vendor.py. Apache-2.0. syntax = "proto3"; package authzed.api.v1; import "authzed/api/v1/core.proto"; import "authzed/api/v1/permission_service.proto"; import "google/protobuf/struct.proto"; option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1"; option java_multiple_files = true; option java_package = "com.authzed.api.v1"; service WatchService { // Watch returns a stream of events that occurred in the datastore in ascending timestamp order. // The events can be relationship updates, schema updates, or checkpoints. rpc Watch(WatchRequest) returns (stream WatchResponse) { } } enum WatchKind { WATCH_KIND_UNSPECIFIED = 0; // Default, just relationship updates (for backwards compatibility) WATCH_KIND_INCLUDE_RELATIONSHIP_UPDATES = 1; WATCH_KIND_INCLUDE_SCHEMA_UPDATES = 2; WATCH_KIND_INCLUDE_CHECKPOINTS = 3; } // WatchRequest specifies what mutations to watch for, and an optional start point for when to start // watching. message WatchRequest { // optional_object_types is a filter of resource object types to watch for relationship changes. // If specified, only changes to the specified object types will be returned and // optional_relationship_filters cannot be used. repeated string optional_object_types = 1 ; // optional_start_cursor is the ZedToken holding the point-in-time at // which to start watching for changes. // If not specified, the watch will start from the current SpiceDB revision time of the request ("head revision"). // Note that if this cursor references a point-in-time containing data // that has been garbage collected, an error will be returned. ZedToken optional_start_cursor = 2; // optional_relationship_filters, if specified, indicates the // filter(s) to apply to each relationship to be returned by watch. // The relationship will be returned as long as at least one filter matches, // this allows clients to match relationships on multiple filters on a single watch call. // If specified, optional_object_types cannot be used. repeated RelationshipFilter optional_relationship_filters = 3; // optional_update_kinds, if specified, indicates what kinds of mutations to include. // If your SpiceDB instance is running behind a proxy that aborts idle connections, // we recommend including Checkpoints to keep the stream alive even when there are no changes. repeated WatchKind optional_update_kinds = 4; } // WatchResponse contains all mutation events in ascending timestamp order. // This excludes relationships that were deleted because they expired. // The response includes a field that can be used to resume // watching from that point. message WatchResponse { // updates are the RelationshipUpdate events that have occurred since the // call was made, or since the point in time specified by changes_through. repeated RelationshipUpdate updates = 1; // changes_through is the ZedToken that represents the point in time // that the watch response is current through. This token can be used // in a subsequent WatchRequest to resume watching from this point. ZedToken changes_through = 2; // optional_transaction_metadata is an optional field that returns the transaction metadata // given to SpiceDB during the transaction that produced the changes in this response. // This field may not exist if no transaction metadata was provided, or if multiple pieces // of metadata were found during the transaction (in which case it is ambiguous which to return). google.protobuf.Struct optional_transaction_metadata = 3; // schema_updated, if true, indicates that the schema was changed in this revision. bool schema_updated = 4; // is_checkpoint, if true, indicates that a checkpoint was reached. // A checkpoint indicates that the server guarantees that the client // will not observe any changes at a revision below or equal to the revision in this response. bool is_checkpoint = 5; // full_revision_metadata contains all transaction metadata given to SpiceDB during the // revision that produced the changes in this response. Some datastores (such as CockroachDB) // can "merge" multiple transactions into a single revision (if the changes occurred concurrently), // so this field is a list of all transaction metadata seen during the revision. repeated google.protobuf.Struct full_revision_metadata = 6; }