summaryrefslogtreecommitdiff
path: root/vendor/github.com/authzed/spicedb/internal/services/v1/watchutil.go
blob: 08910a12bf8162f8583f860e66909d9c705c176d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package v1

import (
	v1 "github.com/authzed/authzed-go/proto/authzed/api/v1"

	"github.com/authzed/spicedb/pkg/datastore"
)

func convertWatchKindToContent(kinds []v1.WatchKind) datastore.WatchContent {
	res := datastore.WatchRelationships
	for _, kind := range kinds {
		switch kind {
		case v1.WatchKind_WATCH_KIND_INCLUDE_RELATIONSHIP_UPDATES:
			res |= datastore.WatchRelationships
		case v1.WatchKind_WATCH_KIND_INCLUDE_SCHEMA_UPDATES:
			res |= datastore.WatchSchema
		case v1.WatchKind_WATCH_KIND_INCLUDE_CHECKPOINTS:
			res |= datastore.WatchCheckpoints
		}
	}
	return res
}