aboutsummaryrefslogtreecommitdiff
path: root/crates/secd/proto/authzed/api/v1/watch_service.proto
blob: 21aaccd0c3daa79845d55046d82963d4da096e40 (plain)
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
syntax = "proto3";
package authzed.api.v1;

option go_package = "github.com/authzed/authzed-go/proto/authzed/api/v1";
option java_package = "com.authzed.api.v1";

import "google/api/annotations.proto";
import "validate/validate.proto";

import "authzed/api/v1/core.proto";

service WatchService {
  rpc Watch(WatchRequest) returns (stream WatchResponse) {
    option (google.api.http) = {
      post: "/v1/watch"
      body: "*"
    };
  }
}

// WatchRequest specifies the object definitions for which we want to start
// watching mutations, and an optional start snapshot for when to start
// watching.
message WatchRequest {
  repeated string optional_object_types = 1 [
    (validate.rules).repeated .min_items = 0,
    (validate.rules).repeated .items.string = {
      pattern : "^([a-z][a-z0-9_]{1,62}[a-z0-9]/"
                ")?[a-z][a-z0-9_]{1,62}[a-z0-9]$",
      max_bytes : 128,
    }
  ];

  ZedToken optional_start_cursor = 2;
}

// WatchResponse contains all tuple modification events in ascending
// timestamp order, from the requested start snapshot to a snapshot
// encoded in the watch response. The client can use the snapshot to resume
// watching where the previous watch response left off.
message WatchResponse {
  repeated RelationshipUpdate updates = 1;
  ZedToken changes_through = 2;
}